org.spaceroots.mantissa.linalg
Class SymetricalMatrix
- java.lang.Object
-
- org.spaceroots.mantissa.linalg.Matrix
-
- org.spaceroots.mantissa.linalg.SquareMatrix
-
- org.spaceroots.mantissa.linalg.GeneralSquareMatrix
-
- org.spaceroots.mantissa.linalg.SymetricalMatrix
-
- All Implemented Interfaces:
- java.io.Serializable
public class SymetricalMatrix extends GeneralSquareMatrix
This class implements symetrical matrices of linear algebra.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SymetricalMatrix(double w, double[] a)Build the symetrical matrix resulting from the product w.A.At.SymetricalMatrix(int order)Simple constructor.SymetricalMatrix(int order, double[] data)Simple constructor.SymetricalMatrix(SymetricalMatrix s)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Matrixduplicate()Polymorphic copy operator.voidselfAdd(SymetricalMatrix s)Add a matrix to the instance.voidselfAddWAAt(double w, double[] a)Add the symetrical matrix resulting from the product w.A.At to the instance.voidselfSub(SymetricalMatrix s)Substract a matrix from the instance.voidsetElement(int i, int j, double value)Set a matrix element.voidsetElementAndSymetricalElement(int i, int j, double value)Set both a matrix element and its symetrical element.-
Methods inherited from class org.spaceroots.mantissa.linalg.GeneralSquareMatrix
getDeterminant, selfAdd, selfSub, solve
-
Methods inherited from class org.spaceroots.mantissa.linalg.SquareMatrix
getInverse, solve
-
Methods inherited from class org.spaceroots.mantissa.linalg.Matrix
add, getColumns, getElement, getRows, getTranspose, mul, mul, selfMul, sub, toString
-
-
-
-
Constructor Detail
-
SymetricalMatrix
public SymetricalMatrix(int order)
Simple constructor. This constructor builds a symetrical matrix of specified order, all elements beeing zeros.- Parameters:
order- order of the matrix
-
SymetricalMatrix
public SymetricalMatrix(int order, double[] data)Simple constructor. Build a matrix with specified elements.- Parameters:
order- order of the matrixdata- table of the matrix elements (stored row after row)
-
SymetricalMatrix
public SymetricalMatrix(SymetricalMatrix s)
Copy constructor.- Parameters:
s- square matrix to copy
-
SymetricalMatrix
public SymetricalMatrix(double w, double[] a)Build the symetrical matrix resulting from the product w.A.At.- Parameters:
w- multiplicative factor (weight)a- base vector used to compute the symetrical contribution
-
-
Method Detail
-
duplicate
public Matrix duplicate()
Description copied from class:MatrixPolymorphic copy operator. This method build a new object of the same type of the instance. It is somewhat similar to theObject.clone()method, except that it has public access, it doesn't throw any specific exception and it returns a Matrix.- Overrides:
duplicatein classGeneralSquareMatrix- See Also:
Object.clone()
-
setElement
public void setElement(int i, int j, double value)Set a matrix element. On symetrical matrices, setting separately elements outside of the diagonal is forbidden, so this method throws an ArrayIndexOutOfBoundsException in this case. ThesetElementAndSymetricalElement(int, int, double)can be used to set both elements simultaneously.- Overrides:
setElementin classGeneralSquareMatrix- Parameters:
i- row index, from 0 to rows - 1j- column index, from 0 to cols - 1value- value of the element- Throws:
java.lang.ArrayIndexOutOfBoundsException- if the indices are wrong- See Also:
setElementAndSymetricalElement(int, int, double),Matrix.getElement(int, int)
-
setElementAndSymetricalElement
public void setElementAndSymetricalElement(int i, int j, double value)Set both a matrix element and its symetrical element.- Parameters:
i- row index of first element (column index of second element), from 0 to order - 1j- column index of first element (row index of second element), from 0 to order - 1value- value of the elements- Throws:
java.lang.ArrayIndexOutOfBoundsException- if the indices are wrong- See Also:
setElement(int, int, double),Matrix.getElement(int, int)
-
selfAdd
public void selfAdd(SymetricalMatrix s)
Add a matrix to the instance. This method adds a matrix to the instance. It does modify the instance.- Parameters:
s- symetrical matrix to add- Throws:
java.lang.IllegalArgumentException- if there is a dimension mismatch
-
selfSub
public void selfSub(SymetricalMatrix s)
Substract a matrix from the instance. This method substracts a matrix from the instance. It does modify the instance.- Parameters:
s- symetrical matrix to substract- Throws:
java.lang.IllegalArgumentException- if there is a dimension mismatch
-
selfAddWAAt
public void selfAddWAAt(double w, double[] a)Add the symetrical matrix resulting from the product w.A.At to the instance. This method can be used to build progressively the matrices of least square problems. The instance is modified.- Parameters:
w- multiplicative factor (weight)a- base vector used to compute the symetrical contribution- Throws:
java.lang.IllegalArgumentException- if there is a dimension mismatch
-
-
DataMelt 3.0 © DataMelt by jWork.ORG