Description Usage Arguments Details Author(s) Examples
different methods are automatically selected to calculate svd according to matrix properties, such as missing values, object class, size.
1 2 3 4 5 6 7 8 | svd.solver(
x,
nf,
opts.svd.nipals = list(),
opts.svds = list(),
opts.fast.svd = list(),
opts.svd = list()
)
|
x |
a numeric or complex matrix whose SVD decomposition is to be computed. |
nf |
the number of singular vectors want to computed. This will be ignored if fast.svd or svd function is used. |
opts.svd.nipals |
A list of named parameters passed to |
opts.svds |
A list of named parameters passed to |
opts.fast.svd |
A list of named parameters passed to |
opts.svd |
A list of named parameters passed to |
There are 4 different options could be used:
1. svd.nipals
When there are missing values in the matrix
2. svds
when x is an object of class Matrix
or only a small
number of singular vectors to be calculated (<3)
3. fast.svd
when x is big fat or thin matrix
4. svd
if not any other cases
Chen Meng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | m <- matrix(sample(c(rnorm(1000), rep(0, 999000))), 10000, 100)
decomp <- svd.solver(m)
attr(decomp, "solver")
decomp <- svd.solver(m[1:200, ])
attr(decomp, "solver")
## Not run:
library(Matrix)
ms <- Matrix(m, sparse=TRUE)
decomp <- svd.solver(ms, nf = 2)
attr(decomp, "solver")
mm <- Matrix(m)
decomp <- svd.solver(mm, nf = 2)
attr(decomp, "solver")
mna <- m
mna[sample(1:length(mna), size = 100)] <- NA
decomp <- svd.solver(mna, nf = 2)
attr(decomp, "solver")
mnas <- Matrix(mna, sparse = TRUE)
decomp <- svd.solver(mnas, nf = 2)
attr(decomp, "solver")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.