Class QRDecompositionHouseholder_MT_DDRB

java.lang.Object
org.ejml.dense.block.decomposition.qr.QRDecompositionHouseholder_MT_DDRB
All Implemented Interfaces:
org.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.DMatrixRBlock>, org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.DMatrixRBlock>

@Generated("org.ejml.dense.block.decomposition.qr.QRDecompositionHouseholder_DDRB")
public class QRDecompositionHouseholder_MT_DDRB
extends java.lang.Object
implements org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.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(:,i-r to i) )
 W=computeW( A(:,i-r 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_MT_DDRB.computeW_Column(int, org.ejml.data.DSubmatrixD1, org.ejml.data.DSubmatrixD1, pabeles.concurrency.GrowArray<org.ejml.data.DGrowArray>, 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 Summary

    Constructors 
    Constructor Description
    QRDecompositionHouseholder_MT_DDRB()  
  • Method Summary

    Modifier and Type Method Description
    void applyQ​(org.ejml.data.DMatrixRBlock B)
    Multiplies the provided matrix by Q using householder reflectors.
    void applyQ​(org.ejml.data.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​(org.ejml.data.DMatrixRBlock B)
    Multiplies the provided matrix by QT using householder reflectors.
    boolean decompose​(org.ejml.data.DMatrixRBlock orig)  
    org.ejml.data.DMatrixRBlock getQ​(@Nullable org.ejml.data.DMatrixRBlock Q, boolean compact)  
    org.ejml.data.DMatrixRBlock getQR()
    This is the input matrix after it has been overwritten with the decomposition.
    org.ejml.data.DMatrixRBlock getR​(@Nullable org.ejml.data.DMatrixRBlock R, boolean compact)  
    static org.ejml.data.DMatrixRBlock initializeQ​(@Nullable org.ejml.data.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​(org.ejml.data.DSubmatrixD1 A)
    A = (I + W YT)TA
    A = A + Y (WTA)

    where A is a submatrix of the input matrix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getQR

      public org.ejml.data.DMatrixRBlock getQR()
      This is the input matrix after it has been overwritten with the decomposition.
      Returns:
      Internal matrix used to store decomposition.
    • setSaveW

      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.

      Parameters:
      saveW - If the W matrix should be saved or not.
    • getQ

      public org.ejml.data.DMatrixRBlock getQ​(@Nullable @Nullable org.ejml.data.DMatrixRBlock Q, boolean compact)
      Specified by:
      getQ in interface org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.DMatrixRBlock>
    • initializeQ

      public static org.ejml.data.DMatrixRBlock initializeQ​(@Nullable @Nullable org.ejml.data.DMatrixRBlock Q, int numRows, int numCols, int blockLength, boolean compact)
      Sanity checks the input or declares a new matrix. Return matrix is an identity matrix.
    • applyQ

      public void applyQ​(org.ejml.data.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

      Parameters:
      B - Matrix which Q is applied to. Modified.
    • applyQ

      public void applyQ​(org.ejml.data.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.
      Parameters:
      isIdentity - If B is an identity matrix.
    • applyQTran

      public void applyQTran​(org.ejml.data.DMatrixRBlock B)

      Multiplies the provided matrix by QT 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)))

      Parameters:
      B - Matrix which Q is applied to. Modified.
    • getR

      public org.ejml.data.DMatrixRBlock getR​(@Nullable @Nullable org.ejml.data.DMatrixRBlock R, boolean compact)
      Specified by:
      getR in interface org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.DMatrixRBlock>
    • decompose

      public boolean decompose​(org.ejml.data.DMatrixRBlock orig)
      Specified by:
      decompose in interface org.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.DMatrixRBlock>
    • updateA

      protected void updateA​(org.ejml.data.DSubmatrixD1 A)

      A = (I + W YT)TA
      A = A + Y (WTA)

      where A is a submatrix of the input matrix.

    • inputModified

      public boolean inputModified()
      The input matrix is always modified.
      Specified by:
      inputModified in interface org.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.DMatrixRBlock>
      Returns:
      Returns true since the input matrix is modified.