svd.solver: Singular Value Decomposition of a Matrix

Description Usage Arguments Details Author(s) Examples

View source: R/svd.nipals.R

Description

different methods are automatically selected to calculate svd according to matrix properties, such as missing values, object class, size.

Usage

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()
)

Arguments

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 svd.nipals

opts.svds

A list of named parameters passed to svds

opts.fast.svd

A list of named parameters passed to fast.svd

opts.svd

A list of named parameters passed to svd

Details

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

Author(s)

Chen Meng

Examples

 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)

mengchen18/mogsa documentation built on June 7, 2020, 6:05 p.m.