public class SVD extends Object
All SVD operations return an array of three Matrix
instances that
correspond to U Σ
and
VT. Regardless of which algorithm is used, the
matrices will be returned in this same orientation.
Five different SVD algorithms are possible:
.jar
executable, it's location needs to be specified with the jama.path
system property. This can be set on the command line using
-Djama.path=path/to/jama. Similarly, if COLT is to be used in
conjunction with a .jar
, the location of the colt.jar
file
should be specified using the colt.path
system property.
Users may select which algorithm to use manually using the Algorithm
enum. The additional enum value ANY
will select the fastest
algorithm available. If no algorithm is available, a UnsupporteOperationException
is thrown at run-time.
This class will automatically convert a file to the appropriate matrix format for the required algorithm.
MatrixIO
Modifier and Type | Class and Description |
---|---|
static class |
SVD.Algorithm
Which algorithm to use for computing the Singular Value Decomposition
(SVD) of a matrix.
|
Modifier and Type | Method and Description |
---|---|
static MatrixFactorization |
getFactorization(SVD.Algorithm alg)
Returns the
MatrixFactorization implementation corresponding to
the SVD.Algorithm name. |
static MatrixFactorization |
getFastestAvailableFactorization()
Returns the fastest
MatrixFactorization implementation of
Singular Value Decomposition available, or null if no
implementation is available. |
static boolean |
isMatlabAvailable()
Returns
true if Matlab is available |
static boolean |
isOctaveAvailable()
Returns
true if Octave is available |
static boolean |
isSVDLIBCavailable()
Returns
true if the SVDLIBC library is available |
static Matrix[] |
svd(File matrix,
int dimensions)
Deprecated.
|
static Matrix[] |
svd(File matrix,
MatrixIO.Format format,
int dimensions)
Deprecated.
|
static Matrix[] |
svd(File matrix,
SVD.Algorithm alg,
int dimensions)
Deprecated.
|
static Matrix[] |
svd(File matrix,
SVD.Algorithm alg,
MatrixIO.Format format,
int dimensions)
Deprecated.
|
static Matrix[] |
svd(Matrix m,
int dimensions)
Deprecated.
|
static Matrix[] |
svd(Matrix m,
SVD.Algorithm algorithm,
int dimensions)
Deprecated.
|
public static MatrixFactorization getFastestAvailableFactorization()
MatrixFactorization
implementation of
Singular Value Decomposition available, or null
if no
implementation is available.public static MatrixFactorization getFactorization(SVD.Algorithm alg)
MatrixFactorization
implementation corresponding to
the SVD.Algorithm
name.@Deprecated public static Matrix[] svd(Matrix m, int dimensions)
MatrixFactorization
implementation instead.m
- the matrix on which the SVD should be computeddimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if no SVD algorithm is available@Deprecated public static Matrix[] svd(Matrix m, SVD.Algorithm algorithm, int dimensions)
MatrixFactorization
implementation instead.m
- the matrix on which the SVD should be computedalgorithm
- the algorithm to use in computing the SVDdimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if no SVD algorithm is available@Deprecated public static Matrix[] svd(File matrix, int dimensions)
Matlab sparse
format using the specified SVD
algorithm to generate the specified number of singular values.
Use a MatrixFactorization
implementation instead.matrix
- a file containing a matrixdimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if no SVD algorithm is available@Deprecated public static Matrix[] svd(File matrix, SVD.Algorithm alg, int dimensions)
Matlab sparse
format using the specified SVD
algorithm to generate the specified number of singular values.
Use a MatrixFactorization
implementation instead.matrix
- a file containing a matrixalg
- which algorithm to use for computing the SVDdimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if the provided SVD algorithm is
unavailable@Deprecated public static Matrix[] svd(File matrix, MatrixIO.Format format, int dimensions)
MatrixFactorization
implementation instead.matrix
- a file containing a matrixformat
- the format of the input matrix filedimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if no SVD algorithm is available@Deprecated public static Matrix[] svd(File matrix, SVD.Algorithm alg, MatrixIO.Format format, int dimensions)
MatrixFactorization
implementation instead.matrix
- a file containing a matrixalg
- which algorithm to use for computing the SVDformat
- the format of the input matrix filedimensions
- the number of singular values to calculateMatrix
objects for the U, S, and
VT matrices in that orderUnsupportedOperationException
- if the provided SVD algorithm is
unavailablepublic static boolean isSVDLIBCavailable()
true
if the SVDLIBC library is availablepublic static boolean isOctaveAvailable()
true
if Octave is availablepublic static boolean isMatlabAvailable()
true
if Matlab is availableCopyright © 2012. All Rights Reserved.