Wrapper Function to Perform SVD

Share:

Description

Performs SVD on a data matrix using the base svd() function in R, with a workaround to avoid LAPACK errors. If an SVD of the data matrix gives an error, an SVD of its transpose will be performed. Used internally when computing the JIVE decomposition. Credit to Art Owen: https://stat.ethz.ch/pipermail/r-help/2007-October/143508.html.

Usage

1
svdwrapper(x, nu, nv, verbose=F )

Arguments

x

a numeric matrix whos SVD decomposition is to be computed.

nu

the number of left singular vectors to be computed.

nv

the number of right singular vectors to be computed.

verbose

logical. Print error message if needed.

Value

An svd object, as returned by svd(x,nu=nu,nv=nv).

Author(s)

Michael J. O'Connell and Eric F. Lock

Examples

1
2
x<-matrix(rnorm(100),nrow=10,ncol=10)
SVD = svdwrapper(x,nu=1,nv=1)