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

EigenSolver hangs too

Tags: None
(comma "," separated)
Henry.H
Registered Member
Posts
4
Karma
0

EigenSolver hangs too

Mon Aug 19, 2013 9:05 am
:| Hello
this is my env:
windows7_32bit+vs2008

I want to get the largest and second-largest eigenvalues
when I use EigenSolver to solver a matrix(size is 1000*1000),1hours later ,the programe still executing EigenSolver this line.

//////////code
MatrixXf big(1000, 1000);
big << *****;
EigenSolver<MatrixXd> ces(big);
//////

i really want to know how to improving my code~if you know plz tell me
mail: currily@163.com
sunnyhsu
Registered Member
Posts
4
Karma
0

Re: EigenSolver hangs too  Topic is solved

Wed Aug 21, 2013 12:01 am
You are solving the problem with dense matrix. 1000x1000 is a relative large dense matrix. So the computing complexity is high. You may try sparse matrix instead. However, this is only applicable when the sparsity of your problem is good enough. And, I am curious about how you feed the such a big matrix will the operator << ...
Henry.H
Registered Member
Posts
4
Karma
0

Re: EigenSolver hangs too

Wed Aug 21, 2013 2:03 am
thanks you
yes, I hava a large dense matrix,
i try to solving it through redsvd(https://code.google.com/p/redsvd/), it can calculate the eigenvalues and eigenvector in rank,and quite fast, but the answer seems deviate from the matlab
" feed the such a big matrix" in fact, I feed it by read value form excel sheet then
big(i, j) = value
= =..
bravegag
Registered Member
Posts
52
Karma
0

Re: EigenSolver hangs too

Thu Aug 22, 2013 5:56 am
You might want to try installing and enabling the Eigen MKL backend, computing the Eigenvalues with MKL ?GEES is a lot faster.

Another idea is to try this alternative approach:
http://www.cs.colorado.edu/~mcbryan/3656.04/mail/61.htm
Here you do:
do N times {
[Q R] = qr(A)
A = R*Q
}
at the end A will contain the approximate eigenvalues in its diagonal. However, this method has some convergence issues. There is a quite fast GPU-based implementation of QR in MAGMA ?GEQP3.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: EigenSolver hangs too

Thu Aug 22, 2013 11:14 am
Make sure you compiled with optimizations ON, and SSE2. On my 5 years old computer, EigenSolver tooks 41s on a random 1000x1000 matrix. If your matrix is symmetric, SelfAdjointEigenSolver will complete in 1 or 2 seconds.

Code: Select all
#include <Eigen/Dense>
#include <iostream>
#include <bench/BenchTimer.h>
using namespace Eigen;
int main(int argc, char **argv) {
  int n = atoi(argv[1]);
  MatrixXd A(n,n);
  A.setRandom();
  BenchTimer t;
  t.start();
  EigenSolver<MatrixXd> eig(A);
  t.stop();
  std::cout << t.value() << "\n";
}
Henry.H
Registered Member
Posts
4
Karma
0

Re: EigenSolver hangs too

Mon Aug 26, 2013 2:02 am
Thank you..
I will try optimizations
this is my env
IDE:vs2008
os:windows7
cpu :Pentium G630 2.70GHz
Henry.H
Registered Member
Posts
4
Karma
0

Re: EigenSolver hangs too

Mon Aug 26, 2013 2:11 am
oh....it work!
when i use release mode instead of debug , only cost 40+s ,Thank you~


Bookmarks



Who is online

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