Class QRColPivDecompositionHouseholderColumn_FDRM
- java.lang.Object
-
- org.ejml.dense.row.decomposition.qr.QRDecompositionHouseholderColumn_FDRM
-
- org.ejml.dense.row.decomposition.qr.QRColPivDecompositionHouseholderColumn_FDRM
-
- All Implemented Interfaces:
org.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.FMatrixRMaj>,org.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.FMatrixRMaj>,org.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.FMatrixRMaj>,org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj>
public class QRColPivDecompositionHouseholderColumn_FDRM extends QRDecompositionHouseholderColumn_FDRM implements org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj>
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_FDRMand 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected float[]normsColprotected int[]pivotsprotected intrankprotected floatsingularThreshold
-
Constructor Summary
Constructors Constructor Description QRColPivDecompositionHouseholderColumn_FDRM()QRColPivDecompositionHouseholderColumn_FDRM(float singularThreshold)Configure parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandecompose(org.ejml.data.FMatrixRMaj A)To decompose the matrix 'A' it must have full rank.org.ejml.data.FMatrixRMajgetColPivotMatrix(org.ejml.data.FMatrixRMaj P)int[]getColPivots()org.ejml.data.FMatrixRMajgetQ(org.ejml.data.FMatrixRMaj Q, boolean compact)Computes the Q matrix from the information stored in the QR matrix.intgetRank()protected booleanhouseholderPivot(int j)Computes the householder vector "u" for the first column of submatrix j.voidsetExpectedMaxSize(int numRows, int numCols)voidsetSingularThreshold(float threshold)protected voidsetupPivotInfo()Sets the initial pivot ordering and compute the F-norm squared for each columnprotected voidswapColumns(int j)Finds the column with the largest normal and makes that the first columnprotected voidupdateNorms(int j)Performs an efficient update of each columns' norm-
Methods inherited from class org.ejml.dense.row.decomposition.qr.QRDecompositionHouseholderColumn_FDRM
convertToColumnMajor, getGammas, getQR, getR, householder, inputModified, updateA
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
QRColPivDecompositionHouseholderColumn_FDRM
public QRColPivDecompositionHouseholderColumn_FDRM(float singularThreshold)
Configure parameters.- Parameters:
singularThreshold- The singular threshold.
-
QRColPivDecompositionHouseholderColumn_FDRM
public QRColPivDecompositionHouseholderColumn_FDRM()
-
-
Method Detail
-
setSingularThreshold
public void setSingularThreshold(float threshold)
- Specified by:
setSingularThresholdin interfaceorg.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj>
-
setExpectedMaxSize
public void setExpectedMaxSize(int numRows, int numCols)- Overrides:
setExpectedMaxSizein classQRDecompositionHouseholderColumn_FDRM
-
getQ
public org.ejml.data.FMatrixRMaj getQ(org.ejml.data.FMatrixRMaj Q, boolean compact)Computes the Q matrix from the information stored in the QR matrix. This operation requires about 4(m2n-mn2+n3/3) flops.- Specified by:
getQin interfaceorg.ejml.interfaces.decomposition.QRDecomposition<org.ejml.data.FMatrixRMaj>- Overrides:
getQin classQRDecompositionHouseholderColumn_FDRM- Parameters:
Q- The orthogonal Q matrix.
-
decompose
public boolean decompose(org.ejml.data.FMatrixRMaj 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.
- Specified by:
decomposein interfaceorg.ejml.interfaces.decomposition.DecompositionInterface<org.ejml.data.FMatrixRMaj>- Overrides:
decomposein classQRDecompositionHouseholderColumn_FDRM
-
setupPivotInfo
protected void setupPivotInfo()
Sets the initial pivot ordering and compute the F-norm squared for each column
-
updateNorms
protected void updateNorms(int j)
Performs an efficient update of each columns' norm
-
swapColumns
protected void swapColumns(int j)
Finds the column with the largest normal and makes that the first column- Parameters:
j- Current column being inspected
-
householderPivot
protected 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 'γ'.
- Parameters:
j- Which submatrix to work off of.- Returns:
- false if it is degenerate
-
getRank
public int getRank()
- Specified by:
getRankin interfaceorg.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.FMatrixRMaj>
-
getColPivots
public int[] getColPivots()
- Specified by:
getColPivotsin interfaceorg.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.FMatrixRMaj>
-
getColPivotMatrix
public org.ejml.data.FMatrixRMaj getColPivotMatrix(org.ejml.data.FMatrixRMaj P)
- Specified by:
getColPivotMatrixin interfaceorg.ejml.interfaces.decomposition.QRPDecomposition<org.ejml.data.FMatrixRMaj>
-
-