svd#
- swordfish.function.svd()#
Perform the singular decomposition of a matrix.
Given an m-by-n matrix A:
If fullMatrices=true, return an m-by-m matrix U (unitary matrix having left singular vectors as columns), an n-by-n matrix V (unitary matrix having right singular vectors as rows) and a vector s (singular values sorted in descending order) such that A=U*S*V. S is an m-by-n matrix with s as the diagonal elements.
If fullMatrices=false, remove the extra rows or columns of zeros from matrix S, along with the columns/rows in U and V that multiply those zeros in the expression A = U*S*V. Removing these zeros and columns/rows can improve execution time and reduce storage requirements without compromising the accuracy of the decomposition. The resulting matrix U is m-by-k, matrix V is k-by-n and matrix S is k-by-k with k=min(m,n).
If computeUV=false, only return vector s.