Class VisualNumerics.math.DoubleCholesky
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class VisualNumerics.math.DoubleCholesky

java.lang.Object
   |
   +----VisualNumerics.math.DoubleCholesky

public class DoubleCholesky
extends Object
Cholesky decomposition of a real positive definite matrix.

Constructor Index

 o DoubleCholesky(double[][])
Construct the Cholesky decomposition of a positive definite matrix with elements of type double.

Method Index

 o condition()
Return an estimate of the reciprocal of the L1 condition number of the matrix used to construct this instance.
 o determinant()
Return the determinant of the matrix used to construct this object.
 o inverse()
Construct the inverse of this object using information from its Cholesky factorization.
 o R()
Return the Cholesky factor of this object.
 o solve(double[])
Solve Ax = b where A is a positive definite matrix with elements of type double.

Constructors

 o DoubleCholesky
  public DoubleCholesky(double a[][]) throws IllegalArgumentException, MathException
Construct the Cholesky decomposition of a positive definite matrix with elements of type double.
Parameters:
a - Input positive definite matrix of type double 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 symmetric or is not positive definite.
Algorithm:
The constructor computes an RTR Cholesky factorization of a positive definite matrix with elements of type double. The constructor is based on the LINPACK routine DPOFA.
Example:
import VisualNumerics.math.DoubleCholesky;
import VisualNumerics.math.MathException;
import java.io.*;
class testDCholesky {
    public static void main(String args[]) {
        double   cond, determ;
        double   ainv[][], fac[][], x[];
        double   a[][] = {{ 1.0, -3.0, 2.0},
                          {-3.0, 10.0,-5.0},
                          { 2.0, -5.0, 6.0}};
        double   b[] = {27.0, -78.0, 64.0};
        try {
            DoubleCholesky cholesky = new DoubleCholesky(a);
            fac = cholesky.R();
            ainv = cholesky.inverse();
            cond = cholesky.condition();
            determ = cholesky.determinant();
            x = cholesky.solve(b);
             ... print results ...
	       } catch (IOException ioe) {
			 System.out.println(ioe.toString());
        } catch (IllegalArgumentException e) {
			 System.out.println(e.toString());
		   } catch (MathException e) {
			 System.out.println(e.toString());
		   }
    }
}
	

Methods

 o R
  public double[][] R()
Return the Cholesky factor of this object.
Returns:
A symmetric square matrix containing the Cholesky factor of this object in its upper and lower triangles.
 o inverse
  public double[][] inverse() throws MathException
Construct the inverse of this object using information from its Cholesky factorization.
Returns:
The inverse of the matrix used to construct this object.
Throws: MathException
This exception is thrown when the matrix to be inverted is singular.
 o condition
  public double condition() throws MathException
Return an estimate of the reciprocal of the L1 condition number of the matrix used to construct this instance.
Returns:
A scalar of type double containing an estimate of the reciprocal of the L1 condition number of the matrix used to construct this instance.
Throws: MathException
This exception is issued when the input matrix a is algorithmically singular.
Algorithm:
The Cholesky constructor computes an RTR Cholesky factorization of a 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 DPOCO. 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.
 o solve
  public double[] solve(double b[]) throws MathException
Solve Ax = b where A is a positive definite matrix with elements of type double.
Parameters:
b - Input vector of type double containing the right-hand side of the linear system.
Returns:
Double 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 RTR Cholesky factorization of a positive definite matrix. This factorization is then used to compute the solution to the system of linear equations. This method is based on the LINPACK routine DPOSL.
 o determinant
  public double determinant()
Return the determinant of the matrix used to construct this object.
Returns:
A double value equal to the determinant of the matrix used to construct this object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index