Generated by DocFX

Class SingularValueDecomposition

Singular Value Decomposition for a rectangular matrix.

Inheritance
System.Object
SingularValueDecomposition
Implements
ISolverMatrixDecomposition<System.Double>
Namespace: ISynergy.Framework.Mathematics.Decompositions
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public sealed class SingularValueDecomposition : ICloneable, ISolverMatrixDecomposition<double>
Remarks

For an m-by-n matrix A with m >= n, the singular value decomposition is an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and an n-by-n orthogonal matrix V so that A = U * S * V'. The singular values, sigma[k] = S[k,k], are ordered so that sigma[0] >= sigma[1] >= ... >= sigma[n-1].

The singular value decomposition always exists, so the constructor will never fail. The matrix condition number and the effective numerical rank can be computed from this decomposition.

WARNING! Please be aware that if A has less rows than columns, it is better to compute the decomposition on the transpose of A and then swap the left and right eigenvectors. If the routine is computed on A directly, the diagonal of singular values may contain one or more zeros. The identity A = U * S * V' may still hold, however. To overcome this problem, pass true to the autoTranspose argument of the class constructor.

This routine computes the economy decomposition of A.

Constructors

View Source

SingularValueDecomposition(Double[,])

Constructs a new singular value decomposition.

Declaration
public SingularValueDecomposition(double[, ] value)
Parameters
Type Name Description
System.Double[,] value

The matrix to be decomposed.

View Source

SingularValueDecomposition(Double[,], Boolean, Boolean)

Constructs a new singular value decomposition.

Declaration
public SingularValueDecomposition(double[, ] value, bool computeLeftSingularVectors, bool computeRightSingularVectors)
Parameters
Type Name Description
System.Double[,] value

The matrix to be decomposed.

System.Boolean computeLeftSingularVectors

Pass true if the left singular vector matrix U should be computed. Pass false otherwise. Default is true.

System.Boolean computeRightSingularVectors

Pass true if the right singular vector matrix V should be computed. Pass false otherwise. Default is true.

View Source

SingularValueDecomposition(Double[,], Boolean, Boolean, Boolean)

Constructs a new singular value decomposition.

Declaration
public SingularValueDecomposition(double[, ] value, bool computeLeftSingularVectors, bool computeRightSingularVectors, bool autoTranspose)
Parameters
Type Name Description
System.Double[,] value

The matrix to be decomposed.

System.Boolean computeLeftSingularVectors

Pass true if the left singular vector matrix U should be computed. Pass false otherwise. Default is true.

System.Boolean computeRightSingularVectors

Pass true if the right singular vector matrix V should be computed. Pass false otherwise. Default is true.

System.Boolean autoTranspose

Pass true to automatically transpose the value matrix in case JAMA's assumptions about the dimensionality of the matrix are violated. Pass false otherwise. Default is false.

View Source

SingularValueDecomposition(Double[,], Boolean, Boolean, Boolean, Boolean)

Constructs a new singular value decomposition.

Declaration
public SingularValueDecomposition(double[, ] value, bool computeLeftSingularVectors, bool computeRightSingularVectors, bool autoTranspose, bool inPlace)
Parameters
Type Name Description
System.Double[,] value

The matrix to be decomposed.

System.Boolean computeLeftSingularVectors

Pass true if the left singular vector matrix U should be computed. Pass false otherwise. Default is true.

System.Boolean computeRightSingularVectors

Pass true if the right singular vector matrix V should be computed. Pass false otherwise. Default is true.

System.Boolean autoTranspose

Pass true to automatically transpose the value matrix in case JAMA's assumptions about the dimensionality of the matrix are violated. Pass false otherwise. Default is false.

System.Boolean inPlace

Pass true to perform the decomposition in place. The matrix value will be destroyed in the process, resulting in less memory comsumption.

Properties

View Source

AbsoluteDeterminant

Returns the absolute value of the matrix determinant.

Declaration
public double AbsoluteDeterminant { get; }
Property Value
Type Description
System.Double
View Source

Condition

Returns the condition number max(S) / min(S).

Declaration
public double Condition { get; }
Property Value
Type Description
System.Double
View Source

Diagonal

Gets the one-dimensional array of singular values.

Declaration
public double[] Diagonal { get; }
Property Value
Type Description
System.Double[]
View Source

