Limited number of eigenvalues and eigenvectors of a symmetric matrix {Rfast}R Documentation

Limited number of eigenvalues and eigenvectors of a symmetric matrix

Description

Limited number of eigenvalues and eigenvectors of a symmetric matrix.

Usage

eigen.sym(A, k, vectors = TRUE)

Arguments

A

A symmetric matrix.

k

The number of eigenvalues and eigenvectors to extract.

vectors

A flag that indicates if the eigenvectors will be returned (default: vectors = True)

Details

The function calls the same function from the Armadillo library in C++. It is quite faster than R's built in function "eigen" if the number of eigenvalues and eigenvectors (argument k) is small.

The k largest, in magnitude, eigenvalues are returned. Hence, if the matrix is not positive definite you may get negative eigenvalues as well. So, it is advised to use it with positive definite matrices.

Value

A list including:

values

The eigenvalues.

vectors

The eigenvectors.

Author(s)

Armadillo library in C++ and Stefanos Fafalios and Manos Papadakis.

R implementation and documentation: Stefanos Fafalios <stefanosfafalios@gmail.com> and Manos Papadakis <papadakm95@gmail.com>.

See Also

hd.eigen

Examples


x <- matrnorm(500, 100 )
s <- Rfast::cova(x)
res<-eigen.sym(s, 5)
x <- s <- NULL


[Package Rfast version 2.1.0 Index]