hephysics.matrix
Class SymmetricMatrix
- java.lang.Object
- 
- hephysics.matrix.SymmetricMatrix
 
- 
- All Implemented Interfaces:
- Matrix, MutableMatrix, java.io.Serializable
 
 
 public class SymmetricMatrix extends java.lang.Object implements MutableMatrix, java.io.Serializable A simple implementation of a symmetric matrix. A symmmetric matrix is a square matrix for whiche(i,j) == e(j,i).- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor and Description SymmetricMatrix(int size)Creates a new instance of SymmetricMatrix with all elements set to zero.SymmetricMatrix(int size, double[] initialValues, boolean isLower)Creates a new instance of SymmetricMatrix with the given initial values.SymmetricMatrix(Matrix mIn)Construct a SymmetricMatrix by copying an existing matrix.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]asPackedArray(boolean isLower)Returns the matrix as a packed arraydoubledet()doublediagonal(int index)Returns the diagonal element for the given row/columndoublee(int x, int y)Returns a specific elementintgetNColumns()Returns the number of columnsintgetNRows()Returns the number of rowsvoidincrementElement(int x, int y, double value)Increment a specific elementvoidinvert()Invert this matrix (into itself)voidsetElement(int x, int y, double value)Set a specific elementjava.lang.StringtoString()voidtranspose()Tranpose this matrix (into itself)
 
- 
- 
- 
Constructor Detail- 
SymmetricMatrixpublic SymmetricMatrix(int size) Creates a new instance of SymmetricMatrix with all elements set to zero.- Parameters:
- size- The rank of the matrix
 
 - 
SymmetricMatrixpublic SymmetricMatrix(Matrix mIn) Construct a SymmetricMatrix by copying an existing matrix. If the input matrix is a SymmetricMatrix it is copied exactly. Otherwise if the input matrix is square the lower left elements are copied If the matrix is not square an illegal argument exception is thrown.
 - 
SymmetricMatrixpublic SymmetricMatrix(int size, double[] initialValues, boolean isLower)Creates a new instance of SymmetricMatrix with the given initial values.- Parameters:
- size- The rank of the matrix
- initialValues- The initial values for the matrix
- isLower- If true initial values must be m(0,0), m(1,0), m(1,1), ... otherwise m(0,0), m(0,1), m(0,2), ...
 
 
- 
 - 
Method Detail- 
asPackedArraypublic double[] asPackedArray(boolean isLower) Returns the matrix as a packed array- Parameters:
- isLower- if true array is packed m(0,0), m(1,0), m(1,1),... else m(0,0), m(0,1), m(0,2), ...
 
 - 
getNRowspublic int getNRows() Description copied from interface:MatrixReturns the number of rows
 - 
getNColumnspublic int getNColumns() Description copied from interface:MatrixReturns the number of columns- Specified by:
- getNColumnsin interface- Matrix
 
 - 
diagonalpublic double diagonal(int index) Returns the diagonal element for the given row/column
 - 
setElementpublic void setElement(int x, int y, double value)Set a specific element- Specified by:
- setElementin interface- MutableMatrix
 
 - 
incrementElementpublic void incrementElement(int x, int y, double value)Increment a specific element
 - 
detpublic double det() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
invertpublic void invert() throws MatrixOp.IndeterminateMatrixExceptionDescription copied from interface:MutableMatrixInvert this matrix (into itself)- Specified by:
- invertin interface- MutableMatrix
- Throws:
- MatrixOp.IndeterminateMatrixException
- See Also:
- MatrixOp.inverse(Matrix,MutableMatrix)
 
 - 
transposepublic void transpose() Description copied from interface:MutableMatrixTranpose this matrix (into itself)- Specified by:
- transposein interface- MutableMatrix
- See Also:
- MatrixOp.transposed(Matrix,MutableMatrix)
 
 
- 
 
- 
DMelt 3.0 © DataMelt by jWork.ORG