Skip to Main Content Skip to Search
Product Documentation

svds - Find singular values and vectors

Syntax

s = svds(A)
s = svds(A,k)
s = svds(A,k,sigma)
s = svds(A,k,'L')
s = svds(A,k,sigma,options)
[U,S,V] = svds(A,...)
[U,S,V,flag] = svds(A,...)

Description

s = svds(A) computes the six largest singular values and associated singular vectors of matrix A. If A is m-by-n, svds(A) manipulates eigenvalues and vectors returned by eigs(B), where B = [sparse(m,m) A; A' sparse(n,n)], to find a few singular values and vectors of A. The positive eigenvalues of the symmetric matrix B are the same as the singular values of A.

s = svds(A,k) computes the k largest singular values and associated singular vectors of matrix A.

s = svds(A,k,sigma) computes the k singular values closest to the scalar shift sigma. For example, s = svds(A,k,0) computes the k smallest singular values and associated singular vectors.

s = svds(A,k,'L') computes the k largest singular values (the default).

s = svds(A,k,sigma,options) sets some parameters (see eigs):

Option Structure Fields and Descriptions

Field name

Parameter

Default

options.tol

Convergence tolerance: norm(AV-US,1)<=tol*norm(A,1)

1e-10

options.maxit

Maximum number of iterations

300

options.disp

Number of values displayed each iteration

0

svds checks the accuracy of the computed singular vectors. If the vectors they are not accurate enough returns fewer singular values than requested. To obtain the requested number of singular values, try decreasing the error tolerance in the options structure.

[U,S,V] = svds(A,...) returns three output arguments, and if A is m-by-n:

[U,S,V,flag] = svds(A,...) returns a convergence flag. If eigs converged then norn(A*V-U*S,1) <= tol*norm(A,1) and flag is 0. If eigs did not converge, then flag is 1.

Algorithms

svds(A,k) uses eigs to find the k largest magnitude eigenvalues and corresponding eigenvectors of B = [0 A; A' 0].

svds(A,k,0) uses eigs to find the 2k smallest magnitude eigenvalues and corresponding eigenvectors of B = [0 A; A' 0], and then selects the k positive eigenvalues and their eigenvectors.

Examples

west0479 is a real 479-by-479 sparse matrix. svd calculates all 479 singular values. svds picks out the largest and smallest singular values.

load west0479
s = svd(full(west0479))
sl = svds(west0479,4)
ss = svds(west0479,6,0)

These plots show some of the singular values of west0479 as computed by svd and svds.

The largest singular value of west0479 can be computed a few different ways:

svds(west0479,1) =
 3.189517598808622e+05
max(svd(full(west0479))) =
 3.18951759880862e+05
norm(full(west0479)) =
 3.189517598808623e+05

and estimated:

normest(west0479) =
 3.189385666549991e+05

See Also

eigs | svd

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS