Record Class Cholesky

java.lang.Object
java.lang.Record
smile.tensor.Cholesky
Record Components:
lu - the Cholesky factorization.
All Implemented Interfaces:
Serializable

public record Cholesky(DenseMatrix lu) extends Record implements Serializable
The Cholesky decomposition of a symmetric, 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.

See Also:
  • Constructor Details

    • Cholesky

      public Cholesky(DenseMatrix lu)
      Constructor.
      Parameters:
      lu - the lower/upper triangular part of matrix contains the Cholesky factorization.
  • Method Details

    • det

      public double det()
      Returns the matrix determinant.
      Returns:
      the matrix determinant.
    • logdet

      public double logdet()
      Returns the log of matrix determinant.
      Returns:
      the log of matrix determinant.
    • inverse

      public DenseMatrix inverse()
      Returns the inverse of matrix.
      Returns:
      the inverse of matrix.
    • solve

      public Vector solve(double[] b)
      Solve A * x = b.
      Parameters:
      b - the right hand side of linear systems.
      Returns:
      the solution vector.
      Throws:
      RuntimeException - when the matrix is singular.
    • solve

      public Vector solve(float[] b)
      Solve A * x = b.
      Parameters:
      b - the right hand side of linear systems.
      Returns:
      the solution vector.
      Throws:
      RuntimeException - when the matrix is singular.
    • solve

      public void solve(DenseMatrix B)
      Solves the linear system A * X = B.
      Parameters:
      B - the right hand side of linear systems. On output, B will be overwritten with the solution matrix.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • lu

      public DenseMatrix lu()
      Returns the value of the lu record component.
      Returns:
      the value of the lu record component