public class PartialSingularValueDecomposition extends Object implements IMatrixFactorization
Modifier and Type | Field and Description |
---|---|
protected DoubleMatrix2D |
A
Input matrix
|
protected static int |
DEFAULT_K
The default number of desired base vectors
|
protected int |
k
The desired number of base vectors
|
protected DoubleMatrix2D |
U
Base vector result matrix
|
protected DoubleMatrix2D |
V
Coefficient result matrix
|
Constructor and Description |
---|
PartialSingularValueDecomposition(DoubleMatrix2D A)
Computes a partial SVD of a matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
compute()
Computes the factorization.
|
int |
getK()
Returns the number of base vectors k .
|
double[] |
getSingularValues()
Returns singular values of the matrix.
|
DoubleMatrix2D |
getU()
Returns the U matrix (base vectors matrix).
|
DoubleMatrix2D |
getV()
Returns the V matrix (coefficient matrix)
|
void |
setK(int k)
Sets the number of base vectors k .
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getU, getV
protected int k
protected static final int DEFAULT_K
protected DoubleMatrix2D A
protected DoubleMatrix2D U
protected DoubleMatrix2D V
public PartialSingularValueDecomposition(DoubleMatrix2D A)
compute()
method.A
- matrix to be factorizedpublic void compute()
public double[] getSingularValues()
public void setK(int k)
k
- the number of base vectorspublic int getK()
public DoubleMatrix2D getU()
IMatrixFactorization
getU
in interface IMatrixFactorization
public DoubleMatrix2D getV()
IMatrixFactorization
getV
in interface IMatrixFactorization