public class SVDecomposition3d
extends java.lang.Object
Providing a separate class for the SVD allows an application to perform such decompositions repeatedly without having to reallocate temporary storage space.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ITERATION_LIMIT
The iteration limit for computing the SVD.
|
Constructor and Description |
---|
SVDecomposition3d()
Creates an uninitialized SVDecomposition with U and V internally
allocated.
|
SVDecomposition3d(Matrix3dBase M)
Creates an SVDecomposition with U and V internally allocated and
initializes it to the SVD for the matrix M.
|
SVDecomposition3d(Matrix3d U,
Matrix3d V)
Creates an SVDecomposition with the matrices U and V.
|
SVDecomposition3d(Matrix3d U,
Matrix3d V,
Matrix3dBase M)
Creates an SVDecomposition with the matrices U and V, and initializes it
to the SVD for the matrix M.
|
Modifier and Type | Method and Description |
---|---|
double |
condition()
Computes the condition number of the original matrix M associated with
this SVD.
|
double |
determinant()
Computes the determinant of the original matrix M associated with this
SVD.
|
void |
factor(Matrix3dBase M)
Peforms an SVD on the Matrix3dBase M.
|
boolean |
factorSafe(Matrix3dBase M)
Peforms an SVD on the Matrix3dBase M, without throwing an exception
max iterations being surpassed
|
int |
getIterationLimit()
Gets the iteration limit for SVD computations.
|
Vector3d[] |
getNullSpace() |
Vector3d[] |
getNullSpace(double eps) |
Vector3d[] |
getRangeSpace() |
Vector3d[] |
getRangeSpace(double eps) |
void |
getS(Vector3d svec)
Gets the singular values associated with this SVD.
|
Matrix3d |
getU()
Returns the U matrix associated with this SVD, or null if no such matrix
has been set.
|
Matrix3d |
getV()
Returns the V matrix associated with this SVD, or null if no such matrix
has been set.
|
boolean |
inverse(Matrix3d R)
Computes the inverse of the original matrix M associated this SVD, and
places the result in R.
|
boolean |
isCanonical() |
void |
leftPolarDecomposition(Matrix3d P,
Matrix3dBase R,
Matrix3dBase F)
Factors a 3 x 3 matrix F into a left polar decomposition
|
double |
norm()
Computes the 2-norm of the original matrix M associated with this SVD.
|
void |
polarDecomposition(Matrix3dBase R,
Matrix3d P,
Matrix3dBase F)
Factors a 3 x 3 matrix F into a right polar decomposition
|
void |
polarDecomposition(Matrix3dBase R,
SymmetricMatrix3d P,
Matrix3dBase F)
Factors a 3 x 3 matrix F into a right polar decomposition
|
boolean |
pseudoInverse(Matrix3d R)
Computes the pseudo inverse of the original matrix M associated this SVD, and
places the result in R.
|
void |
setCanonical(boolean enable)
Ensure that singular values are positive and sorted from largest to
smallest.
|
void |
setIterationLimit(int lim)
Sets the iteration limit for SVD computations.
|
void |
setU(Matrix3d U)
Sets the U matrix associated with this SVD.
|
void |
setV(Matrix3d V)
Sets the V matrix associated with this SVD.
|
boolean |
solve(Vector3d x,
Vector3d b)
Solves the linear equation
M x = b where M is the original matrix associated with this SVD, and x and b are vectors. |
public static final int DEFAULT_ITERATION_LIMIT
public SVDecomposition3d(Matrix3d U, Matrix3d V, Matrix3dBase M)
U
- optional U matrix for this SVDV
- optional V matrix for this SVDM
- matrix to perform the SVD onpublic SVDecomposition3d(Matrix3d U, Matrix3d V)
U
- optional U matrix for this SVDV
- optional V matrix for this SVDpublic SVDecomposition3d(Matrix3dBase M)
M
- matrix to perform the SVD onpublic SVDecomposition3d()
public void setCanonical(boolean enable)
true
. If
false
, then no effort will be made to ensure that the
values are positive or sorted.public boolean isCanonical()
public int getIterationLimit()
setIterationLimit(int)
public void setIterationLimit(int lim)
lim
- iteration limitgetIterationLimit()
public void factor(Matrix3dBase M)
M
- matrix to perform the SVD onpublic boolean factorSafe(Matrix3dBase M)
M
- matrix to perform the SVD onpublic void setU(Matrix3d U)
U
- new U matrix for this SVDpublic Matrix3d getU()
public void setV(Matrix3d V)
V
- new V matrix for this SVDpublic Matrix3d getV()
public void getS(Vector3d svec)
svec
- vector giving the diagonal elements of Spublic double condition()
ImproperStateException
- if this SVDecomposition is uninitializedpublic double norm()
ImproperStateException
- if this SVDecomposition is uninitializedpublic double determinant()
ImproperStateException
- if this SVDecomposition is uninitializedpublic boolean solve(Vector3d x, Vector3d b)
x
- unknown vector to solve forb
- constant vectorImproperStateException
- if this decomposition is uninitialized, or if U and V are not presentpublic boolean inverse(Matrix3d R)
R
- matrix in which the inverse is storedImproperStateException
- if this decomposition is uninitialized, or if U and V are not presentpublic boolean pseudoInverse(Matrix3d R)
R
- matrix in which the inverse is storedImproperStateException
- if this decomposition is uninitialized, or if U and V are not presentpublic Vector3d[] getNullSpace(double eps)
public Vector3d[] getRangeSpace(double eps)
public Vector3d[] getNullSpace()
public Vector3d[] getRangeSpace()
public void polarDecomposition(Matrix3dBase R, Matrix3d P, Matrix3dBase F)
F = R Pwhere R is a rotation matrix (with determinant 1) and P is a symmetric matrix.
public void polarDecomposition(Matrix3dBase R, SymmetricMatrix3d P, Matrix3dBase F)
F = R Pwhere R is a rotation matrix (with determinant 1) and P is a symmetric matrix.
public void leftPolarDecomposition(Matrix3d P, Matrix3dBase R, Matrix3dBase F)
F = P Rwhere R is a rotation matrix (with determinant 1) and P is a symmetric matrix.