Package elki.math.linearalgebra
Class CholeskyDecomposition
- java.lang.Object
-
- elki.math.linearalgebra.CholeskyDecomposition
-
public class CholeskyDecomposition extends java.lang.ObjectCholesky Decomposition.For a symmetric, positive definite matrix A, the Cholesky decomposition is an lower triangular matrix L so that \( A = L L^T \).
If the matrix is not symmetric or positive definite, the constructor returns a partial decomposition and sets an internal flag that may be queried by the isSPD() method.
- Since:
- 0.1
- Author:
- Arthur Zimek
-
-
Constructor Summary
Constructors Constructor Description CholeskyDecomposition(double[][] A)Cholesky algorithm for symmetric and positive definite matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]getL()Return triangular factor.booleanisSPD()Is the matrix symmetric and positive definite?double[]solve(double[] b)Solve A*X = bdouble[][]solve(double[][] B)Solve A*X = Bprivate double[][]solveL(double[][] X)Solve L*Y = Bdouble[]solveLInplace(double[] X)Solve L*X = b, modifying X.double[]solveLtransposed(double[] X)Solve L^T*X = Yprivate double[][]solveLtransposed(double[][] X)Solve L^T*X = Y
-
-
-
Method Detail
-
isSPD
public boolean isSPD()
Is the matrix symmetric and positive definite?- Returns:
- true if A is symmetric and positive definite.
-
getL
public double[][] getL()
Return triangular factor.- Returns:
- L
-
solve
public double[][] solve(double[][] B)
Solve A*X = B- Parameters:
B- A Matrix with as many rows as A and any number of columns.- Returns:
- X so that L*L^T*X = B
- Throws:
java.lang.IllegalArgumentException- Matrix row dimensions must agree.java.lang.RuntimeException- Matrix is not symmetric positive definite.
-
solveL
private double[][] solveL(double[][] X)
Solve L*Y = B- Parameters:
X- Copy of B.- Returns:
- X
-
solveLtransposed
private double[][] solveLtransposed(double[][] X)
Solve L^T*X = Y- Parameters:
X- Solution of L*Y=B- Returns:
- X
-
solve
public double[] solve(double[] b)
Solve A*X = b- Parameters:
b- A column vector with as many rows as A.- Returns:
- X so that L*L^T*X = b
- Throws:
java.lang.IllegalArgumentException- Matrix row dimensions must agree.java.lang.RuntimeException- Matrix is not symmetric positive definite.
-
solveLInplace
public double[] solveLInplace(double[] X)
Solve L*X = b, modifying X.- Parameters:
X- Copy of b.- Returns:
- X
-
solveLtransposed
public double[] solveLtransposed(double[] X)
Solve L^T*X = Y- Parameters:
X- Solution of L*Y=b- Returns:
- X
-
-