## gov.sandia.cognition.math.matrix.decomposition Class AbstractSingularValueDecomposition

```java.lang.Object gov.sandia.cognition.math.matrix.decomposition.AbstractSingularValueDecomposition
```
All Implemented Interfaces:
SingularValueDecomposition
Direct Known Subclasses:
SingularValueDecompositionMTJ

```@CodeReview(reviewer="Jonathan McClain",
date="2006-05-16",
changesNeeded=false,
public abstract class AbstractSingularValueDecompositionextends Objectimplements SingularValueDecomposition```

Abstract container class that stores the matrices for a Singular Value Decomposition (SVD) and related operations but does not actually perform a singular value decomposition

Since:
1.0
Author:
Kevin R. Dixon

Constructor Summary
`AbstractSingularValueDecomposition()`
Default constructor that nulls out all matrices
```AbstractSingularValueDecomposition(Matrix U, Matrix S, Matrix Vtranspose)```
Creates a new instance of AbstractSingularValueDecomposition where U*S*Vtranspose = original_matrix

Method Summary
` double` `conditionNumber()`
Returns the condition number of the underlying matrix, which is simply the ratio of the largest to smallest singular value
` int` `effectiveRank(double effectiveZero)`
Returns the effective rank of the underlying matrix by counting the number of singular values whose values are larger than effectiveZero
` Matrix` `getS()`
Gets the PSD diagonal matrix containing the sorted singular values
` Matrix` `getU()`
Gets the orthonormal matrix containing the left singular vectors of the underlying matrix
` Matrix` `getVtranspose()`
Gets the transpose of the orthonormal matrix containing the right singular vectors of the underlying matrix
` double` `norm2()`
Returns the associated 2-norm (spectral norm) of the underlying matrix, which is simply the largest singular value
` Matrix` `pseudoInverse()`
Computes the Least Squares pseudoinverse of the underlying matrix
` Matrix` `pseudoInverse(double effectiveZero)`
Computes the Least Squares pseudoinverse of the underlying matrix, while clipping the singular values at effectiveZero
` int` `rank()`
Returns the rank of the underlying matrix by calling this.effectiveRank with an effectiveZero = 0.0
`protected  void` `setS(Matrix S)`
setter for the singular values matrix
`protected  void` `setU(Matrix U)`
setter for left singular vectors
`protected  void` `setVtranspose(Matrix Vtranspose)`
sets the transpose of the right singular vectors matrix

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractSingularValueDecomposition

`public AbstractSingularValueDecomposition()`
Default constructor that nulls out all matrices

### AbstractSingularValueDecomposition

```public AbstractSingularValueDecomposition(Matrix U,
Matrix S,
Matrix Vtranspose)```
Creates a new instance of AbstractSingularValueDecomposition where U*S*Vtranspose = original_matrix

Parameters:
`U` - orthonormal matrix of left singular vectors
`S` - PSD diagonal matrix of singular values, sorted in descending order
`Vtranspose` - transpose of the orthonormal matrix of the right singular vectors
Method Detail

### getU

`public Matrix getU()`
Description copied from interface: `SingularValueDecomposition`
Gets the orthonormal matrix containing the left singular vectors of the underlying matrix

Specified by:
`getU` in interface `SingularValueDecomposition`
Returns:
U

### setU

`protected void setU(Matrix U)`
setter for left singular vectors

Parameters:
`U` - left singular vectors

### getS

`public Matrix getS()`
Description copied from interface: `SingularValueDecomposition`
Gets the PSD diagonal matrix containing the sorted singular values

Specified by:
`getS` in interface `SingularValueDecomposition`
Returns:
S

### setS

`protected void setS(Matrix S)`
setter for the singular values matrix

Parameters:
`S` - singular values matrix

### getVtranspose

`public Matrix getVtranspose()`
Description copied from interface: `SingularValueDecomposition`
Gets the transpose of the orthonormal matrix containing the right singular vectors of the underlying matrix

Specified by:
`getVtranspose` in interface `SingularValueDecomposition`
Returns:
Vtranspose

### setVtranspose

`protected void setVtranspose(Matrix Vtranspose)`
sets the transpose of the right singular vectors matrix

Parameters:
`Vtranspose` - transpose of the right singular vectors matrix

### norm2

`public double norm2()`
Description copied from interface: `SingularValueDecomposition`
Returns the associated 2-norm (spectral norm) of the underlying matrix, which is simply the largest singular value

Specified by:
`norm2` in interface `SingularValueDecomposition`
Returns:
Largest singular value on the interval [0.0, inf)

### conditionNumber

`public double conditionNumber()`
Description copied from interface: `SingularValueDecomposition`
Returns the condition number of the underlying matrix, which is simply the ratio of the largest to smallest singular value

Specified by:
`conditionNumber` in interface `SingularValueDecomposition`
Returns:
Condition number on the interval [1.0, inf]

### rank

`public int rank()`
Description copied from interface: `SingularValueDecomposition`
Returns the rank of the underlying matrix by calling this.effectiveRank with an effectiveZero = 0.0

Specified by:
`rank` in interface `SingularValueDecomposition`
Returns:
rank of the underlying matrix

### effectiveRank

`public int effectiveRank(double effectiveZero)`
Description copied from interface: `SingularValueDecomposition`
Returns the effective rank of the underlying matrix by counting the number of singular values whose values are larger than effectiveZero

Specified by:
`effectiveRank` in interface `SingularValueDecomposition`
Parameters:
`effectiveZero` - threshold for considering a singular value to be zero
Returns:
effective rank of the underlying matrix

### pseudoInverse

`public Matrix pseudoInverse()`
Description copied from interface: `SingularValueDecomposition`
Computes the Least Squares pseudoinverse of the underlying matrix

Specified by:
`pseudoInverse` in interface `SingularValueDecomposition`
Returns:
pseudoinverse of the underlying matrix: V * pinv(S) * U'

### pseudoInverse

`public Matrix pseudoInverse(double effectiveZero)`
Description copied from interface: `SingularValueDecomposition`
Computes the Least Squares pseudoinverse of the underlying matrix, while clipping the singular values at effectiveZero

Specified by:
`pseudoInverse` in interface `SingularValueDecomposition`
Parameters:
`effectiveZero` - value below which to consider the singular values zero
Returns:
pseudoinverse of the underlying matrix: V * pinv(S,effectiveZero) * U'