spaMM (version 3.1.2)

sym_eigen: Singular Value Decomposition of a Symmetric Matrix

Description

Computes the symmetric eigenvalue decomposition of a symmetric matrix, \(X=U.D.U'\), where \(U\) is a matrix of orthogonal eigenvectors and \(D\) is a diagonal matrix of eigenvalues. The result is similar to that of eigen(.,symmetric=TRUE) but its evaluation uses the SelfAdjointEigenSolver function from the Eigen C++ library. No symmetry check is performed.

This function was introduced to circumvent a bug in LAPACK (bug 113 in http://www.netlib.org/lapack/bug_list.html; originally https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15211). However, this bug has been fixed, and sym_eigen may be less accurate than the LAPACK one. It is no longer used is spaMM with default options (only the superseded function designL.from.Corr) may still call it). The structure of its return value was changed in spaMM version 2.4.123.

Usage

sym_eigen(X)

Arguments

X

A symmetric matrix (possibly in sparseMatrix format).

Value

A list with members vectors (matrix of eigenvectors) and values (vector of eigenvalues).

Examples

Run this code
# NOT RUN {
 hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
 X <- hilbert(9)
 s <- sym_eigen(X)
 range(s$vectors %*% diag(s$values) %*% t(s$vectors) - X) # X=U D U'
# }

Run the code above in your browser using DataLab