Class Cholesky
- java.lang.Object
-
- smile.math.matrix.Cholesky
-
public class Cholesky extends java.lang.Object
Cholesky decomposition is a decomposition of a symmetric, positive-definite matrix into a lower triangular matrix L and the transpose of the lower triangular matrix such that A = L*L'. The lower triangular matrix is the Cholesky triangle of the original, positive-definite matrix. When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.The Cholesky decomposition is mainly used for the numerical solution of linear equations. The Cholesky decomposition is also commonly used in the Monte Carlo method for simulating systems with multiple correlated variables: The matrix of inter-variable correlations is decomposed, to give the lower-triangular L. Applying this to a vector of uncorrelated simulated shocks, u, produces a shock vector Lu with the covariance properties of the system being modeled.
Unscented Kalman filters commonly use the Cholesky decomposition to choose a set of so-called sigma points. The Kalman filter tracks the average state of a system as a vector x of length n and covariance as an n-by-n matrix P. The matrix P is always positive semi-definite, and can be decomposed into L*L'. The columns of L can be added and subtracted from the mean x to form a set of 2n vectors called sigma points. These sigma points completely capture the mean and covariance of the system state.
If the matrix is not positive definite, an exception will be thrown out from the method decompose().
- Author:
- Haifeng Li
-
-
Field Summary
Fields Modifier and Type Field Description protected DenseMatrix
L
Array for internal storage of decomposition.
-
Constructor Summary
Constructors Constructor Description Cholesky(DenseMatrix L)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
det()
Returns the matrix determinantDenseMatrix
getL()
Returns lower triangular factor.DenseMatrix
inverse()
Returns the matrix inverse.void
solve(double[] b)
Solve the linear system A * x = b.void
solve(DenseMatrix B)
Solve the linear system A * X = B.
-
-
-
Field Detail
-
L
protected DenseMatrix L
Array for internal storage of decomposition.
-
-
Constructor Detail
-
Cholesky
public Cholesky(DenseMatrix L)
Constructor.- Parameters:
L
- the lower triangular part of matrix contains the Cholesky factorization.
-
-
Method Detail
-
getL
public DenseMatrix getL()
Returns lower triangular factor.
-
det
public double det()
Returns the matrix determinant
-
inverse
public DenseMatrix inverse()
Returns the matrix inverse.
-
solve
public void solve(double[] b)
Solve the linear system A * x = b. On output, b will be overwritten with the solution vector.- Parameters:
b
- the right hand side of linear systems. On output, b will be overwritten with solution vector.
-
solve
public void solve(DenseMatrix B)
Solve the linear system A * X = B. On output, B will be overwritten with the solution matrix.- Parameters:
B
- the right hand side of linear systems.
-
-