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
Modifier and TypeClassDescriptionstatic class
The LU decomposition.static class
The Cholesky decomposition of a symmetric, positive-definite matrix.Nested classes/interfaces inherited from class smile.math.matrix.IMatrix
IMatrix.Preconditioner
-
Constructor Summary
ConstructorDescriptionSymmMatrix
(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.boolean
boolean
equals
(SymmMatrix o, double epsilon) Returns true if two matrices equal in given precision.double
get
(int i, int j) ReturnsA[i,j]
.layout()
Returns the matrix layout.void
mv
(double[] work, int inputOffset, int outputOffset) Matrix-vector multiplicationA * x
.void
Matrix-vector multiplication.int
ncol()
Returns the number of columns.int
nrow()
Returns the number of rows.void
set
(int i, int j, double x) SetsA[i,j] = x
.long
size()
Returns the number of stored matrix elements.void
tv
(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:IMatrix
Returns a deep copy of matrix. -
nrow
public int nrow()Description copied from class:IMatrix
Returns the number of rows. -
ncol
public int ncol()Description copied from class:IMatrix
Returns the number of columns. -
size
public long size()Description copied from class:IMatrix
Returns 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:IMatrix
ReturnsA[i,j]
. -
set
public void set(int i, int j, double x) Description copied from class:IMatrix
SetsA[i,j] = x
. -
mv
Description copied from class:IMatrix
Matrix-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:IMatrix
Matrix-vector multiplicationA * x
. -
tv
public void tv(double[] work, int inputOffset, int outputOffset) Description copied from class:IMatrix
Matrix-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.
-