spaMM (version 2.2.0)

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.

Usage

sym_eigen(X)

Arguments

X

A symmetric matrix (possibly in sparseMatrix format).

Value

A list with members u (matrix of eigenvectors) and d (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$u %*% diag(s$d) %*% t(s$u) - X) # X=U D U'
# }

Run the code above in your browser using DataCamp Workspace