Package smile.math.matrix
Class SymmMatrix
java.lang.Object
smile.math.matrix.IMatrix
smile.math.matrix.SymmMatrix
- All Implemented Interfaces:
Serializable
The symmetric matrix in packed storage.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe LU decomposition.static classThe Cholesky decomposition of a symmetric, positive-definite matrix.Nested classes/interfaces inherited from class smile.math.matrix.IMatrix
IMatrix.Preconditioner -
Constructor Summary
ConstructorsConstructorDescriptionSymmMatrix(UPLO uplo, double[][] AP) Constructor.SymmMatrix(UPLO uplo, int n) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbk()Bunch-Kaufman decomposition.cholesky()Cholesky decomposition for symmetric and positive definite matrix.copy()Returns a deep copy of matrix.booleanbooleanequals(SymmMatrix o, double epsilon) Returns true if two matrices equal in given precision.doubleget(int i, int j) ReturnsA[i,j].layout()Returns the matrix layout.voidmv(double[] work, int inputOffset, int outputOffset) Matrix-vector multiplicationA * x.voidMatrix-vector multiplication.intncol()Returns the number of columns.intnrow()Returns the number of rows.voidset(int i, int j, double x) SetsA[i,j] = x.longsize()Returns the number of stored matrix elements.voidtv(double[] work, int inputOffset, int outputOffset) Matrix-vector multiplicationA' * x.uplo()Gets the format of packed matrix.
-
Constructor Details
-
SymmMatrix
Constructor.- Parameters:
uplo- the symmetric matrix stores the upper or lower triangle.n- the dimension of matrix.
-
SymmMatrix
Constructor.- Parameters:
uplo- the symmetric matrix stores the upper or lower triangle.AP- the symmetric matrix.
-
-
Method Details
-
copy
Description copied from class:IMatrixReturns a deep copy of matrix. -
nrow
public int nrow()Description copied from class:IMatrixReturns the number of rows. -
ncol
public int ncol()Description copied from class:IMatrixReturns the number of columns. -
size
public long size()Description copied from class:IMatrixReturns the number of stored matrix elements. For conventional matrix, it is simply nrow * ncol. But it is usually much less for band, packed or sparse matrix. -
layout
Returns the matrix layout.- Returns:
- the matrix layout.
-
uplo
Gets the format of packed matrix.- Returns:
- the format of packed matrix.
-
equals
-
equals
Returns true if two matrices equal in given precision.- Parameters:
o- the other matrix.epsilon- a number close to zero.- Returns:
- true if two matrices equal in given precision.
-
get
public double get(int i, int j) Description copied from class:IMatrixReturnsA[i,j]. -
set
public void set(int i, int j, double x) Description copied from class:IMatrixSetsA[i,j] = x. -
mv
Description copied from class:IMatrixMatrix-vector multiplication.
where op is the transpose operation.y = alpha * op(A) * x + beta * y -
mv
public void mv(double[] work, int inputOffset, int outputOffset) Description copied from class:IMatrixMatrix-vector multiplicationA * x. -
tv
public void tv(double[] work, int inputOffset, int outputOffset) Description copied from class:IMatrixMatrix-vector multiplicationA' * x. -
bk
Bunch-Kaufman decomposition.- Returns:
- Bunch-Kaufman decomposition.
-
cholesky
Cholesky decomposition for symmetric and positive definite matrix.- Returns:
- Cholesky decomposition.
- Throws:
ArithmeticException- if the matrix is not positive definite.
-