Class GolubKahanSVD
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.factorization.svd.GolubKahanSVD
-
- All Implemented Interfaces:
SVDDecomposition
public class GolubKahanSVD extends Object implements SVDDecomposition
Golub-Kahan algorithm does the SVD decomposition of a tall matrix in two stages.- First, it reduces the matrix to a bidiagonal matrix using a sequence of Householder transformations.
- Second, it reduces the super-diagonal of the bidiagonal matrix to 0s, using a sequence of Givens transformations.
-
-
Constructor Summary
Constructors Constructor Description GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon)
Run the Golub-Kahan SVD decomposition on a tall matrix.GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon, int maxIterations)
Runs the Golub-Kahan SVD decomposition on a tall matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiagonalMatrix
D()
Get the D matrix as in SVD decomposition.double[]
getSingularValues()
Get the normalized, hence positive, singular values.Matrix
U()
Get the U matrix as in SVD decomposition.Matrix
Ut()
Get the transpose of U, i.e.,U().t()
.Matrix
V()
Get the V matrix as in SVD decomposition.
-
-
-
Constructor Detail
-
GolubKahanSVD
public GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon)
Run the Golub-Kahan SVD decomposition on a tall matrix.- Parameters:
A
- a tall matrixdoUV
-false
if to compute only the singular values but not U and Vnormalize
-true
if to sort the singular values in descending order and make them positiveepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0- Throws:
IllegalArgumentException
- if A is not tall
-
GolubKahanSVD
public GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon, int maxIterations)
Runs the Golub-Kahan SVD decomposition on a tall matrix.- Parameters:
A
- a tall matrixdoUV
-false
if to compute only the singular values but not U and Vnormalize
-true
if to sort the singular values in descending order and make them positiveepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0maxIterations
- the maximum number of iterations- Throws:
IllegalArgumentException
- if A is not tall
-
-
Method Detail
-
getSingularValues
public double[] getSingularValues()
Description copied from interface:SVDDecomposition
Get the normalized, hence positive, singular values. They may differ from the values in D if this computation turns off normalization.- Specified by:
getSingularValues
in interfaceSVDDecomposition
- Returns:
- the singular values
-
D
public DiagonalMatrix D()
Description copied from interface:SVDDecomposition
Get the D matrix as in SVD decomposition.- Specified by:
D
in interfaceSVDDecomposition
- Returns:
- D
-
U
public Matrix U()
Description copied from interface:SVDDecomposition
Get the U matrix as in SVD decomposition.- Specified by:
U
in interfaceSVDDecomposition
- Returns:
- U
-
Ut
public Matrix Ut()
Description copied from interface:SVDDecomposition
Get the transpose of U, i.e.,U().t()
.- Specified by:
Ut
in interfaceSVDDecomposition
- Returns:
U().t()
-
V
public Matrix V()
Description copied from interface:SVDDecomposition
Get the V matrix as in SVD decomposition.- Specified by:
V
in interfaceSVDDecomposition
- Returns:
- V
-
-