IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Meta.Numerics.Matrices.SingularValueDecomposition Class Reference

Stores the singular value decomposition of a matrix. More...

Public Member Functions

SquareMatrix LeftTransformMatrix ()
 Returns the left transform matrix. More...
 
SquareMatrix RightTransformMatrix ()
 Returns the right transform matrix. More...
 
double SingularValue (int n)
 Gets the specificed singular value. More...
 
ColumnVector LeftSingularVector (int n)
 Returns the specified left singular vector. More...
 
ColumnVector RightSingularVector (int n)
 Returns the specified right singular vector. More...
 

Properties

int RowCount [get]
 Gets the number of rows in the original matrix. More...
 
int ColumnCount [get]
 Gets the number of columns in the original matrix. More...
 
int Dimension [get]
 Gets the number of singular values. More...
 
double ConditionNumber [get]
 Returns the condition number of the matrix. More...
 
double Tolerance [get, set]
 Gets or sets the tolerance with which singular values are distinguished from zero. More...
 
int Rank [get]
 Computes the rank of the original matrix. More...
 

Private Attributes

readonly int rows
 
readonly int cols
 
readonly double[] utStore
 
readonly double[] wStore
 
readonly double[] vStore
 
double tolerance = Global.Accuracy
 

Detailed Description

Stores the singular value decomposition of a matrix.

The singular value decomposition of a matrix represents it as a product of a left orthogonal matrix, a diagonal matrix, and a right orthogonal matrix:

The elements of the diagonal matrix are called the singular values of the original matrix.

If the orginal matrix is viewed as a linear transform operator, the rows of the right orthogonal matrix matrix form an orthonormal basis for the domain of the operator, while the columns of the left orthogonal matrix form an orthonormal basis for the range of the operator. These rows and columns are called, respectively, the right and left singular vectors of the matrix.

The right singular vectors corresponding to zero singular values span the nullspace of the matrix, that is the set of all x for which Ax = 0.

The SVD can be used to approximate the action of a high-dimensional matrix by a lower-rank one.

Use the RectangularMatrix.SingularValueDecomposition of the RectangularMatrix class to obtain the SVD of an rectangular matrix, or the corresponding SquareMatrix.SingularValueDecomposition method of the SquareMatrix class to obtain the SVD of a square matrix.

Member Function Documentation

SquareMatrix Meta.Numerics.Matrices.SingularValueDecomposition.LeftTransformMatrix ( )
inline
SquareMatrix Meta.Numerics.Matrices.SingularValueDecomposition.RightTransformMatrix ( )
inline

Returns the right transform matrix.

Returns
The matrix V, such that A = U S VT.

The returned matrix is read-only. If you need to make changes to it, you can call SquareMatrix.Copy to obtain a writable copy.

Referenced by Test.SquareMatrixTest.HilbertMatrixSVD(), Test.RectangularMatrixTest.PC(), Test.RectangularMatrixTest.RandomRectangularSVD(), and Test.RectangularMatrixTest.SmallSVD().

double Meta.Numerics.Matrices.SingularValueDecomposition.SingularValue ( int  n)
inline

Gets the specificed singular value.

Parameters
nThe (zero-based) index.
Returns
The n th singular value.
Exceptions
ArgumentOutOfRangeExceptionn lies outside the range [0, Dimension - 1].

Referenced by Test.SquareMatrixTest.HilbertMatrixSVD(), Test.RectangularMatrixTest.PC(), Test.RectangularMatrixTest.RandomRectangularSVD(), Test.RectangularMatrixTest.SmallSVD(), and Test.SquareMatrixTest.SvdOfRankOneMatrix().

ColumnVector Meta.Numerics.Matrices.SingularValueDecomposition.LeftSingularVector ( int  n)
inline

Returns the specified left singular vector.

Parameters
nThe (zero-based) index.
Returns
The n th left singular vector.
Exceptions
ArgumentOutOfRangeExceptionn lies outside the range [0, Dimension - 1].

The returned vector is read-only. If you need to make changes to it, you can call ColumnVector.Copy to obtain a writable copy.

Referenced by Test.RectangularMatrixTest.RandomRectangularSVD().

ColumnVector Meta.Numerics.Matrices.SingularValueDecomposition.RightSingularVector ( int  n)
inline

Returns the specified right singular vector.

Parameters
nThe (zero-based) index.
Returns
The n th right singular vector.
Exceptions
ArgumentOutOfRangeExceptionn lies outside the range [0, Dimension - 1].

The returned vector is read-only. If you need to make changes to it, you can call ColumnVector.Copy to obtain a writable copy.

Referenced by Test.RectangularMatrixTest.PC(), and Test.RectangularMatrixTest.RandomRectangularSVD().

Member Data Documentation

readonly int Meta.Numerics.Matrices.SingularValueDecomposition.rows
private
readonly int Meta.Numerics.Matrices.SingularValueDecomposition.cols
private
readonly double [] Meta.Numerics.Matrices.SingularValueDecomposition.utStore
private
readonly double [] Meta.Numerics.Matrices.SingularValueDecomposition.wStore
private
readonly double [] Meta.Numerics.Matrices.SingularValueDecomposition.vStore
private
double Meta.Numerics.Matrices.SingularValueDecomposition.tolerance = Global.Accuracy
private

Property Documentation

int Meta.Numerics.Matrices.SingularValueDecomposition.RowCount
get

Gets the number of rows in the original matrix.

Referenced by Test.RectangularMatrixTest.RandomRectangularSVD().

int Meta.Numerics.Matrices.SingularValueDecomposition.ColumnCount
get

Gets the number of columns in the original matrix.

Referenced by Test.RectangularMatrixTest.RandomRectangularSVD().

int Meta.Numerics.Matrices.SingularValueDecomposition.Dimension
get

Gets the number of singular values.

For a square matrix, the number of singular values is equal to the dimension of the matrix. For a rectangular matrix with more rows than columns, the number of singular values is equal to the number of columns.

Referenced by Test.SquareMatrixTest.HilbertMatrixSVD(), Test.RectangularMatrixTest.PC(), Test.RectangularMatrixTest.RandomRectangularSVD(), Test.RectangularMatrixTest.SmallSVD(), and Test.SquareMatrixTest.SvdOfRankOneMatrix().

double Meta.Numerics.Matrices.SingularValueDecomposition.ConditionNumber
get

Returns the condition number of the matrix.

The conidition number is the ratio of the largest singular value to smallest singular value. It is therefore always larger than one.

double Meta.Numerics.Matrices.SingularValueDecomposition.Tolerance
getset

Gets or sets the tolerance with which singular values are distinguished from zero.

Some operations offered by singular value decompositions, including rank determination and computation of the pseudo-inverse matrix, depend on determining whether or not a singular value is zero. Since floating point numbers are only approximate representations of real numbers, singular values will usually not be exactly zero even for matrices for which they should be, but will instead be very tiny numbers, on the order of floating point precision (about 10-16) as a fraction of the largest singular value. The value of this property is used to determine how small a singular value must be, as a fraction of the largest singular value, to be considered zero for these purposes. Usually you will want to maintain its default value.

Exceptions
ArgumentOutOfRangeExceptionThe assigned value is outside the range [0,1).
int Meta.Numerics.Matrices.SingularValueDecomposition.Rank
get

Computes the rank of the original matrix.

The rank of a matrix is the dimension of the space of input vectors which produce non-zero output vectors upon multiplication by the original matrix.

Since this operation depends on identifying zero singular values, the result will depend on the value of the Tolerance property.


The documentation for this class was generated from the following file: