Class QrUpdate_FDRM

java.lang.Object
org.ejml.dense.row.decomposition.qr.QrUpdate_FDRM

@Generated("org.ejml.dense.row.decomposition.qr.QrUpdate_DDRM") public class QrUpdate_FDRM extends Object

The effects of adding and removing rows from the A matrix in a QR decomposition can be computed much faster than simply recomputing the whole decomposition. There are many real world situations where this is useful. For example, when computing a rolling solution to the most recent N measurements.

Definitions: A ∈ ℜ m × n, m ≥ n, rank(A) = n and that A = QR, where Q ∈ ℜ m × m is orthogonal, and R ∈ ℜ m × n is upper triangular.

** IMPORTANT USAGE NOTE ** If auto grow is set to true then the internal data structures will grow automatically to accommodate the matrices passed in. When adding elements to the decomposition the matrices must have enough data elements to grow before hand.

For more information see David S. Watkins, "Fundamentals of Matrix Computations" 2nd edition, pages 249-259. It is also possible to add and remove columns efficiently, but this is less common and is not supported at this time.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Does not predeclare data and it will autogrow.
    QrUpdate_FDRM(int maxRows, int maxCols)
    Creates an update which can decompose matrices up to the specified size.
    QrUpdate_FDRM(int maxRows, int maxCols, boolean autoGrow)
    Creates an update which can decompose matrices up to the specified size.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRow(FMatrixRMaj Q, FMatrixRMaj R, float[] row, int rowIndex, boolean resizeR)
    Adjusts the values of the Q and R matrices to take in account the effects of inserting a row to the 'A' matrix at the specified location.
    void
    declareInternalData(int maxRows, int maxCols)
    Declares the internal data structures so that it can process matrices up to the specified size.
    void
    deleteRow(FMatrixRMaj Q, FMatrixRMaj R, int rowIndex, boolean resizeR)
    Adjusts the values of the Q and R matrices to take in account the effects of removing a row from the 'A' matrix at the specified location.
     

    Methods inherited from class java.lang.Object

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

    • QrUpdate_FDRM

      public QrUpdate_FDRM(int maxRows, int maxCols)
      Creates an update which can decompose matrices up to the specified size. Autogrow is set to false.
    • QrUpdate_FDRM

      public QrUpdate_FDRM(int maxRows, int maxCols, boolean autoGrow)
      Creates an update which can decompose matrices up to the specified size. Autogrow is configurable.
    • QrUpdate_FDRM

      public QrUpdate_FDRM()
      Does not predeclare data and it will autogrow.
  • Method Details

    • declareInternalData

      public void declareInternalData(int maxRows, int maxCols)
      Declares the internal data structures so that it can process matrices up to the specified size.
    • addRow

      public void addRow(FMatrixRMaj Q, FMatrixRMaj R, float[] row, int rowIndex, boolean resizeR)

      Adjusts the values of the Q and R matrices to take in account the effects of inserting a row to the 'A' matrix at the specified location. This operation requires about 6mn + O(n) flops.

      If Q and/or R does not have enough data elements to grow then an exception is thrown.

      The adjustment done is by computing a series of planar Givens rotations that make the adjusted R matrix upper triangular again. This is then used to modify the Q matrix.

      Parameters:
      Q - The Q matrix which is to be modified, must be big enough to grow. Must be n by n.. Is modified.
      R - The R matrix which is to be modified, must be big enough to grow. Must be m by n. Is modified.
      row - The row being inserted. Not modified.
      rowIndex - Which row index it is to be inserted at.
      resizeR - Should the number of rows in R be changed? The additional rows are all zero.
    • deleteRow

      public void deleteRow(FMatrixRMaj Q, FMatrixRMaj R, int rowIndex, boolean resizeR)

      Adjusts the values of the Q and R matrices to take in account the effects of removing a row from the 'A' matrix at the specified location. This operation requires about 6mn + O(n) flops.

      The adjustment is done by computing a series of planar Givens rotations that make the removed row in Q equal to [1 0 ... 0].

      Parameters:
      Q - The Q matrix. Is modified.
      R - The R matrix. Is modified.
      rowIndex - Which index of the row that is being removed.
      resizeR - should the shape of R be adjusted?
    • getU_tran

      public FMatrixRMaj getU_tran()