drasys.or.linear.algebra
Class QRIteration

java.lang.Object
  |
  +--drasys.or.linear.algebra.QRIteration

public class QRIteration
extends java.lang.Object
implements SVDecompositionI, java.io.Serializable

A singular value decomposition implementation using QR iteration.

References:

Linear Algebra and Its Applications
    Gilbert Strang / Hardcover / Published 1988
Matrix Computations (Johns Hopkins Studies in the Mathematical Sciences)
    Gene H. Golub, Charles F. Van Loan (Contributor) / Paperback / Published 1996
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Parallel Algorithms for Matrix Computations
    K.A. Gallivan / Paperback / Published 1990

See Also:
Serialized Form

Constructor Summary
QRIteration()
           
QRIteration(MatrixI matrix)
           
 
Method Summary
 double computeConditionNumber()
          Computes the condition number of the matrix.
 DenseMatrix computeInverse()
          Computes the inverse of the decomposed matrix from the components.
 MatrixI computeInverse(MatrixI results)
          Computes the inverse of the decomposed matrix from the components.
 void decompose(int rows, int columns, double[][] u, double[] w, double[][] v, double epsilon)
          Decompose matrix A into U, W and V matrices.
 void decompose(MatrixI matrix)
          Decompose matrix A into U, W and V matrices.
 DenseMatrix getU()
          Get the U matrix.
 MatrixI getU(MatrixI results)
          Get the U matrix.
 DenseMatrix getV()
          Get the V matrix.
 MatrixI getV(MatrixI results)
          Get the V matrix.
 SparseMatrix getW()
          Get the W matrix.
 MatrixI getW(MatrixI results)
          Get the W matrix.
 boolean isIllConditioned()
          Returns true if the decomposed matrix is ill-conditioned.
 boolean isSingular()
          Returns true if the decomposed matrix is singular.
 DenseVector solveEquations(VectorI rightHandSides)
          Use backsubstitution to solve the simultaneous equations.
 VectorI solveEquations(VectorI rightHandSides, VectorI results)
          Use backsubstitution to solve the simultaneous equations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QRIteration

public QRIteration()

QRIteration

public QRIteration(MatrixI matrix)
            throws AlgebraException
Method Detail

getU

public DenseMatrix getU()
Get the U matrix.
Specified by:
getU in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

getV

public DenseMatrix getV()
Get the V matrix.
Specified by:
getV in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

getW

public SparseMatrix getW()
Get the W matrix.
Specified by:
getW in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

getU

public MatrixI getU(MatrixI results)
Get the U matrix.
Specified by:
getU in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

getV

public MatrixI getV(MatrixI results)
Get the V matrix.
Specified by:
getV in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

getW

public MatrixI getW(MatrixI results)
Get the W matrix.
Specified by:
getW in interface SVDecompositionI
Returns:
null if no matrix has been decomposed.

decompose

public void decompose(MatrixI matrix)
               throws AlgebraException
Decompose matrix A into U, W and V matrices. Where: A[r][c] = U[r][c] * W[c][c] * transpose(V[c][c]) and W is a diagonal matrix of the singular values.
Specified by:
decompose in interface SVDecompositionI

decompose

public void decompose(int rows,
                      int columns,
                      double[][] u,
                      double[] w,
                      double[][] v,
                      double epsilon)
               throws AlgebraException
Decompose matrix A into U, W and V matrices. Where: A[r][c] = U[r][c] * W[c][c] * transpose(V[c][c]) and W is a diagonal matrix of the singular values. The arguments 'u', 'w', and 'v' will be used to store the results.

solveEquations

public DenseVector solveEquations(VectorI rightHandSides)
                           throws AlgebraException
Use backsubstitution to solve the simultaneous equations.
Specified by:
solveEquations in interface SVDecompositionI
Returns:
the solution vector.
Throws:
AlgebraError - if no matrix has been decomposed

solveEquations

public VectorI solveEquations(VectorI rightHandSides,
                              VectorI results)
                       throws AlgebraException
Use backsubstitution to solve the simultaneous equations.
Specified by:
solveEquations in interface SVDecompositionI
Returns:
the solution vector.
Throws:
AlgebraError - if no matrix has been decomposed

computeConditionNumber

public double computeConditionNumber()
Computes the condition number of the matrix. The condition number is a measure of the singularity of the matrix.
Specified by:
computeConditionNumber in interface SVDecompositionI
Returns:
NaN is the matrix is singular.
Throws:
AlgebraError - if no matrix has been decomposed

isIllConditioned

public boolean isIllConditioned()
Returns true if the decomposed matrix is ill-conditioned.
Specified by:
isIllConditioned in interface SVDecompositionI
Throws:
AlgebraError - if no matrix has been decomposed

isSingular

public boolean isSingular()
Returns true if the decomposed matrix is singular.
Specified by:
isSingular in interface SVDecompositionI
Throws:
AlgebraError - if no matrix has been decomposed

computeInverse

public DenseMatrix computeInverse()
                           throws AlgebraException
Computes the inverse of the decomposed matrix from the components. Where: inverse(A) = V * diagonal(1/w[i][i]) * transpose(U).
Specified by:
computeInverse in interface SVDecompositionI
Returns:
the inverse matrix.
Throws:
AlgebraError - if no matrix has been decomposed

computeInverse

public MatrixI computeInverse(MatrixI results)
                       throws AlgebraException
Computes the inverse of the decomposed matrix from the components. Where: inverse(A) = V * diagonal(1/w[i][i]) * transpose(U).
Specified by:
computeInverse in interface SVDecompositionI
Returns:
the inverse matrix.
Throws:
AlgebraError - if no matrix has been decomposed


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com