public class SignedCholeskyDecomp
extends java.lang.Object
Providing a separate class for the Cholesky decomposition allows an application to perform such decompositions repeatedly without having to reallocate temporary storage space.
Constructor and Description |
---|
SignedCholeskyDecomp()
Creates an uninitialized SignedCholeskyDecomp.
|
SignedCholeskyDecomp(int n)
Creates an uninitialized SignedCholeskyDecomp with enough capacity to
handle matrices of size
n . |
SignedCholeskyDecomp(Matrix M)
Creates a SignedCholeskyDecomp for the Matrix specified by M.
|
SignedCholeskyDecomp(Matrix M,
int r)
Creates a SignedCholeskyDecomp for the Matrix specified by M.
|
Modifier and Type | Method and Description |
---|---|
void |
addNegRowAndColumn(VectorNd col) |
boolean |
addNegRowAndColumn(VectorNd col,
double tol) |
void |
addPosRowAndColumn(VectorNd col) |
boolean |
addPosRowAndColumn(VectorNd col,
double tol) |
void |
clear() |
double |
conditionEstimate(Matrix M)
Estimates the condition number of the original matrix M associated with
this decomposition.
|
void |
deleteRowAndColumn(int idx) |
boolean |
deleteRowAndColumn(int idx,
double tol) |
void |
deleteRowsAndColumns(int[] idxs) |
double |
determinant()
Compute the determinant of the original matrix M associated with this
decomposition.
|
double |
eigenValueRatio() |
void |
ensureCapacity(int cap) |
void |
factor(Matrix M) |
void |
factor(Matrix M,
int r)
Peforms a signed Cholesky decomposition on the Matrix M.
|
void |
get(MatrixNd L,
VectorNd D)
Gets the components associated with this decomposition.
|
double[] |
getBuffer() |
int |
getBufferWidth() |
int |
getR() |
int |
getSize() |
boolean |
inverse(DenseMatrix R)
Computes the inverse of the original matrix M associated with this
decomposition, and places the result in R.
|
boolean |
solve(DenseMatrix X,
Matrix B)
Solves the linear equation
M X = B for X, where M is the original matrix associated with this decomposition, and X and B are matrices. |
boolean |
solve(double[] x,
int xoff,
double[] b,
int boff)
Solves the linear equation
M x = b for x, where M is the original matrix associated with this decomposition, and x and b are vectors. |
boolean |
solve(Vector x,
Vector b)
Solves the linear equation
M x = b for x, where M is the original matrix associated with this decomposition, and x and b are vectors. |
public SignedCholeskyDecomp()
public SignedCholeskyDecomp(int n)
n
. This capacity will later be
increased on demand.n
- initial maximum matrix sizepublic SignedCholeskyDecomp(Matrix M) throws ImproperSizeException
M
- matrix to perform the Cholesky decomposition onImproperSizeException
- if M is not squarepublic SignedCholeskyDecomp(Matrix M, int r) throws ImproperSizeException
M
- matrix to perform the Cholesky decomposition onr
- size of the upper-left positive definite blockImproperSizeException
- if M is not squarepublic void ensureCapacity(int cap)
public int getSize()
public int getR()
public void factor(Matrix M) throws ImproperSizeException
ImproperSizeException
public void factor(Matrix M, int r) throws ImproperSizeException
M
- matrix to perform the Cholesky decomposition onr
- size of the upper-left positive definite blockImproperSizeException
- if M is not squarejava.lang.IllegalArgumentException
- if M is detected to be not symmetric positive definitepublic void get(MatrixNd L, VectorNd D) throws ImproperStateException
L
- if non-null, return the lower triangular matrixD
- if non-null, return the diagonal matrix, whose upper left and
lower right elements consist of 1 and -1, respectivelyImproperStateException
- if this SignedCholeskyDecomp is uninitializedImproperSizeException
- if L is not of the proper dimension and cannot be resizedpublic boolean solve(double[] x, int xoff, double[] b, int boff)
x
- unknown vector to solve forxoff
- starting offset into x
b
- constant vectorboff
- starting offset into b
ImproperStateException
- if this decomposition is uninitializedImproperSizeException
- if x
or b
do not
have a length compatible with Mpublic boolean solve(Vector x, Vector b) throws ImproperStateException, ImproperSizeException
x
- unknown vector to solve forb
- constant vectorImproperStateException
- if this decomposition is uninitializedImproperSizeException
- if b does not have a size compatible with M, or if x does not have a size
compatible with M and cannot be resized.public boolean solve(DenseMatrix X, Matrix B) throws ImproperStateException, ImproperSizeException
X
- unknown matrix to solve forB
- constant matrixImproperStateException
- if this decomposition is uninitializedImproperSizeException
- if B has a different number of rows than M, or if X has a different number
of rows than M or a different number of columns than B and cannot be
resized.public double conditionEstimate(Matrix M) throws ImproperStateException, ImproperSizeException
M
- original matrixImproperStateException
- if this SignedCholeskyDecomp is uninitializedImproperSizeException
- if the size of M does not match the size of the current Cholesky
decompositionpublic double eigenValueRatio()
public double determinant() throws ImproperStateException
ImproperStateException
- if this decomposition is uninitializedpublic boolean inverse(DenseMatrix R) throws ImproperStateException
R
- matrix in which the inverse is storedImproperStateException
- if this decomposition is uninitializedImproperSizeException
- if R does not have the same size as M and cannot be resized.public double[] getBuffer()
public int getBufferWidth()
public void clear()
public void addPosRowAndColumn(VectorNd col)
public boolean addPosRowAndColumn(VectorNd col, double tol)
public void addNegRowAndColumn(VectorNd col)
public boolean addNegRowAndColumn(VectorNd col, double tol)
public void deleteRowAndColumn(int idx)
public boolean deleteRowAndColumn(int idx, double tol)
public void deleteRowsAndColumns(int[] idxs)