mgs#

AnsMath.mgs(mat, thresh='', **kwargs)#

Apply the Modified Gram-Schmidt (MGS) algorithm to a matrix.

The MGS 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 algorithm.

Parameters:
matAnsMat

Array to apply the Modified Gram-Schmidt algorithm to.

threshfloat, optional

Numerical threshold value for managing the compression. For the MGS algorithm, the default value is 1E-14.

Examples

Apply the MGS algorithm on an existing dense rectangular matrix, using the default threshold. The AnsMath matrix is modified in-situ.

>>> mm.mgs(mat)