All Packages Class Hierarchy This Package Previous Next Index
Class linear_algebra.Cholesky
java.lang.Object
|
+----linear_algebra.Cholesky
- public class Cholesky
- extends Object
This class contains:
- a method that obtains the Cholesky
factorization RR´, where R is a lower triangular matrix,
of a symmetric positive definite matrix A.
- a method to invert a symmetric positive
definite matrix.
- a method to solve Ax = b where A is a symmetric
positive definite matrix.
This class was written by a statistician rather than
a numerical analyst. I have tried to check the code carefully,
but it may still contain bugs. Further, its stability and
efficiency do not meet the standards of high quality
numerical analysis software. When public domain Java numerical
analysis routines become available from numerical analysts
(e.g., the people who produce LAPACK), then THE CODE PRODUCED
BY THE NUMERICAL ANALYSTS SHOULD BE USED.
Meanwhile, if you have suggestions for improving this
code, please contact Steve Verrill at steve@ws10.fpl.fs.fed.us.
-
Cholesky()
-
-
factorPosDef(double[][], int)
-
This method factors the n by n symmetric positive definite
matrix A as RR´ where R is a lower triangular matrix.
-
invertPosDef(double[][], int, boolean)
-
This method obtains the inverse of an n by n
symmetric positive definite matrix A.
- On entrance:
- If factored == false, the lower triangle of a[ ][ ] should
contain the lower triangle of A.
If factored == true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
-
solvePosDef(double[][], double[], double[], int, boolean)
-
This method solves the equation
Ax = b
where A is a known n by n symmetric positive definite matrix,
and b is a known vector of length n.
- On entrance:
- If factored == false, the lower triangle of a[ ][ ] should
contain the lower triangle of A.
If factored == true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
Cholesky
public Cholesky()
factorPosDef
public void factorPosDef(double a[][],
int n) throws NotPosDefException
-
This method factors the n by n symmetric positive definite
matrix A as RR´ where R is a lower triangular matrix.
The method assumes that at least the lower triangle
of A is filled on entry. On exit, the lower triangle
of A has been replaced by R.
- Parameters:
- a[ ][ ] - The positive definite matrix to factor. The method assumes
that at least the lower triangle of a[ ][ ] is filled on entry. On exit
the lower triangle of a[ ][ ] has been replaced by R such that RR´ = A.
- n - The order of the matrix a[ ][ ].
solvePosDef
public void solvePosDef(double a[][],
double b[],
double y[],
int n,
boolean factored) throws NotPosDefException
-
This method solves the equation
Ax = b
where A is a known n by n symmetric positive definite matrix,
and b is a known vector of length n.
- On entrance:
- If factored == false, the lower triangle of a[ ][ ] should
contain the lower triangle of A.
If factored == true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
- On exit:
- The elements of b have been replaced by the elements of x.
The method proceeds by first factoring A as RR´ where R is a lower
triangular matrix. Thus Ax = b is equivalent to R(R´x) = b. Then the
method performs two additional operations. First it solves Ry = b for y.
Then it solves R´x = y for x. It stores x in b.
- Parameters:
- a[ ][ ] - On entrance, if the boolean variable factored is false,
the lower triangle of a[ ][ ] should contain the lower triangle of A.
If factored is true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
- b - On entrance b must contain the known b of Ax = b. On exit
it contains the solution x to Ax = b.
- y - A work vector of order at least n.
- n - The order of A and b.
- factored - On entrance, factored should be set to true if A
already has been factored, false
if A has not yet been factored.
invertPosDef
public void invertPosDef(double a[][],
int n,
boolean factored) throws NotPosDefException
-
This method obtains the inverse of an n by n
symmetric positive definite matrix A.
- On entrance:
- If factored == false, the lower triangle of a[ ][ ] should
contain the lower triangle of A.
If factored == true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
- On exit:
- The lower triangle of a[ ][ ] has been replaced by the
lower triangle of the inverse of A.
- Parameters:
- a[ ][ ] - On entrance, if the boolean variable factored is false,
the lower triangle of a[ ][ ] should contain the lower triangle of A.
If factored is true, the lower triangle of a[ ][ ] should
contain a lower triangular matrix R such that RR´ = A.
- n - The order of A.
- factored - On entrance, factored should be set to true if A
already has been factored, false
if A has not yet been factored.
All Packages Class Hierarchy This Package Previous Next Index