Skip to contents

DashSVD for fast randomized SVD

Usage

# S4 method for class 'ResidualMatrixGLM'
dashSVD(x, k, p = 3, s = 20, rand = 1, byrow = TRUE, verbose = TRUE)

Arguments

x

data matrix of class ResidualMatrixGLM

k

specifies the target rank of the low-rank decomposition. \(k\) should satisfy \(k << min(m,n)\).

p

number of additional power iterations (by default \(p=7\)).

s

oversampling parameter (by default \(s=20\)).

rand

randomization method. 1 indicates Gaussian sampling and 2 indicates uniform sampling

byrow

default TRUE. Set to true if accessing rows is faster that accessing columns

verbose

print messages

Value

PCA class storing d, u and v

References

Feng, X., Yu, W., Xie, Y. and Tang, J., 2024. Algorithm 1043: Faster randomized svd with dynamic shifts. ACM Transactions on Mathematical Software, 50(2), pp.1-27.

Examples

library(GenomicDataStream)
#> 
#> Attaching package: ‘GenomicDataStream’
#> The following object is masked from ‘package:nlme’:
#> 
#>     isInitialized

n <- 2000
m <- 1000
nc <- 2
set.seed(1)
Y <- matrix(rpois(n * m, 100), m, n)
X <- matrix(rnorm(n * nc), n, nc)
X <- cbind(1, X) # intercept term

# fit Poisson model on each response
fit <- glmFitResponses(Y, X, "poisson")

# Out-of-core residuals
res <- ResidualMatrixGLM(Y, X, fit = fit)

# Out-of-core SVD on residuals
dcmp <- dashSVD(res, k = 5) 
#> Initial multiplication...
#>  power iteration 1, alpha=0
#>  power iteration 2, alpha=1405.652
#>  power iteration 3, alpha=1857.051
#> Final multiplication...