public class QRDecompositionHouseholder_DDRB extends java.lang.Object implements QRDecomposition<DMatrixRBlock>
QR decomposition for DMatrixRBlock
using householder reflectors. The decomposition is
performed by computing a QR decomposition for each block column as is normally done, see QRDecompositionHouseholder_DDRM
.
The reflectors are then combined and applied to the remainder of the matrix. This process is repeated
until all the block columns have been processed
The input matrix is modified and used to store the decomposition. Reflectors are stored in the lower triangle columns. The first element of the reflector is implicitly assumed to be one.
Each iteration can be sketched as follows:QR_Decomposition( A(:,ir to i) ) W=computeW( A(:,ir to i) ) A(:,i:n) = (I + W*Y^T)^T*A(:,i:n)Where r is the block size, i is the submatrix being considered, A is the input matrix, Y is a matrix containing the reflectors just computed, and W is computed using
BlockHouseHolder_DDRB.computeW_Column(int, org.ejml.data.DSubmatrixD1, org.ejml.data.DSubmatrixD1, double[], double[], int)
.
Based upon "Block Householder QR Factorization" pg 255 in "Matrix Computations" 3rd Ed. 1996 by Gene H. Golub and Charles F. Van Loan.
Constructor and Description 

QRDecompositionHouseholder_DDRB() 
Modifier and Type  Method and Description 

void 
applyQ(DMatrixRBlock B)
Multiplies the provided matrix by Q using householder reflectors.

void 
applyQ(DMatrixRBlock B,
boolean isIdentity)
Specialized version of applyQ() that allows the zeros in an identity matrix
to be taken advantage of depending on if isIdentity is true or not.

void 
applyQTran(DMatrixRBlock B)
Multiplies the provided matrix by Q^{T} using householder reflectors.

boolean 
decompose(DMatrixRBlock orig)
Computes the decomposition of the input matrix.

DMatrixRBlock 
getQ(DMatrixRBlock Q,
boolean compact)
Returns the Q matrix from the decomposition.

DMatrixRBlock 
getQR()
This is the input matrix after it has been overwritten with the decomposition.

DMatrixRBlock 
getR(DMatrixRBlock R,
boolean compact)
Returns the R matrix from the decomposition.

static DMatrixRBlock 
initializeQ(DMatrixRBlock Q,
int numRows,
int numCols,
int blockLength,
boolean compact)
Sanity checks the input or declares a new matrix.

boolean 
inputModified()
The input matrix is always modified.

void 
setSaveW(boolean saveW)
Sets if it should internally save the W matrix before performing the decomposition.

protected void 
updateA(DSubmatrixD1 A)
A = (I + W Y^{T})^{T}A
A = A + Y (W^{T}A) where A is a submatrix of the input matrix. 
public DMatrixRBlock getQR()
public void setSaveW(boolean saveW)
Sets if it should internally save the W matrix before performing the decomposition. Must be set before decomposition the matrix.
Saving W can result in about a 5% savings when solving systems around a height of 5k. The price is that it needs to save a matrix the size of the input matrix.
saveW
 If the W matrix should be saved or not.public DMatrixRBlock getQ(DMatrixRBlock Q, boolean compact)
QRDecomposition
Returns the Q matrix from the decomposition. Should only
be called after DecompositionInterface.decompose(org.ejml.data.Matrix)
has
been called.
If parameter Q is not null, then that matrix is used to store the Q matrix. Otherwise a new matrix is created.
getQ
in interface QRDecomposition<DMatrixRBlock>
Q
 If not null then the Q matrix is written to it. Modified.compact
 If true an m by n matrix is created, otherwise n by n.public static DMatrixRBlock initializeQ(DMatrixRBlock Q, int numRows, int numCols, int blockLength, boolean compact)
public void applyQ(DMatrixRBlock B)
Multiplies the provided matrix by Q using householder reflectors. This is more efficient that computing Q then applying it to the matrix.
B = Q * B
B
 Matrix which Q is applied to. Modified.public void applyQ(DMatrixRBlock B, boolean isIdentity)
B
 isIdentity
 If B is an identity matrix.public void applyQTran(DMatrixRBlock B)
Multiplies the provided matrix by Q^{T} using householder reflectors. This is more efficient that computing Q then applying it to the matrix.
Q = Q*(I  γ W*Y^T)
QR = A ≥ R = Q^T*A = (Q3^T * (Q2^T * (Q1^t * A)))
B
 Matrix which Q is applied to. Modified.public DMatrixRBlock getR(DMatrixRBlock R, boolean compact)
QRDecomposition
Returns the R matrix from the decomposition. Should only be
called after DecompositionInterface.decompose(org.ejml.data.Matrix)
has been.
If setZeros is true then an n × m matrix is required and all the elements are set. If setZeros is false then the matrix must be at least m × m and only the upper triangular elements are set.
If parameter R is not null, then that matrix is used to store the R matrix. Otherwise a new matrix is created.
getR
in interface QRDecomposition<DMatrixRBlock>
R
 If not null then the R matrix is written to it. Modified.compact
 If true only the upper triangular elements are setpublic boolean decompose(DMatrixRBlock orig)
DecompositionInterface
DecompositionInterface.inputModified()
will return true and the matrix should not be
modified until the decomposition is no longer needed.decompose
in interface DecompositionInterface<DMatrixRBlock>
orig
 The matrix which is being decomposed. Modification is implementation dependent.protected void updateA(DSubmatrixD1 A)
A = (I + W Y^{T})^{T}A
A = A + Y (W^{T}A)
where A is a submatrix of the input matrix.
public boolean inputModified()
inputModified
in interface DecompositionInterface<DMatrixRBlock>
Copyright © 20092018 Peter Abeles