|
JMSLTM Numerical Library 4.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.math.QR
QR Decomposition of a matrix.
Class QR
computes the QR decomposition
of a matrix using Householder transformations. It is based on the LINPACK
routine SQRDC
; see Dongarra et al. (1979).
QR
determines an orthogonal matrix Q,
a permutation matrix P, and an upper trapezoidal matrix
R with diagonal elements of nonincreasing magnitude,
such that AP = QR. The Householder transformation for
column k is of the form
for , min(number of rows of A, number
of columns of A), where u has zeros in the first
k - 1 positions. The matrix Q is
not produced directly by QR
. Instead the information needed to
reconstruct the Householder transformations is saved. If the matrix
Q is needed explicitly, the method getQ
can be called after QR
. This method accumulates
Q from its factored form.
Before the decomposition is computed, initial columns are moved to the beginning of the array A and the final columns to the end. Both initial and final columns are frozen in place during the computation. Only free columns are pivoted. Pivoting is done on the free columns of largest reduced norm.
Constructor Summary | |
QR(double[][] a)
Constructs the QR decomposition of a matrix with elements of type double . |
Method Summary | |
int[] |
getPermute()
Returns an integer vector containing information about the permutation of the elements of the matrix during pivoting. |
double[][] |
getQ()
Returns the orthogonal or unitary matrix Q. |
double[][] |
getR()
Returns the upper trapezoidal matrix R. |
int |
getRank()
Returns the rank of the matrix used to construct this instance. |
int |
rank(double tolerance)
Returns the rank of the matrix given an input tolerance. |
double[] |
solve(double[] b)
Returns the solution to the least-squares problem Ax = b. |
double[] |
solve(double[] b,
double tol)
Returns the solution to the least-squares problem Ax = b using an input tolerance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QR(double[][] a)
double
.
a
- a double
matrix to be factored
IllegalArgumentException
- Thrown when the row lengths of input matrix a are not equal
(i.e. the matrix edges are "jagged".)Method Detail |
public int[] getPermute()
int
array containing the permutation information.
The k-th element contains the index of the column
of the matrix that has been interchanged into
the k-th column.public double[][] getQ()
double
matrix containing the accumulated orthogonal
matrix Q from the QR decompositionpublic double[][] getR()
double
matrix R of the QR decompositionpublic int getRank()
int
specifying the rank of the matrix
used to construct this instancepublic int rank(double tolerance)
tolerance
- a double
scalar value used in determining
the rank of the matrix
int
specifying the rank of the matrixpublic double[] solve(double[] b) throws SingularMatrixException
b
- a double
array to be manipulated
double
array containing the solution vector to Ax = b
with components corresponding to the unused columns set to zero
SingularMatrixException
- Thrown when the upper triangular matrix R
resulting from the QR factorization is singular.public double[] solve(double[] b, double tol) throws SingularMatrixException
b
- a double
array to be manipulatedtol
- a double
scalar value used in determining the rank of A
double
array containing the solution vector
to Ax = b with components corresponding to the unused columns set to zero
SingularMatrixException
- Thrown when the upper triangular matrix R
resulting from the QR factorization is singular.
|
JMSLTM Numerical Library 4.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |