svd#

AnsMath.svd(mat, thresh='', sig='', v='', **kwargs)#

Apply an SVD algorithm on a matrix.

The SVD algorithm is only applicable to dense matrices. Columns that are linearly dependent on others are removed, leaving the independent or basis vectors. The matrix is resized according to the new size determined by the SVD algorithm.

For the SVD algorithm, the singular value decomposition of an input matrix is a factorization of the form:

M = U*SIGMA*V.T

For more information, see Singular Value Decomposition.

Parameters:
matAnsMat

Array to compress.

threshfloat, optional

Numerical threshold value for managing the compression. The default is is 1E-7.

sigstr, optional

Name of the vector for storing the SIGMA values.

vstr, optional

Name of the vector for storing the values from v. See the preceding equation.

Examples

Apply the SVD algorithm on an existing dense rectangular matrix, using the default threshold. The matrix is modified in-place.

>>> mm.svd(mat)