|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.factorization.qr.HouseholderReflection
public class HouseholderReflection
Successive Householder reflections gradually transform a matrix A to the upper triangular form.
For example, the first step is to multiply A with the Householder matrix Q1 so that
matrix Q1 %*% A has zeros in the left column (except for the first row).
That is,
| a1 * ... * |
| 0 |
Q1 %*% A = | . |
| . A' |
| . |
| 0 |
At the end,
Qn %*% ... %*% Q1 %*% A = R
where R is upper triangular.
Householder reflection has a better numerical stability than the Gram-Schmidt process.
| Field Summary | |
|---|---|
double |
epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0 |
int |
ncols
number of columns |
int |
nrows
number of rows |
| Constructor Summary | |
|---|---|
HouseholderReflection(Matrix A)
Construct an instance of the Householder reflection process to orthogonalize a matrix. |
|
HouseholderReflection(Matrix A,
double epsilon)
Construct an instance of the Householder reflection process to orthogonalize a matrix. |
|
| Method Summary | |
|---|---|
PermutationMatrix |
P()
Get a copy of the P pivoting matrix in the QR decomposition. |
Matrix |
Q()
Get a copy of the Q matrix in the QR decomposition. |
UpperTriangularMatrix |
R()
Get a copy of the upper triangular matrix R in the QR decomposition. |
int |
rank()
Rank is computed by counting the number of non-zero rows in R. |
Matrix |
squareQ()
Get a copy of the square Q matrix. |
Matrix |
tallR()
Get a copy of the tall R matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int nrows
public final int ncols
public final double epsilon
| Constructor Detail |
|---|
public HouseholderReflection(Matrix A,
double epsilon)
A - a matrix, where #rows >= #columnsepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
java.lang.IllegalArgumentException - if #rows < #columnspublic HouseholderReflection(Matrix A)
A - a matrix, where #rows >= #columns| Method Detail |
|---|
public Matrix Q()
Q matrix in the QR decomposition.
Qn %*% ... %*% Q3 %*% Q2 %*% Q1 %*% A = R
A = [Qn %*% ... %*% Q3 %*% Q2 %*% Q1]^-1 %*% R
A = [Q1^-1 %*% Q2^-1 %*% ... %*% Qn^-1] %*% R
A = [Q1 %*% Q2 %*% ... %*% Qn] %*% R, by the unitary property of Householder matrix
So, Q = Q1 %*% Q2 %*% ... %*% Qn.
To compute Q,
instead of explicitly doing this multiplication, we can improve the performance
by applying Qi's repeatedly on an identity matrix.
Dimension of Q is nRows x nCols.
Q in interface QRDecompositionQ matrix in the QR decompositionpublic UpperTriangularMatrix R()
QRDecompositionR in the QR decomposition.
A = QR
Dimension of R is ncols x ncols, a square matrix.
R in interface QRDecompositionR in the QR decompositionpublic PermutationMatrix P()
P pivoting matrix in the QR decomposition.
Householder process needs no pivoting.
Hence, P is always an identity matrix.
P in interface QRDecompositionpublic int rank()
R.
Q may have more columns than the rank.
The user is encouraged to interpret the result with caution.
rank in interface QRDecompositionpublic Matrix squareQ()
QRDecompositionQ matrix.
This is an arbitrary orthogonal completion of the Q matrix in the QR decomposition.
Dimension is nrows x nrows (square).
A = square_Q %*% tall_R
squareQ in interface QRDecompositionQ matrixpublic Matrix tallR()
QRDecompositionR matrix.
This is completed by binding zero rows beneath the square upper triangular matrix R in the QR decomposition.
Dimension is nrows x ncols. Note that this may no longer be square.
A = square_Q %*% tall_R
tallR in interface QRDecompositionR matrix
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||