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

Class VisualNumerics.math.ComplexQR

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

public class ComplexQR
extends Object
QR Decomposition of a Complex matrix.

Constructor Index

 o ComplexQR(Complex[][])
Construct the QR decomposition of a Complex matrix.

Method Index

 o ipvt()
Return an integer vector containing information about the permutation of the elements of A during pivoting.
 o Q()
Return the orthogonal or unitary matrix Q.
 o R()
Return the upper trapezoidal matrix R.
 o rank()
Return the rank of the matrix.
 o rank(double)
Return the rank of the matrix using an input tolerance.
 o solve(Complex[])
Calculate the solution to the least-squares problem Ax = b using information about the QR factorization of A.
 o solve(Complex[], double)
Calculate the solution to the least-squares problem Ax = b using information about the QR factorization of A and input tolerance.

Constructors

 o ComplexQR
  public ComplexQR(Complex x[][]) throws IllegalArgumentException
Construct the QR decomposition of a Complex matrix.
Parameters:
a - Complex 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".)
Algorithm:
The constructor computes the QR decomposition of a complex matrix using Householder transformations. The constructor is based on the LINPACK routine ZQRDC. The constructor determines an orthogonal matrix Q, a permutation matrix P, and an upper trapezoidal matrix R with nonincreasing diagonal elements such that AP = QR. Pivoting is used.
Example:
 import VisualNumerics.math.*;
 import java.io.*;
 class testCQR {
    public static void main(String args[]) {
       int      i,j, n=3, rnk=0;
       Complex q[][], r[][], x[];
       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 {
         ComplexQR qr = new ComplexQR(a);
         q = qr.Q();
         r = qr.R();
         x = qr.solve(b);
         rnk = qr.rank();
           ... print output ...
       } catch (IllegalArgumentException e) {
         System.err.println("From testcomplexQR "+e);
       } catch (MathException e) {
         System.err.println("From testcomplexQR "+e);
       }
    }
 }
	

Methods

 o Q
  public Complex[][] Q()
Return the orthogonal or unitary matrix Q.
Returns:
A Complex matrix containing the accumulated orthogonal matrix Q of the QR decomposition of the matrix used to construct this instance.
Algorithm:
The ComplexQR constructor computes the QR decomposition of the matrix saving the information needed to reconstruct the Householder transformations. These transformations are accumulated to produce the orthogonal matrix Q.
 o R
  public Complex[][] R()
Return the upper trapezoidal matrix R.
Returns:
A Complex matrix containing the upper trapezoidal matrix R of the QR decomposition of the matrix used to construct this instance.
Algorithm:
The ComplexQR constructor computes the QR decomposition of the matrix saving the upper trapezoidal R. This method retrieves R.
 o rank
  public int rank()
Return the rank of the matrix.
Returns:
An int scalar containing the rank of the matrix used to construct this instance.
Algorithm:
The ComplexQR constructor computes the QR decomposition of the matrix. The diagonal elements of R are of nonincreasing magnitude. This method traverses the diagonal starting with the element of largest magnitude counting those elements which have magnitude greater than tol where tol is approximately 2.22e-16. The resulting count is returned as the rank of the matrix used to construct this instance.
 o rank
  public int rank(double tol)
Return the rank of the matrix using an input tolerance.
Parameters:
tol - Scalar of type double used in determining the rank of the matrix used to construct this instance.
Returns:
An int scalar containing the rank of the matrix used to construct this instance.
Algorithm:
The ComplexQR constructor computes the QR decomposition of the matrix. The diagonal elements of R are of nonincreasing magnitude. This method traverses the diagonal starting with the element of largest magnitude counting those elements which have magnitude greater than tol. The resulting count is returned as the rank of the matrix used to construct this instance.
 o ipvt
  public int[] ipvt()
Return an integer vector containing information about the permutation of the elements of A during pivoting.
Returns:
An int vector of which the k-th element contains the index of the column of A that has been interchanged into the k-th column. This defines the permutation matrix P.
 o solve
  public Complex[] solve(Complex b[]) throws MathException
Calculate the solution to the least-squares problem Ax = b using information about the QR factorization of A.
Parameters:
b - Complex vector to be manipulated.
Returns:
A Complex vector containing the permuted solution to Ax = b.
Throws: MathException
This exception is issued when the upper triangular matrix R resulting from the QR factorization is singular.
Algorithm:
The constructor computes the QR decomposition of complex matrix A using Householder transformations. The rank of A is determined based on the number of diagonal elements with magnitude greater than tol where tol is approximately 2.22e-16. The method is based on the LINPACK routine ZQRSL. The constructor determines an orthogonal matrix Q, a permutation matrix P, and an upper trapezoidal matrix R with nonincreasing diagonal elements such that AP = QR. Using the normal equations method and the QR decomposition the least squares problem is reformulated as R(PTx) = QTb. This method then solves for PTx.
 o solve
  public Complex[] solve(Complex b[],
                         double tol) throws MathException
Calculate the solution to the least-squares problem Ax = b using information about the QR factorization of A and input tolerance.
Parameters:
b - Complex vector to be manipulated.
tol - Scalar of type double used in determining the rank of A.
Returns:
A Complex vector containing the permuted solution to Ax = b.
Throws: MathException
This exception is issued when the upper triangular matrix R resulting from the QR factorization is singular.
Algorithm:
The constructor computes the QR decomposition of complex matrix A using Householder transformations. The rank of A is determined based on the number of diagonal elements with magnitude greater than tol. The method is based on the LINPACK routine ZQRSL. The constructor determines an orthogonal matrix Q, a permutation matrix P, and an upper trapezoidal matrix R with nonincreasing diagonal elements such that AP = QR. Using the normal equations method and the QR decomposition the least squares problem is reformulated as R(PTx) = QTb. This method then solves for PTx.

All Packages  Class Hierarchy  This Package  Previous  Next  Index