Package cern.colt.matrix.linalg
Class CholeskyDecomposition
- java.lang.Object
-
- cern.colt.matrix.linalg.CholeskyDecomposition
-
- All Implemented Interfaces:
java.io.Serializable
public class CholeskyDecomposition extends java.lang.Object implements java.io.SerializableFor a symmetric, positive definite matrix A, the Cholesky decomposition is a lower triangular matrix L so that A = L*L'; If the matrix is not symmetric or positive definite, the constructor returns a partial decomposition and sets an internal flag that may be queried by the isSymmetricPositiveDefinite() method.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisSymmetricPositiveDefiniteSymmetric and positive definite flag.private DoubleMatrix2DLArray for internal storage of decomposition.private intnRow and column dimension (square matrix).(package private) static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description CholeskyDecomposition(DoubleMatrix2D A)Constructs and returns a new Cholesky decomposition object for a symmetric and positive definite matrix; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleMatrix2DgetL()Returns the triangular factor, L.booleanisSymmetricPositiveDefinite()Returns whether the matrix A is symmetric and positive definite.DoubleMatrix2Dsolve(DoubleMatrix2D B)Solves A*X = B; returns X.java.lang.StringtoString()Returns a String with (propertyName, propertyValue) pairs.private DoubleMatrix2DXXXsolveBuggy(DoubleMatrix2D B)Solves A*X = B; returns X.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
L
private DoubleMatrix2D L
Array for internal storage of decomposition.
-
n
private int n
Row and column dimension (square matrix).
-
isSymmetricPositiveDefinite
private boolean isSymmetricPositiveDefinite
Symmetric and positive definite flag.
-
-
Constructor Detail
-
CholeskyDecomposition
public CholeskyDecomposition(DoubleMatrix2D A)
Constructs and returns a new Cholesky decomposition object for a symmetric and positive definite matrix; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.- Parameters:
A- Square, symmetric matrix.- Throws:
java.lang.IllegalArgumentException- if A is not square.
-
-
Method Detail
-
getL
public DoubleMatrix2D getL()
Returns the triangular factor, L.- Returns:
- L
-
isSymmetricPositiveDefinite
public boolean isSymmetricPositiveDefinite()
Returns whether the matrix A is symmetric and positive definite.- Returns:
- true if A is symmetric and positive definite; false otherwise
-
solve
public DoubleMatrix2D solve(DoubleMatrix2D B)
Solves A*X = B; returns X.- Parameters:
B- A Matrix with as many rows as A and any number of columns.- Returns:
- X so that L*L'*X = B.
- Throws:
java.lang.IllegalArgumentException- if B.rows() != A.rows().java.lang.IllegalArgumentException- if !isSymmetricPositiveDefinite().
-
XXXsolveBuggy
private DoubleMatrix2D XXXsolveBuggy(DoubleMatrix2D B)
Solves A*X = B; returns X.- Parameters:
B- A Matrix with as many rows as A and any number of columns.- Returns:
- X so that L*L'*X = B.
- Throws:
java.lang.IllegalArgumentException- if B.rows() != A.rows().java.lang.IllegalArgumentException- if !isSymmetricPositiveDefinite().
-
toString
public java.lang.String toString()
Returns a String with (propertyName, propertyValue) pairs. Useful for debugging or to quickly get the rough picture. For example,rank : 3 trace : 0
- Overrides:
toStringin classjava.lang.Object
-
-