svd

fun Matrix.svd(fullMatrix: Boolean = true): Triple<Matrix, Matrix, Matrix>(source)

Computes the Singular Value Decomposition (SVD) of this matrix.

For a matrix A of dimensions m x n, the SVD factors A into: A = U * S * V^T

where:

  • U is an orthogonal matrix containing the left singular vectors:

  • If fullMatrix is true, U is m x m.

  • If fullMatrix is false, U is m x k, where k = min(m, n).

  • S contains the singular values in descending order:

  • If fullMatrix is true, S is an m x n diagonal matrix.

  • If fullMatrix is false, S is a 1 x k matrix containing the singular values.

  • V is an orthogonal matrix containing the right singular vectors:

  • If fullMatrix is true, V is n x n.

  • If fullMatrix is false, V is n x k, where k = min(m, n).

Return

A Triple containing (U, S, V) such that this matrix is equal to U * S * V.transposed().

Parameters

fullMatrix

If true, full matrices U and V and diagonal matrix S are computed. If false, reduced (economy size) matrices are computed.