svds

A few singular values and vectors of a matrix, typically a large sparse one.

Category: Mathematics > Linear Algebra

Syntax

s = svds(A)

Returns the 6 largest singular values.

s = svds(A, k)

Returns the k largest singular values.

s = svds(A, k, sigma)

Returns k values selected by sigma: 'largest', 'smallest', or the ones closest to a number.

[U, S, V] = svds(___)

Also returns the corresponding singular vectors.

Description

For big matrices a full svd is wasteful when only the dominant part of the spectrum matters. svds computes just the requested subset, which is what low-rank approximation and principal component methods need.

If k is at least min(size(A)) there is no saving, and svd is the better call.

Input arguments

A
Numeric matrix, dense or sparse.
k
Number of singular values wanted. Default 6.
sigma
'largest' (default), 'smallest', or a scalar target.

Output arguments

s
Column vector of the requested singular values.
U, S, V
Singular vectors (m-by-k, n-by-k) and the diagonal k-by-k matrix of values.

Example

Largest and smallest

A = diag(1:10);
svds(A, 3)
svds(A, 2, 'smallest')
Output
ans = 3×1

    10
     9
     8
ans = 2×1

     2
     1

See also

svd eigs svdsketch norm