org.ejml.alg.dense.decomposition.chol
Class CholeskyDecompositionCommon

java.lang.Object
  extended by org.ejml.alg.dense.decomposition.chol.CholeskyDecompositionCommon
All Implemented Interfaces:
CholeskyDecomposition<DenseMatrix64F>, DecompositionInterface<DenseMatrix64F>
Direct Known Subclasses:
CholeskyDecompositionBlock, CholeskyDecompositionInner

public abstract class CholeskyDecompositionCommon
extends Object
implements CholeskyDecomposition<DenseMatrix64F>

This is an abstract class for a Cholesky decomposition. It provides the solvers, but the actual decompsoition is provided in other classes.

A Cholesky Decomposition is a special decomposition for positive-definite symmetric matrices that is more efficient than other general purposes decomposition. It refactors matrices using one of the two following equations:

L*LT=A
RT*R=A

where L is a lower triangular matrix and R is an upper traingular matrix.

Author:
Peter Abeles
See Also:
CholeskyDecompositionInner, CholeskyDecompositionBlock, CholeskyDecompositionLDL

Field Summary
protected  boolean lower
           
protected  int maxWidth
           
protected  int n
           
protected  double[] t
           
protected  DenseMatrix64F T
           
protected  double[] vv
           
 
Constructor Summary
CholeskyDecompositionCommon(boolean lower)
          Creates a CholeksyDecomposition capable of decompositong a matrix that is n by n, where n is the width.
 
Method Summary
 double[] _getVV()
           
 boolean decompose(DenseMatrix64F mat)
           Performs Choleksy decomposition on the provided matrix.
protected abstract  boolean decomposeLower()
          Performs an lower triangular decomposition.
protected abstract  boolean decomposeUpper()
          Performs an upper triangular decomposition.
 DenseMatrix64F getT()
          Returns the triangular matrix from the decomposition.
 DenseMatrix64F getT(DenseMatrix64F T)
           Returns the triangular matrix from the decomposition.
 boolean inputModified()
          Is the input matrix to DecompositionInterface.decompose(org.ejml.data.Matrix64F) is modified during the decomposition process.
 boolean isLower()
          If true the decomposition was for a lower triangular matrix.
 void setExpectedMaxSize(int numRows, int numCols)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxWidth

protected int maxWidth

n

protected int n

T

protected DenseMatrix64F T

t

protected double[] t

vv

protected double[] vv

lower

protected boolean lower
Constructor Detail

CholeskyDecompositionCommon

public CholeskyDecompositionCommon(boolean lower)
Creates a CholeksyDecomposition capable of decompositong a matrix that is n by n, where n is the width.

Parameters:
lower - should a lower or upper triangular matrix be used.
Method Detail

setExpectedMaxSize

public void setExpectedMaxSize(int numRows,
                               int numCols)

isLower

public boolean isLower()
If true the decomposition was for a lower triangular matrix. If false it was for an upper triangular matrix.

Specified by:
isLower in interface CholeskyDecomposition<DenseMatrix64F>
Returns:
True if lower, false if upper.

decompose

public boolean decompose(DenseMatrix64F mat)

Performs Choleksy decomposition on the provided matrix.

If the matrix is not positive definite then this function will return false since it can't complete its computations. Not all errors will be found. This is an efficient way to check for positive definiteness.

Specified by:
decompose in interface DecompositionInterface<DenseMatrix64F>
Parameters:
mat - A symmetric positive definite matrix with n <= widthMax.
Returns:
True if it was able to finish the decomposition.

inputModified

public boolean inputModified()
Description copied from interface: DecompositionInterface
Is the input matrix to DecompositionInterface.decompose(org.ejml.data.Matrix64F) is modified during the decomposition process.

Specified by:
inputModified in interface DecompositionInterface<DenseMatrix64F>
Returns:
true if the input matrix to decompose() is modified.

decomposeLower

protected abstract boolean decomposeLower()
Performs an lower triangular decomposition.

Returns:
true if the matrix was decomposed.

decomposeUpper

protected abstract boolean decomposeUpper()
Performs an upper triangular decomposition.

Returns:
true if the matrix was decomposed.

getT

public DenseMatrix64F getT(DenseMatrix64F T)
Description copied from interface: CholeskyDecomposition

Returns the triangular matrix from the decomposition.

If an input is provided that matrix is used to write the results to. Otherwise a new matrix is created and the results written to it.

Specified by:
getT in interface CholeskyDecomposition<DenseMatrix64F>
Parameters:
T - If not null then the decomposed matrix is written here.
Returns:
A lower or upper triangular matrix.

getT

public DenseMatrix64F getT()
Returns the triangular matrix from the decomposition.

Returns:
A lower or upper triangular matrix.

_getVV

public double[] _getVV()


Copyright © 2012. All Rights Reserved.