public class SvdImplicitQrAlgorithm_FDRM
extends java.lang.Object
Computes the QR decomposition of a bidiagonal matrix. Internally this matrix is stored as
two arrays. Shifts can either be provided to it or it can generate the shifts on its own.
It optionally computes the U and V matrices. This comparability allows it to be used to
compute singular values and associated matrices efficiently.
A = U*S*VT
where A is the original m by n matrix.
Based off of the outline provided in:
David S. Watkins, "Fundamentals of Matrix Computations," Second Edition. Page 404-411
Note: To watch it process the matrix step by step uncomment commented out code.
Modifier and Type | Field and Description |
---|---|
protected float[] |
diag |
protected EigenvalueSmall_F32 |
eigenSmall |
protected float |
maxValue |
protected int |
N |
protected int |
nextExceptional |
protected int |
numExceptional |
protected int |
numSplits |
protected float[] |
off |
protected java.util.Random |
rand |
protected int[] |
splits |
protected int |
totalSteps |
protected org.ejml.data.FMatrixRMaj |
Ut |
protected org.ejml.data.FMatrixRMaj |
Vt |
protected int |
x1 |
protected int |
x2 |
Constructor and Description |
---|
SvdImplicitQrAlgorithm_FDRM() |
SvdImplicitQrAlgorithm_FDRM(boolean fastValues) |
Modifier and Type | Method and Description |
---|---|
boolean |
_process() |
protected boolean |
checkForAndHandleZeros()
Checks to see if either the diagonal element or off diagonal element is zero.
|
protected void |
computeRotator(float rise,
float run)
Computes a rotator that will set run to zero (?)
|
protected void |
createBulge(int x1,
float p,
float scale,
boolean byAngle)
Performs a similar transform on BTB-pI
|
protected void |
eigenBB_2x2(int x1)
Computes the eigenvalue of the 2 by 2 matrix BTB
|
void |
exceptionShift()
It is possible for the QR algorithm to get stuck in a loop because of symmetries.
|
float[] |
getDiag() |
float |
getMaxValue() |
int |
getNumberOfSingularValues() |
float[] |
getOff() |
float |
getSingularValue(int index) |
float[] |
getSingularValues() |
org.ejml.data.FMatrixRMaj |
getUt() |
org.ejml.data.FMatrixRMaj |
getVt() |
void |
incrementSteps() |
void |
initParam(int M,
int N) |
boolean |
isDiagonalZero(int i) |
boolean |
isOffZero(int i) |
boolean |
nextSplit()
Tells it to process the submatrix at the next split.
|
void |
performImplicitSingleStep(float scale,
float lambda,
boolean byAngle)
Given the lambda value perform an implicit QR step on the matrix.
|
void |
printMatrix() |
boolean |
process() |
boolean |
process(float[] values)
Perform a sequence of steps based off of the singular values provided.
|
protected void |
removeBulgeLeft(int x1,
boolean notLast) |
protected void |
removeBulgeRight(int x1) |
void |
resetSteps() |
float |
selectWilkinsonShift(float scale)
Selects the Wilkinson's shift for BTB.
|
void |
setFastValues(boolean b) |
void |
setMatrix(int numRows,
int numCols,
float[] diag,
float[] off) |
void |
setMaxValue(float maxValue) |
void |
setSubmatrix(int x1,
int x2) |
void |
setUt(org.ejml.data.FMatrixRMaj ut) |
void |
setVt(org.ejml.data.FMatrixRMaj vt) |
float[] |
swapDiag(float[] diag) |
float[] |
swapOff(float[] off) |
protected void |
updateRotator(org.ejml.data.FMatrixRMaj Q,
int m,
int n,
float c,
float s)
Multiplied a transpose orthogonal matrix Q by the specified rotator.
|
protected java.util.Random rand
protected org.ejml.data.FMatrixRMaj Ut
protected org.ejml.data.FMatrixRMaj Vt
protected int totalSteps
protected float maxValue
protected int N
protected EigenvalueSmall_F32 eigenSmall
protected int numExceptional
protected int nextExceptional
protected float[] diag
protected float[] off
protected int x1
protected int x2
protected int[] splits
protected int numSplits
public SvdImplicitQrAlgorithm_FDRM(boolean fastValues)
public SvdImplicitQrAlgorithm_FDRM()
public org.ejml.data.FMatrixRMaj getUt()
public void setUt(org.ejml.data.FMatrixRMaj ut)
public org.ejml.data.FMatrixRMaj getVt()
public void setVt(org.ejml.data.FMatrixRMaj vt)
public void setMatrix(int numRows, int numCols, float[] diag, float[] off)
public float[] swapDiag(float[] diag)
public float[] swapOff(float[] off)
public void setMaxValue(float maxValue)
public void initParam(int M, int N)
public boolean process()
public boolean process(float[] values)
values
- public boolean _process()
public void incrementSteps()
public boolean isOffZero(int i)
public boolean isDiagonalZero(int i)
public void resetSteps()
public boolean nextSplit()
public void performImplicitSingleStep(float scale, float lambda, boolean byAngle)
lambda
- Stepping factor.protected void updateRotator(org.ejml.data.FMatrixRMaj Q, int m, int n, float c, float s)
Q
- Orthogonal matrixm
- Coordinate of rotator.n
- Coordinate of rotator.c
- cosine of rotator.s
- sine of rotator.protected void createBulge(int x1, float p, float scale, boolean byAngle)
protected void computeRotator(float rise, float run)
protected void removeBulgeLeft(int x1, boolean notLast)
protected void removeBulgeRight(int x1)
public void setSubmatrix(int x1, int x2)
public float selectWilkinsonShift(float scale)
scale
- Scale factor used to help prevent overflow/underflowprotected void eigenBB_2x2(int x1)
protected boolean checkForAndHandleZeros()
public void exceptionShift()
public void printMatrix()
public int getNumberOfSingularValues()
public float getSingularValue(int index)
public void setFastValues(boolean b)
public float[] getSingularValues()
public float[] getDiag()
public float[] getOff()
public float getMaxValue()