Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

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

[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.

Algorithm

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.

Example

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

svd, eigs

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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