public class QRColPivDecompositionHouseholderColumn_DDRM extends QRDecompositionHouseholderColumn_DDRM implements org.ejml.interfaces.decomposition.QRPDecomposition_F64<org.ejml.data.DMatrixRMaj>
Performs QR decomposition with column pivoting. To prevent overflow/underflow the whole matrix
is normalized by the max value, but columns are not normalized individually any more. To enable
code reuse it extends QRDecompositionHouseholderColumn_DDRM
and functions from that class
are used whenever possible. Columns are transposed into single arrays, which allow for
fast pivots.
Decomposition: A*P = Q*R
Based off the description in "Fundamentals of Matrix Computations", 2nd by David S. Watkins.
Modifier and Type | Field and Description |
---|---|
protected double[] |
normsCol |
protected int[] |
pivots |
protected int |
rank |
protected double |
singularThreshold |
Constructor and Description |
---|
QRColPivDecompositionHouseholderColumn_DDRM() |
QRColPivDecompositionHouseholderColumn_DDRM(double singularThreshold)
Configure parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
decompose(org.ejml.data.DMatrixRMaj A)
To decompose the matrix 'A' it must have full rank.
|
org.ejml.data.DMatrixRMaj |
getColPivotMatrix(org.ejml.data.DMatrixRMaj P) |
int[] |
getColPivots() |
org.ejml.data.DMatrixRMaj |
getQ(org.ejml.data.DMatrixRMaj Q,
boolean compact)
Computes the Q matrix from the information stored in the QR matrix.
|
int |
getRank() |
protected boolean |
householderPivot(int j)
Computes the householder vector "u" for the first column of submatrix j.
|
void |
setExpectedMaxSize(int numRows,
int numCols) |
void |
setSingularThreshold(double threshold) |
protected void |
setupPivotInfo()
Sets the initial pivot ordering and compute the F-norm squared for each column
|
protected void |
swapColumns(int j)
Finds the column with the largest normal and makes that the first column
|
protected void |
updateNorms(int j)
Performs an efficient update of each columns' norm
|
convertToColumnMajor, getGammas, getQR, getR, householder, inputModified, updateA
protected int[] pivots
protected double[] normsCol
protected double singularThreshold
protected int rank
public QRColPivDecompositionHouseholderColumn_DDRM(double singularThreshold)
singularThreshold
- The singular threshold.public QRColPivDecompositionHouseholderColumn_DDRM()
public void setSingularThreshold(double threshold)
setSingularThreshold
in interface org.ejml.interfaces.decomposition.QRPDecomposition_F64<org.ejml.data.DMatrixRMaj>
public void setExpectedMaxSize(int numRows, int numCols)
setExpectedMaxSize
in class QRDecompositionHouseholderColumn_DDRM
public org.ejml.data.DMatrixRMaj getQ(org.ejml.data.DMatrixRMaj Q, boolean compact)
getQ
in interface org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.DMatrixRMaj>
getQ
in class QRDecompositionHouseholderColumn_DDRM
Q
- The orthogonal Q matrix.public boolean decompose(org.ejml.data.DMatrixRMaj A)
To decompose the matrix 'A' it must have full rank. 'A' is a 'm' by 'n' matrix. It requires about 2n*m2-2m2/3 flops.
The matrix provided here can be of different dimension than the one specified in the constructor. It just has to be smaller than or equal to it.
decompose
in interface org.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.DMatrixRMaj>
decompose
in class QRDecompositionHouseholderColumn_DDRM
protected void setupPivotInfo()
protected void updateNorms(int j)
protected void swapColumns(int j)
j
- Current column being inspectedprotected boolean householderPivot(int j)
Computes the householder vector "u" for the first column of submatrix j. The already computed norm is used and checks to see if the matrix is singular at this point.
Q = I - γuuT
This function finds the values of 'u' and 'γ'.
j
- Which submatrix to work off of.public int getRank()
getRank
in interface org.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.DMatrixRMaj>
public int[] getColPivots()
getColPivots
in interface org.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.DMatrixRMaj>
public org.ejml.data.DMatrixRMaj getColPivotMatrix(org.ejml.data.DMatrixRMaj P)
getColPivotMatrix
in interface org.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.DMatrixRMaj>