@CodeReview(reviewer="Jonathan McClain", date="2006-05-16", changesNeeded=false, comments={"Made very minor changes.","Otherwise, looks fine."}) public abstract class AbstractSingularValueDecomposition extends java.lang.Object implements SingularValueDecomposition
Constructor and Description |
---|
AbstractSingularValueDecomposition()
Default constructor that nulls out all matrices
|
AbstractSingularValueDecomposition(Matrix U,
Matrix S,
Matrix Vtranspose)
Creates a new instance of AbstractSingularValueDecomposition where
U*S*Vtranspose = original_matrix
|
Modifier and Type | Method and Description |
---|---|
double |
conditionNumber()
Returns the condition number of the underlying matrix, which is simply
the ratio of the largest to smallest singular value
|
int |
effectiveRank(double effectiveZero)
Returns the effective rank of the underlying matrix by counting the
number of singular values whose values are larger than effectiveZero
|
Matrix |
getS()
Gets the PSD diagonal matrix containing the sorted singular values
|
Matrix |
getU()
Gets the orthonormal matrix containing the left singular vectors of the
underlying matrix
|
Matrix |
getVtranspose()
Gets the transpose of the orthonormal matrix containing the right
singular vectors of the underlying matrix
|
double |
norm2()
Returns the associated 2-norm (spectral norm) of the underlying matrix,
which is simply the largest singular value
|
Matrix |
pseudoInverse()
Computes the Least Squares pseudoinverse of the underlying matrix
|
Matrix |
pseudoInverse(double effectiveZero)
Computes the Least Squares pseudoinverse of the underlying matrix,
while clipping the singular values at effectiveZero
|
int |
rank()
Returns the rank of the underlying matrix by calling this.effectiveRank
with an effectiveZero = 0.0
|
protected void |
setS(Matrix S)
setter for the singular values matrix
|
protected void |
setU(Matrix U)
setter for left singular vectors
|
protected void |
setVtranspose(Matrix Vtranspose)
sets the transpose of the right singular vectors matrix
|
public AbstractSingularValueDecomposition()
public AbstractSingularValueDecomposition(Matrix U, Matrix S, Matrix Vtranspose)
U
- orthonormal matrix of left singular vectorsS
- PSD diagonal matrix of singular values, sorted in descending orderVtranspose
- transpose of the orthonormal matrix of the right singular vectorspublic Matrix getU()
SingularValueDecomposition
getU
in interface SingularValueDecomposition
protected void setU(Matrix U)
U
- left singular vectorspublic Matrix getS()
SingularValueDecomposition
getS
in interface SingularValueDecomposition
protected void setS(Matrix S)
S
- singular values matrixpublic Matrix getVtranspose()
SingularValueDecomposition
getVtranspose
in interface SingularValueDecomposition
protected void setVtranspose(Matrix Vtranspose)
Vtranspose
- transpose of the right singular vectors matrixpublic double norm2()
SingularValueDecomposition
norm2
in interface SingularValueDecomposition
public double conditionNumber()
SingularValueDecomposition
conditionNumber
in interface SingularValueDecomposition
public int rank()
SingularValueDecomposition
rank
in interface SingularValueDecomposition
public int effectiveRank(double effectiveZero)
SingularValueDecomposition
effectiveRank
in interface SingularValueDecomposition
effectiveZero
- threshold for considering a singular value to be zeropublic Matrix pseudoInverse()
SingularValueDecomposition
pseudoInverse
in interface SingularValueDecomposition
public Matrix pseudoInverse(double effectiveZero)
SingularValueDecomposition
pseudoInverse
in interface SingularValueDecomposition
effectiveZero
- value below which to consider the singular values zero