Top Description Fields Constructors Methods
org.apache.commons.math3.linear

public Class RectangularCholeskyDecomposition

extends Object
Class Inheritance
Imports
org.apache.commons.math3.util.FastMath

Calculates the rectangular Cholesky decomposition of a matrix.

The rectangular Cholesky decomposition of a real symmetric positive semidefinite matrix A consists of a rectangular matrix B with the same number of rows such that: A is almost equal to BBT, depending on a user-defined tolerance. In a sense, this is the square root of A.

The difference with respect to the regular CholeskyDecomposition is that rows/columns may be permuted (hence the rectangular shape instead of the traditional triangular shape) and there is a threshold to ignore small diagonal elements. This is used for example to generate correlated random n-dimensions vectors in a p-dimension subspace (p < n). In other words, it allows generating random vectors from a covariance matrix that is only positive semidefinite, and not positive definite.

Rectangular Cholesky decomposition is not suited for solving linear systems, so it does not provide any decomposition solver.

Since
2.0 (changed to concrete class in 3.0)
See Also
MathWorld, Wikipedia

Field Summary

Modifier and TypeField and Description
private int
rank

Rank of the symmetric positive semidefinite matrix.

private final RealMatrix
root

Permutated Cholesky root of the symmetric positive semidefinite matrix.

Constructor Summary

AccessConstructor and Description
public
RectangularCholeskyDecomposition(RealMatrix
Symmetric positive semidefinite matrix.
matrix
)

Decompose a symmetric positive semidefinite matrix.

public
RectangularCholeskyDecomposition(RealMatrix
Symmetric positive semidefinite matrix.
matrix
,
double
Diagonal elements threshold under which columns are considered to be dependent on previous ones and are discarded.
small
)

Decompose a symmetric positive semidefinite matrix.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

r of the square matrix.
getRank
()

Get the rank of the symmetric positive semidefinite matrix.

public RealMatrix

Returns:

root of the square matrix
getRootMatrix
()

Get the root of the covariance matrix.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rankback to summary
private int rank

Rank of the symmetric positive semidefinite matrix.

rootback to summary
private final RealMatrix root

Permutated Cholesky root of the symmetric positive semidefinite matrix.

Constructor Detail

RectangularCholeskyDecompositionback to summary
public RectangularCholeskyDecomposition(RealMatrix matrix) throws NonPositiveDefiniteMatrixException

Decompose a symmetric positive semidefinite matrix.

Note

this constructor follows the linpack method to detect dependent columns by proceeding with the Cholesky algorithm until a nonpositive diagonal element is encountered.

Parameters
matrix:RealMatrix

Symmetric positive semidefinite matrix.

Exceptions
NonPositiveDefiniteMatrixException:
if the matrix is not positive semidefinite.
Since
3.1
See Also
Analysis of the Cholesky Decomposition of a Semi-definite Matrix
RectangularCholeskyDecompositionback to summary
public RectangularCholeskyDecomposition(RealMatrix matrix, double small) throws NonPositiveDefiniteMatrixException

Decompose a symmetric positive semidefinite matrix.

Parameters
matrix:RealMatrix

Symmetric positive semidefinite matrix.

small:double

Diagonal elements threshold under which columns are considered to be dependent on previous ones and are discarded.

Exceptions
NonPositiveDefiniteMatrixException:
if the matrix is not positive semidefinite.

Method Detail

getRankback to summary
public int getRank()

Get the rank of the symmetric positive semidefinite matrix. The r is the number of independent rows in the symmetric positive semidefinite matrix, it is also the number of columns of the rectangular matrix of the decomposition.

Returns:int

r of the square matrix.

See Also
getRootMatrix()
getRootMatrixback to summary
public RealMatrix getRootMatrix()

Get the root of the covariance matrix. The root is the rectangular matrix B such that the covariance matrix is equal to B.BT

Returns:RealMatrix

root of the square matrix

See Also
getRank()