Limited number of eigenvalues and eigenvectors of a symmetric matrix | R Documentation |
Limited number of eigenvalues and eigenvectors of a symmetric matrix.
eigen.sym(A, k, vectors = TRUE)
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) |
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.
A list including:
values |
The eigenvalues. |
vectors |
The eigenvectors. |
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>.
hd.eigen
x <- matrnorm(500, 100 )
s <- Rfast::cova(x)
res<-eigen.sym(s, 5)
x <- s <- NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.