svdsketch
Low-rank SVD approximation chosen automatically to meet a tolerance.
Category: Mathematics > Linear Algebra
Syntax
[U, S, V] = svdsketch(A)
Returns a truncated SVD whose rank is picked to reach the default tolerance sqrt(eps).
[U, S, V] = svdsketch(A, tol)
Uses the relative tolerance tol for norm(U*S*V' - A, 'fro')/norm(A, 'fro').
Description
You do not give the rank. The function grows the approximation until the relative error is below the tolerance, so a matrix with fast-decaying singular values yields a small k, and a loose tolerance yields an even smaller one.
It is intended for large matrices where an approximate answer is enough and a full svd is too costly.
Input arguments
A- Numeric matrix.
tol- Relative approximation tolerance, a scalar in
(0, 1).
Output arguments
U, S, V- Factors of the approximation
A ~ U*S*V', with the same numberkof columns inUandV, andSak-by-kdiagonal matrix.
Example
Rank chosen by tolerance
A = magic(4);
[U, S, V] = svdsketch(A);
size(S)
norm(U*S*V' - A) < 1e-6
Output
ans = 1×2
3 3
ans = logical
1