public class HouseholderColQR extends Object implements QRDecomposition
Householder QR decomposition is rich in operations along the columns of the matrix. This can be taken advantage of by solving for the Q matrix in a column major format to reduce the number of CPU cache misses and the number of copies that are performed.
| Modifier and Type | Field and Description |
|---|---|
protected double[][] |
dataQR
Where the Q and R matrices are stored.
|
protected boolean |
error |
protected double |
gamma |
protected double[] |
gammas |
protected int |
minLength |
protected int |
numCols |
protected int |
numRows |
protected double |
tau |
protected double[] |
v |
| Constructor and Description |
|---|
HouseholderColQR(boolean compact) |
| Modifier and Type | Method and Description |
|---|---|
protected AMatrix |
computeQ()
Computes Q.
|
protected AMatrix |
computeR()
Computes R.
|
protected void |
convertToColumnMajor(AMatrix A)
Converts the standard row-major matrix into a column-major vector
that is advantageous for this problem.
|
QRResult |
decompose(AMatrix A)
To decompose the matrix 'A' it must have full rank.
|
double[] |
getGammas() |
AMatrix |
getQ() |
double[][] |
getQR()
Returns the combined QR matrix in a 2D array format that is column major.
|
AMatrix |
getR() |
protected void |
householder(int j)
Computes the householder vector "u" for the first column of submatrix j.
|
protected void |
updateA(int w)
Takes the results from the householder computation and updates the 'A' matrix.
A = (I - γ*u*uT)A |
protected double[][] dataQR
protected double[] v
protected int numCols
protected int numRows
protected int minLength
protected double[] gammas
protected double gamma
protected double tau
protected boolean error
public double[][] getQR()
public AMatrix getQ()
public AMatrix getR()
protected AMatrix computeQ()
protected AMatrix computeR()
public QRResult decompose(AMatrix 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 QRDecompositionprotected void convertToColumnMajor(AMatrix A)
A - original matrix that is to be decomposed.protected void householder(int j)
Computes the householder vector "u" for the first column of submatrix j. Note this is a specialized householder for this problem. There is some protection against overfloaw and underflow.
Q = I - γuuT
This function finds the values of 'u' and 'γ'.
j - Which submatrix to work off of.protected void updateA(int w)
Takes the results from the householder computation and updates the 'A' matrix.
A = (I - γ*u*uT)A
w - The submatrix.public double[] getGammas()
Copyright © 2016. All rights reserved.