This forum has been archived. All content is frozen. Please use KDE Discuss instead.

calculate only first few eigen vectors

Tags: None
(comma "," separated)
rajeshsai
Registered Member
Posts
2
Karma
0
Is there a way to calculate only first few eigen vectors, say first 1o instead of all, which may speed up the computation
germanzorba
Registered Member
Posts
9
Karma
0
If you are dealing with positive definite matrix, then you can try doing, in scilab:

R=chol(X); // so X=R'*R
[U,S,V,rk] = svd(R,tol); // so R=U*S*V' and V*(S^2)*V' aproximates X

This way S^2 is diagonal, with rk nonzero elements, which are the eigenvalues of X greater than tol^2.

I'm not sure if this is fast or not, but it is worth a try. You can't control the number of eigenvalues calculated, but you are getting the bigger ones.
rajeshsai
Registered Member
Posts
2
Karma
0
I'm right now programming in c++ using eigen library, I want to calculate first few eigen vectors for a matrix of size 2500x2500 and is pretting slow
is there a way doing this using this library in c++.Thanks in advance!
dimitr
Registered Member
Posts
6
Karma
0
I don't think this is possible. There is only an option to calculate eigenvectors or not.
I used MKL/LAPACK for a similar case where I needed only the first (minimum) eigenvalue.
ftusell
Registered Member
Posts
4
Karma
0
With a little programming, you might implement the power method: repeatedly multiplying
an arbitrary vector by your matrix A and normalizing the result will get you the largest eigenvalue
lambda1 (and associated eigenvector v1). Replacing A by A - lambda1*v1*v1' and using the
same procedure will get you the second, etc.

Easy to program and will be much faster if you only need a few eigenvectors/eigenvalues.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Have a look at this thread for a starting code for the power method: viewtopic.php?f=74&t=108033
dharmon
Registered Member
Posts
6
Karma
0
You can use the ARPACK wrapper in Eigen/unsupported. It works with dense
matrices as well, and lets you compute the first k eigenvalues/vectors.

You'll need ARPACK installed on your system.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]