## org.apache.commons.math.linear
Class CholeskyDecompositionImpl

    java.lang.Object
      org.apache.commons.math.linear.CholeskyDecompositionImpl

All Implemented Interfaces:
  CholeskyDecomposition

    public class CholeskyDecompositionImpl

extends java.lang.Object
implements CholeskyDecomposition

Calculates the Cholesky decomposition of a matrix.

The Cholesky decomposition of a real symmetric positive-definite matrix A consists of a lower triangular matrix L with same size that satisfy: A = LLTQ = I). In a sense, this is the square root of A.

Since:
  2.0
Version:
  $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $
See Also:
  MathWorld, Wikipedia

Nested Class Summary
`private static class` `CholeskyDecompositionImpl.Solver` Specialized solver.

Field Summary
`private RealMatrix` `cachedL` Cached value of L.
`private RealMatrix` `cachedLT` Cached value of LT.
`static double` `DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD` Default threshold below which diagonal elements are considered null and matrix not positive definite.
`static double` `DEFAULT_RELATIVE_SYMMETRY_THRESHOLD` Default threshold above which off-diagonal elements are considered too different and matrix not symmetric.
`private double[][]` `lTData` Row-oriented storage for LT matrix data.

Constructor Summary
`CholeskyDecompositionImpl(RealMatrix matrix)` Calculates the Cholesky decomposition of the given matrix.
`CholeskyDecompositionImpl(RealMatrix matrix, double relativeSymmetryThreshold, double absolutePositivityThreshold)` Calculates the Cholesky decomposition of the given matrix.

Method Summary
`double` `getDeterminant()` Return the determinant of the matrix
`RealMatrix` `getL()` Returns the matrix L of the decomposition.
`RealMatrix` `getLT()` Returns the transpose of the matrix L of the decomposition.
`DecompositionSolver` `getSolver()` Get a solver for finding the A × X = B solution in least square sense.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_RELATIVE_SYMMETRY_THRESHOLD

    public static final double DEFAULT_RELATIVE_SYMMETRY_THRESHOLD

  Default threshold above which off-diagonal elements are considered too different and matrix not symmetric.

  See Also:
    Constant Field Values

### DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD

    public static final double DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD

  Default threshold below which diagonal elements are considered null and matrix not positive definite.

  See Also:
    Constant Field Values

### lTData

    private double[][] lTData

  Row-oriented storage for LT matrix data.

### cachedL

    private RealMatrix cachedL

  Cached value of L.

### cachedLT

    private RealMatrix cachedLT

  Cached value of LT.

Constructor Detail

### CholeskyDecompositionImpl

    public CholeskyDecompositionImpl(RealMatrix matrix)
                              throws NonSquareMatrixException,
                                     NotSymmetricMatrixException,
                                     NotPositiveDefiniteMatrixException

  Calculates the Cholesky decomposition of the given matrix.

  Calling this constructor is equivalent to call `CholeskyDecompositionImpl(RealMatrix, double, double)` with the thresholds set to the default values `DEFAULT_RELATIVE_SYMMETRY_THRESHOLD` and `DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD`

  Parameters:
    `matrix` - the matrix to decompose
  Throws:
    `NonSquareMatrixException` - if matrix is not square
    `NotSymmetricMatrixException` - if matrix is not symmetric
    `NotPositiveDefiniteMatrixException` - if the matrix is not strictly positive definite
  See Also:
    `CholeskyDecompositionImpl(RealMatrix, double, double)`, `DEFAULT_RELATIVE_SYMMETRY_THRESHOLD`, `DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD`

### CholeskyDecompositionImpl

    public CholeskyDecompositionImpl(RealMatrix matrix,
                                     double relativeSymmetryThreshold,
                                     double absolutePositivityThreshold)
                              throws NonSquareMatrixException,
                                     NotSymmetricMatrixException,
                                     NotPositiveDefiniteMatrixException

  Calculates the Cholesky decomposition of the given matrix.

  Parameters:
    `matrix` - the matrix to decompose
    `relativeSymmetryThreshold` - threshold above which off-diagonal elements are considered too different and matrix not symmetric
    `absolutePositivityThreshold` - threshold below which diagonal elements are considered null and matrix not positive definite
  Throws:
    `NonSquareMatrixException` - if matrix is not square
    `NotSymmetricMatrixException` - if matrix is not symmetric
    `NotPositiveDefiniteMatrixException` - if the matrix is not strictly positive definite
  See Also:
    `CholeskyDecompositionImpl(RealMatrix)`, `DEFAULT_RELATIVE_SYMMETRY_THRESHOLD`, `DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD`

Method Detail

### getL

    public RealMatrix getL()

  Returns the matrix L of the decomposition.

  L is an lower-triangular matrix

  Specified by:
    `getL` in interface `CholeskyDecomposition`
  Returns:
    the L matrix

### getLT

    public RealMatrix getLT()

  Returns the transpose of the matrix L of the decomposition.

  LT is an upper-triangular matrix

  Specified by:
    `getLT` in interface `CholeskyDecomposition`
  Returns:
    the transpose of the matrix L of the decomposition

### getDeterminant

    public double getDeterminant()

  Return the determinant of the matrix

  Specified by:
    `getDeterminant` in interface `CholeskyDecomposition`
  Returns:
    determinant of the matrix

### getSolver

    public DecompositionSolver getSolver()

  Get a solver for finding the A × X = B solution in least square sense.

  Specified by:
    `getSolver` in interface `CholeskyDecomposition`
  Returns:
    a solver

Copyright (c) 2003-2011 Apache Software Foundation