|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.LUDecomposition
Constructs the LU decomposition of a square matrix.
This takes the form
P M = L U
where P is a permutation matrix, M is the original matrix,
L is unit-lower-triangular, and U is upper-triangular. Once
an LU decomposition has been constructed, it
can be used to perform various computations related to M,
such as solving equations, computing the determinant,
or estimating the condition number.
Providing a separate class for the LU decomposition allows an application to perform such decompositions repeatedly without having to reallocate temporary storage space.
Constructor Summary | |
LUDecomposition()
Creates an uninitialized LUDecomposition. |
|
LUDecomposition(int n)
Creates an uninitialized LUDecomposition with enough capacity to handle matrices of size n . |
|
LUDecomposition(MatrixObject M)
Creates an LUDecomposition for the MatrixObject specified by M. |
Method Summary | |
double |
conditionEstimate(MatrixObject M)
Estimates the condition number of the original matrix M associated with this decomposition. |
double |
determinant()
Compute the determinant of the original matrix M associated with this decomposition. |
void |
get(MatrixNd L,
MatrixNd U,
int[] rperm)
Gets the matrices associated with the LU decomposition. |
boolean |
inverse(MatrixObject R)
Computes the inverse of the original matrix M associated with this decomposition, and places the result in R. |
void |
set(MatrixObject M)
Peforms an LU decomposition on the MatrixObject M. |
boolean |
solve(MatrixObject X,
MatrixObject B)
Solves the linear equation M X = B where M is the original matrix associated with this decomposition, and X and B are matrices. |
boolean |
solve(VectorObject x,
VectorObject b)
Solves the linear equation M x = b where M is the original matrix associated with this decomposition, and x and b are vectors. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LUDecomposition()
public LUDecomposition(int n)
n
. This
capacity will later be increased on demand.
n
- initial maximum matrix sizepublic LUDecomposition(MatrixObject M) throws ImproperSizeException
M
- matrix to perform the LU decomposition on
ImproperSizeException
- if M is not squareMethod Detail |
public void set(MatrixObject M) throws ImproperSizeException
M
- matrix to perform the LU decomposition on
ImproperSizeException
- if M is not squarepublic void get(MatrixNd L, MatrixNd U, int[] rperm) throws ImproperStateException, ImproperSizeException
L
- unit lower triangular matrixU
- upper triangular matrixrperm
- indices of the row permuation matrix P,
such that the i-th row of P M is given by row
perm[i]
of M.
ImproperStateException
- if this LUDecomposition
is uninitialized
ImproperSizeException
- if L or U are
not of the proper dimension and cannot be resized,
or if the length of perm is less than the size of M.public boolean solve(VectorObject x, VectorObject b) throws ImproperStateException, ImproperSizeException
x
- unknown vector to solve forb
- constant vector
ImproperStateException
- if this decomposition is
uninitialized
ImproperSizeException
- 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(MatrixObject X, MatrixObject B) throws ImproperStateException, ImproperSizeException
X
- unknown matrix to solve forB
- constant matrix
ImproperStateException
- if this decomposition is
uninitialized
ImproperSizeException
- 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(MatrixObject M) throws ImproperStateException, ImproperSizeException
M
- original matrix
ImproperStateException
- if this LUDecomposition is
uninitialized
ImproperSizeException
- if the size of M does not
match the size of the current LU decompositionpublic double determinant() throws ImproperStateException
ImproperStateException
- if this decomposition is
uninitializedpublic boolean inverse(MatrixObject R) throws ImproperStateException
R
- matrix in which the inverse is stored
ImproperStateException
- if this decomposition is
uninitialized
ImproperSizeException
- if R does not have
the same size as M and cannot be resized.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |