|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnr.SingularValueDecomposition
public class SingularValueDecomposition
Singular Value Decomposition.
Copied from the jama
package from the NIST, but using nr.Mat and limited to
square matrices
For an n-by-n matrix A, the singular value decomposition is
an n-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
an n-by-n orthogonal matrix V so that A*V = U*S.
Solving A*x = b for vectors x and b is
x = V*(1/S)*U'*b, where U' is the transform (=the inverse; it's orthogonal)
of U and 1/S is the diagonal matrix with elements 1/S[i][i].
The singular values, sigma[k] = S[k][k], are ordered so that
sigma[0] >= sigma[1] >= ... >= sigma[n-1].
The singular value decompostion always exists, so the constructor will
never fail. The matrix condition number and the effective numerical
rank can be computed from this decomposition.
Since this was developed by the US government, it is in the public domain.
Constructor Summary | |
---|---|
SingularValueDecomposition(Mat Arg)
Construct the singular value decomposition |
Method Summary | |
---|---|
double |
cond()
Two norm condition number |
Mat |
getS()
Return the diagonal matrix of singular values |
double[] |
getSingularValues()
Return the one-dimensional array of singular values |
Mat |
getU()
Return the left singular vectors |
Mat |
getV()
Return the right singular vectors |
static double |
hypot(double a,
double b)
Utility function to determine the hypotenuse function without over/under flow. |
Mat |
inverse()
|
double |
norm2()
Two norm |
int |
rank()
Effective numerical matrix rank |
Vec |
solve(Vec B)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingularValueDecomposition(Mat Arg)
Arg
- a square matrixMethod Detail |
---|
public Vec solve(Vec B)
solve
in interface MatDecomposition
public Mat inverse()
inverse
in interface MatDecomposition
public Mat getU()
public Mat getV()
public double[] getSingularValues()
public Mat getS()
public double norm2()
public double cond()
public int rank()
public static double hypot(double a, double b)
a
- a numberb
- another number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |