partial_eigen: Find a few approximate largest eigenvalues and corresponding...

Description Usage Arguments Value Note References See Also Examples

Description

Use partial_eigen to estimate a subset of the largest (most positive) eigenvalues and corresponding eigenvectors of a symmetric dense or sparse real-valued matrix.

Usage

1
partial_eigen(x, n = 5, symmetric = TRUE, ...)

Arguments

x

numeric real-valued dense or sparse matrix.

n

number of largest eigenvalues and corresponding eigenvectors to compute.

symmetric

TRUE indicates x is a symmetric matrix (the default); specify symmetric=FALSE to compute the largest eigenvalues and corresponding eigenvectors of t(x) %*% x instead.

...

optional additional parameters passed to the irlba function.

Value

Returns a list with entries:

Note

Specify symmetric=FALSE to compute the largest n eigenvalues and corresponding eigenvectors of the symmetric matrix cross-product t(x) %*% x.

This function uses the irlba function under the hood. See ?irlba for description of additional options, especially the tol parameter.

See the RSpectra package https://cran.r-project.org/package=RSpectra for more comprehensive partial eigenvalue decomposition.

References

Augmented Implicitly Restarted Lanczos Bidiagonalization Methods, J. Baglama and L. Reichel, SIAM J. Sci. Comput. 2005.

See Also

eigen, irlba

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(1)
# Construct a symmetric matrix with some positive and negative eigenvalues:
V <- qr.Q(qr(matrix(runif(100), nrow=10)))
x <- V %*% diag(c(10, -9, 8, -7, 6, -5, 4, -3, 2, -1)) %*% t(V)
partial_eigen(x, 3)$values

# Compare with eigen
eigen(x)$values[1:3]

# Use symmetric=FALSE to compute the eigenvalues of t(x) %*% x for general
# matrices x:
x <- matrix(rnorm(100), 10)
partial_eigen(x, 3, symmetric=FALSE)$values
eigen(crossprod(x))$values

irlba documentation built on May 1, 2019, 10:18 p.m.