jml.matlab.utils
Class SingularValueDecompositionImpl

java.lang.Object
  extended by jml.matlab.utils.SingularValueDecompositionImpl
All Implemented Interfaces:
org.apache.commons.math.linear.SingularValueDecomposition

public class SingularValueDecompositionImpl
extends java.lang.Object
implements org.apache.commons.math.linear.SingularValueDecomposition

Calculates the compact Singular Value Decomposition of a matrix.

The Singular Value Decomposition of matrix A is a set of three matrices: U, Σ and V such that A = U × Σ × VT. Let A be a m × n matrix, then U is a m × p orthogonal matrix, Σ is a p × p diagonal matrix with positive or null elements, V is a p × n orthogonal matrix (hence VT is also orthogonal) where p=min(m,n).

Since:
2.0
Version:
$Id: SingularValueDecompositionImpl.java -1 $

Nested Class Summary
private static class SingularValueDecompositionImpl.Solver
          Specialized solver.
 
Field Summary
protected  org.apache.commons.math.linear.RealMatrix cachedS
           
protected  org.apache.commons.math.linear.RealMatrix cachedU
           
protected  org.apache.commons.math.linear.RealMatrix cachedUt
           
protected  org.apache.commons.math.linear.RealMatrix cachedV
           
protected  org.apache.commons.math.linear.RealMatrix cachedVt
           
private  int m
           
private  int n
           
private  double[] s
           
private  boolean transposed
           
 
Constructor Summary
SingularValueDecompositionImpl(org.apache.commons.math.linear.RealMatrix matrix)
          Calculates the compact Singular Value Decomposition of the given matrix.
 
Method Summary
 double getConditionNumber()
          
 org.apache.commons.math.linear.RealMatrix getCovariance(double minSingularValue)
          
 double getNorm()
          Two norm
 int getRank()
          
 org.apache.commons.math.linear.RealMatrix getS()
          
 double[] getSingularValues()
          
 org.apache.commons.math.linear.DecompositionSolver getSolver()
          
 org.apache.commons.math.linear.RealMatrix getU()
          
 org.apache.commons.math.linear.RealMatrix getUT()
          
 org.apache.commons.math.linear.RealMatrix getV()
          
 org.apache.commons.math.linear.RealMatrix getVT()
          
private  double hypot(double a, double b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

private double[] s

m

private int m

n

private int n

transposed

private boolean transposed

cachedU

protected org.apache.commons.math.linear.RealMatrix cachedU

cachedUt

protected org.apache.commons.math.linear.RealMatrix cachedUt

cachedS

protected org.apache.commons.math.linear.RealMatrix cachedS

cachedV

protected org.apache.commons.math.linear.RealMatrix cachedV

cachedVt

protected org.apache.commons.math.linear.RealMatrix cachedVt
Constructor Detail

SingularValueDecompositionImpl

public SingularValueDecompositionImpl(org.apache.commons.math.linear.RealMatrix matrix)
Calculates the compact Singular Value Decomposition of the given matrix.

Parameters:
matrix - Matrix to decompose.
Method Detail

hypot

private double hypot(double a,
                     double b)

getU

public org.apache.commons.math.linear.RealMatrix getU()

Specified by:
getU in interface org.apache.commons.math.linear.SingularValueDecomposition

getV

public org.apache.commons.math.linear.RealMatrix getV()

Specified by:
getV in interface org.apache.commons.math.linear.SingularValueDecomposition

getUT

public org.apache.commons.math.linear.RealMatrix getUT()

Specified by:
getUT in interface org.apache.commons.math.linear.SingularValueDecomposition

getVT

public org.apache.commons.math.linear.RealMatrix getVT()

Specified by:
getVT in interface org.apache.commons.math.linear.SingularValueDecomposition

getSingularValues

public double[] getSingularValues()

Specified by:
getSingularValues in interface org.apache.commons.math.linear.SingularValueDecomposition

getS

public org.apache.commons.math.linear.RealMatrix getS()

Specified by:
getS in interface org.apache.commons.math.linear.SingularValueDecomposition

getNorm

public double getNorm()
Two norm

Specified by:
getNorm in interface org.apache.commons.math.linear.SingularValueDecomposition
Returns:
max(S)

getCovariance

public org.apache.commons.math.linear.RealMatrix getCovariance(double minSingularValue)

Specified by:
getCovariance in interface org.apache.commons.math.linear.SingularValueDecomposition

getSolver

public org.apache.commons.math.linear.DecompositionSolver getSolver()

Specified by:
getSolver in interface org.apache.commons.math.linear.SingularValueDecomposition

getConditionNumber

public double getConditionNumber()

Specified by:
getConditionNumber in interface org.apache.commons.math.linear.SingularValueDecomposition

getRank

public int getRank()

Specified by:
getRank in interface org.apache.commons.math.linear.SingularValueDecomposition