DiagonalMatrix

Returns the block diagonal matrix of singular values.

Declaration
public double[, ] DiagonalMatrix { get; }
Property Value
Type Description
System.Double[,]
View Source

IsSingular

Gets whether the decomposed matrix is singular.

Declaration
public bool IsSingular { get; }
Property Value
Type Description
System.Boolean
View Source

LeftSingularVectors

Returns the U matrix of Singular Vectors.

Declaration
public double[, ] LeftSingularVectors { get; }
Property Value
Type Description
System.Double[,]
View Source

LogDeterminant

Returns the log of the absolute value for the matrix determinant.

Declaration
public double LogDeterminant { get; }
Property Value
Type Description
System.Double
View Source

LogPseudoDeterminant

Returns the log of the pseudo-determinant for the matrix.

Declaration
public double LogPseudoDeterminant { get; }
Property Value
Type Description
System.Double
View Source

Ordering

Returns the ordering in which the singular values have been sorted.

Declaration
public int[] Ordering { get; }
Property Value
Type Description
System.Int32[]
View Source

PseudoDeterminant

Returns the pseudo-determinant for the matrix.

Declaration
public double PseudoDeterminant { get; }
Property Value
Type Description
System.Double
View Source

Rank

Returns the effective numerical matrix rank.

Declaration
public int Rank { get; }
Property Value
Type Description
System.Int32

Number of non-negligible singular values.

View Source

RightSingularVectors

Returns the V matrix of Singular Vectors.

Declaration
public double[, ] RightSingularVectors { get; }
Property Value
Type Description
System.Double[,]
View Source

Threshold

Returns the singularity threshold.

Declaration
public double Threshold { get; }
Property Value
Type Description
System.Double
View Source

TwoNorm

Returns the Two norm.

Declaration
public double TwoNorm { get; }
Property Value
Type Description
System.Double

Methods

View Source

Clone()

Creates a new object that is a copy of the current instance.

Declaration
public object Clone()
Returns
Type Description
System.Object

A new object that is a copy of this instance.

View Source

GetInformationMatrix()

Computes (Xt * X)^1 (the inverse of the covariance matrix). This matrix can be used to determine standard errors for the coefficients when solving a linear set of equations through any of the methods.

Declaration
public double[, ] GetInformationMatrix()
Returns
Type Description
System.Double[,]
View Source

Inverse()

Computes the (pseudo-)inverse of the matrix given to the Singular value decomposition.

Declaration
public double[, ] Inverse()
Returns
Type Description
System.Double[,]
View Source

Reverse()

Reverses the decomposition, reconstructing the original matrix X.

Declaration
public double[, ] Reverse()
Returns
Type Description
System.Double[,]
View Source

Solve(Double[])

Solves a linear equation system of the form Ax = b.

Declaration
public double[] Solve(double[] value)
Parameters
Type Name Description
System.Double[] value

The b from the equation Ax = b.

Returns
Type Description
System.Double[]

The x from equation Ax = b.

View Source

Solve(Double[,])

Solves a linear equation system of the form AX = B.

Declaration
public double[, ] Solve(double[, ] value)
Parameters
Type Name Description
System.Double[,] value

Parameter B from the equation AX = B.

Returns
Type Description
System.Double[,]

The solution X from equation AX = B.

View Source

SolveForDiagonal(Double[])

Solves a linear equation system of the form AX = B.

Declaration
public double[, ] SolveForDiagonal(double[] value)
Parameters
Type Name Description
System.Double[] value

Parameter B from the equation AX = B.

Returns
Type Description
System.Double[,]

The solution X from equation AX = B.

View Source

SolveTranspose(Double[])

Solves a linear equation system of the form xA = b.

Declaration
public double[] SolveTranspose(double[] value)
Parameters
Type Name Description
System.Double[] value

The b from the equation xA = b.

Returns
Type Description
System.Double[]

The x from equation Ax = b.

View Source

SolveTranspose(Double[,])

Solves a linear equation system of the form AX = B.

Declaration
public double[, ] SolveTranspose(double[, ] value)
Parameters
Type Name Description
System.Double[,] value

Parameter B from the equation AX = B.

Returns
Type Description
System.Double[,]

The solution X from equation AX = B.

Implements

ISolverMatrixDecomposition<T>

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)