Description Usage Arguments Details Value Author(s) See Also Examples
This function is a simple wrapper of the svds()
function in the RSpectra package. Also see the documentation there.
Given an m by n matrix A,
function svds()
can find its largest k
singular values and the corresponding singular vectors.
It is also called the Truncated Singular Value Decomposition
since it only contains a subset of the whole singular triplets.
Currently svds()
supports matrices of the following classes:
matrix | The most commonly used matrix type, defined in base package. |
dgeMatrix | General matrix, equivalent to matrix ,
defined in Matrix package. |
dgCMatrix | Column oriented sparse matrix, defined in Matrix package. |
dgRMatrix | Row oriented sparse matrix, defined in Matrix package. |
dsyMatrix | Symmetrix matrix, defined in Matrix package. |
Note that when A is symmetric,
SVD reduces to eigen decomposition, so you may consider using
eigs()
instead.
1 |
A |
The matrix whose truncated SVD is to be computed. |
k |
Number of singular values requested. |
nu |
Number of left singular vectors to be computed. This must
be between 0 and |
nv |
Number of right singular vectors to be computed. This must
be between 0 and |
opts |
Control parameters related to the computing algorithm. See Details below. |
... |
Currently not used. |
The opts
argument is a list that can supply any of the
following parameters:
ncv
Number of Lanzcos basis vectors to use. More vectors
will result in faster convergence, but with greater
memory use. ncv
must be satisfy
k < ncv <= p where
p = min(m, n)
.
Default is min(p, max(2*k+1, 20))
.
tol
Precision parameter. Default is 1e-10.
maxitr
Maximum number of iterations. Default is 1000.
A list with the following components:
d |
A vector of the computed singular values. |
u |
An |
v |
An |
nconv |
Number of converged singular values. |
niter |
Number of iterations used. |
nops |
Number of matrix-vector multiplications used. |
Yixuan Qiu <http://statr.me>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.