Class QrUpdate_DDRM
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 249259. It is also possible to add and remove columns efficiently, but this is less common and is not supported at this time.

Constructor Summary
ConstructorDescriptionDoes not predeclare data and it will autogrow.QrUpdate_DDRM
(int maxRows, int maxCols) Creates an update which can decompose matrices up to the specified size.QrUpdate_DDRM
(int maxRows, int maxCols, boolean autoGrow) Creates an update which can decompose matrices up to the specified size. 
Method Summary
Modifier and TypeMethodDescriptionvoid
addRow
(DMatrixRMaj Q, DMatrixRMaj R, double[] 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
(DMatrixRMaj Q, DMatrixRMaj 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.

Constructor Details

QrUpdate_DDRM
public QrUpdate_DDRM(int maxRows, int maxCols) Creates an update which can decompose matrices up to the specified size. Autogrow is set to false. 
QrUpdate_DDRM
public QrUpdate_DDRM(int maxRows, int maxCols, boolean autoGrow) Creates an update which can decompose matrices up to the specified size. Autogrow is configurable. 
QrUpdate_DDRM
public QrUpdate_DDRM()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
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
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
