Class VisualNumerics.math.ComplexCholesky
All Packages Class Hierarchy This Package Previous Next Index
Class VisualNumerics.math.ComplexCholesky
java.lang.Object
|
+----VisualNumerics.math.ComplexCholesky
- public class ComplexCholesky
- extends Object
Cholesky Decomposition of a Complex Hermitian positive definite matrix.
-
ComplexCholesky(Complex[][])
-
Construct the Cholesky decomposition of a Complex Hermitian positive
definite matrix.
-
condition()
-
Return an estimate of the reciprocal of the L1 condition number of the
Complex matrix used to construct this instance.
-
determinant()
-
Return the determinant of the matrix used to construct this instance.
-
inverse()
-
Return the inverse of the matrix used to construct this instance.
-
R()
- Return the Cholesky factorization of the Complex Hermitian positive
definite matrix used to construct this instance.
-
solve(Complex[])
- Solve a complex Hermitian positive definite system
of linear equations.
ComplexCholesky
public ComplexCholesky(Complex a[][]) throws IllegalArgumentException, MathException
- Construct the Cholesky decomposition of a Complex Hermitian positive
definite matrix.
- Parameters:
- a - Complex Hermitian positive definite matrix to be factored.
- Throws: IllegalArgumentException
- This exception is issued when the row lengths of
input matrix a are not equal (i.e. the matrix edges are "jagged".)
- Throws: MathException
- This exception is issued when the input matrix a is not square
or is not positive definite or some diagonal element is not real.
-
Algorithm:
-
The constructor computes an RHR Cholesky factorization of a complex matrix. The constructor is
based on the LINPACK routine ZPOFA.
Dongarra, J.J., J.R. Bunch, C.B. Moler, and G.W. Stewart(1979), LINPACK Users' Guide,
SIAM, Philadelphia.
-
Example:
-
import VisualNumerics.math.*;
import java.io.*;
class testCCholesky {
public static void main(String args[]) {
int i, j, n=3;
double cond=0.0e0, dtrm=0.0e0;
Complex r[][]=null, ainv[][], x[];
Complex a[][] = new Complex[n][n];
Complex b[] = new Complex[n];
for(i=0; i <
n; i++){
for(int j=0; j <
n; j++){
a[i][j] = new Complex((double)(j+3*i), (double)(j-i));
a[j][i] = new Complex(a[i][j].re, 0.0e0);
}
b[i] = new Complex((double)(7+i));
}
a = ComplexMatrix.multiply(a, ComplexMatrix.adjoint(a));
try {
ComplexCholesky cholesky = new ComplexCholesky(a);
r = cholesky.R();
x = cholesky.solve(b[i]);
ainv = cholesky.inverse();
cond = cholesky.condition();
dtrm = cholesky.determinant();
... print output ...
} catch (IllegalArgumentException e) {
System.err.println("From testcomplexcholesky "+e);
} catch (MathException e) {
System.err.println("From testcomplexcholesky "+e);
}
}
}
solve
public static Complex[] solve(Complex b[]) throws MathException
- Solve a complex Hermitian positive definite system
of linear equations.
- Parameters:
- b - Complex vector containing the right-hand side of the linear system.
- Returns:
- A Complex vector containing the solution to the system of
linear equations.
- Throws: MathException
- This exception is issued when the input matrix a is singular.
-
Algorithm:
-
The Cholesky constructor computes an RHR Cholesky factorization of a complex matrix. This factorization
is then used to compute the solution for the system of linear equations.
This method is based on the LINPACK routine ZPOSL.
inverse
public static Complex[][] inverse() throws MathException
- Return the inverse of the matrix used to construct this instance.
- Returns:
- A Complex[][] matrix containing the inverse of the
matrix used to construct this instance.
- Throws: MathException
- This exception is issued when the input matrix a is singular.
condition
public static double condition()
- Return an estimate of the reciprocal of the L1 condition number of the
Complex matrix used to construct this instance.
- Returns:
- A scalar of type double containing an estimate of the reciprocal of the L
1 condition number of the
Complex matrix used to construct this instance.
-
Algorithm:
-
The Cholesky constructor computes an R
HR Cholesky factorization of a complex matrix. This factorization
is then used by this method in determining the condition number. The L1
condition number of a matrix A is defined to be the 1-norm of A times
the 1-norm of A inverse. Since it is expensive to compute the 1-norm of
A inverse, the condition number is only estimated. The estimation
algorithm is the same as used by LINPACK routine ZPOCO. A condition
number less than approximately 2.22e-16 indicates that very small
changes in A can cause very large changes in the solution x of a linear
system involving A.
R
public static Complex[][] R()
- Return the Cholesky factorization of the Complex Hermitian positive
definite matrix used to construct this instance.
- Returns:
- A Complex matrix containing the upper triangular matrix R of the
factorization of the matrix used to construct this instance in the upper triangle.
-
Algorithm:
-
The Cholesky constructor computes an RHR Cholesky factorization of a complex matrix. This method returns the saved
factorization.
determinant
public static double determinant()
- Return the determinant of the matrix used to construct this instance.
- Returns:
- A double scalar containing the determinant of the
matrix used to construct this instance.
-
Algorithm:
-
The ComplexCholesky constructor computes an RHR factorization of the
complex matrix. The product of the diagonal elements of R
is then obtained. The product squared is the determinant of the input
matrix. This method is based on LINPACK routine ZPODI.
All Packages Class Hierarchy This Package Previous Next Index