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

Class VisualNumerics.math.ComplexLU

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

public class ComplexLU
extends Object
LU factorization of a Complex matrix.

Constructor Index

 o ComplexLU(Complex[][])
Create the LU factorization of a square Complex matrix.

Method Index

 o condition()
Return an estimate of the reciprocal of the L1 condition number of the Complex matrix used to construct this instance.
 o determinant()
Return the determinant of the matrix used to construct this instance.
 o inverse()
Return the inverse of the matrix used to construct this instance.
 o ipvt()
Return a vector containing information for the LU factorization of the matrix.
 o solve(Complex[])
Return the solution x of the linear system Ax=b using the LU factorization of A.

Constructors

 o ComplexLU
  public ComplexLU(Complex a[][]) throws IllegalArgumentException, MathException
Create the LU factorization of a square Complex matrix.
Parameters:
a - Complex square 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 singular.
Algorithm:
The LU factorization is done using scaled partial pivoting. Scaled partial pivoting differs from partial pivoting in that the pivoting strategy is the same as if each row were scaled to have the same infinity norm. The constructor is based on the LINPACK routine ZGECO.
Example:
 import VisualNumerics.math.*;
 import java.io.*;
 class testCLU {
    public static void main(String args[]) {
       int      i, j, n=3;
       double   cond=0.0e0;
       Complex fac[][]=null, ainv[][], x[], dtrm;
       Complex a[][] = new Complex[n][n];
       Complex b[] = new Complex[n];
       for(i=0;i < n;i++){
          for(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));
       }
       try {
         ComplexLU lu = new ComplexLU(a);
         x = lu.solve(b);
         ainv = lu.inverse();
         cond = lu.condition();
         dtrm = lu.determinant();
           ... print output ...
       } catch (IllegalArgumentException e) {
         System.err.println("From testcomplexLU "+e);
       } catch (MathException e) {
         System.err.println("From testcomplexLU "+e);
       }
    }
 }
	

Methods

 o solve
  public Complex[] solve(Complex b[])
Return the solution x of the linear system Ax=b using the LU factorization of A.
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.
Algorithm:
The ComplexLU constructor computes an LU factorization of a complex matrix. The solution to Ax = b is found by solving the triangular systems Ly = b and Ux = y. The forward elimination step consists of solving the system Ly = b by applying the same permutations and elimination operations to b that were applied to the columns of A in the factorization. The backward substitution step consists of solving the triangular system Ux = y for x. This method is based on the LINPACK routine ZGESL.
 o inverse
  public Complex[][] inverse()
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.
Algorithm:
The ComplexLU constructor computes an LU factorization of the complex matrix. This factorization is then used by solve with successive columns of the identity matrix to compute successive columns of the inverse matrix.
 o determinant
  public Complex 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 ComplexLU constructor computes an LU factorization of the complex matrix. The product of the diagonal elements of the LU factorization is then obtained. The sign of this product is then adjusted based on the number of pivoting interchanges that have occurred. This method is based on LINPACK routine ZGEDI.
 o condition
  public double condition()
Return an estimate of the reciprocal of the L1 condition number of the Complex matrix used to construct this instance.
Returns:
An estimate of the reciprocal of the L1 condition number of the Complex matrix used to construct this instance.
Algorithm:
The ComplexLU constructor computes an LU factorization of the 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 ZGECO. 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 ipvt
  public int[] ipvt()
Return a vector containing information for the LU factorization of the matrix.
Returns:
An int vector containing the pivoting information for the LU factorization.

All Packages  Class Hierarchy  This Package  Previous  Next  Index