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

eigen and sparse symmetric eigenvalue problem

Tags: None
(comma "," separated)
User avatar
bjacob
Registered Member
Posts
658
Karma
3
very surprising to see gcc 4.4 slower than 4.1 with both flens and eigen here. It might just be that you pass too aggressive oflags. Just -O2, no -f..., should be enough.

we already use a packed storage, but being cache friendly is more than that, it requires to use block Householder transformations so we do level 3 operations instead of level 2. as you can see, that's in our todo for 3.0 beta1.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
sweber
Registered Member
Posts
17
Karma
0
The first numbers were done on our cluster where only gcc 4.1.2 is installed, while the last numbers are done on my laptop with the newest gcc 4.4.1. My laptop is of course a little slower than the xeons we have in the cluster.

Nevertheless, MKL outperforms Eigen which is a pitty, I was so happy to just extract Eigen and thats it, no more installation...

Sebastian
User avatar
bjacob
Registered Member
Posts
658
Karma
3
yes, again, the reason for that is well understood and part of our todo.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Eeth
Registered Member
Posts
2
Karma
0
Any news here?
Is there an Eigensolver for Sprase Matrices available in the current Dev. Version? If yes: Could you provide an example code?

Thx alot,

Eeth
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
nope, nothing yet.
Eeth
Registered Member
Posts
2
Karma
0
You have any plans? e.g. Release 3.0?

Best..
:)
User avatar
schizofrenikh
Registered Member
Posts
3
Karma
0
OS
ggael wrote:For dense symmetric matrices, now Eigen has quite good performances.

But here you are interested in sparse matrices that is very different. So far we don't provide any support for that. So you have to use another lib to do the actual decomposition. BLAS/LAPACK won't help you here because they are for dense objects only. Nevertheless you can still assemble your SparseMatrix using Eigen's API, and then send it the other library. Eigen uses a standard storage format so that should not be a problem.

A popular lib for that is SLEPc: http://www.grycap.upv.es/slepc.


I skimmed both the stable and development documentation and didn't find out how to send such matrix to other library e.g. Arpack++(or the mentioned SLEPc). In stable branch there at least were _innerIndexPtr(), _outerIndexPtr () and _valuePtr() functions. While not well documented seemed to be the way to get the data. I was surprised not to see these functions(or any alternatives) in the dev branch. As there is an option to store the data in the needed CSC format how do get the raw data to take advantage?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
these three functions are still there! e.g., line 107 in the SparseMatrix.h file.
User avatar
schizofrenikh
Registered Member
Posts
3
Karma
0
OS
Thanks,
this solves my problem.

I didn't dig the sources as I assumed they're too complicated for me to understand. It would be good to at least mark the functions in the documentation just like in eigen2.
Now I can begin some coding.
User avatar
schizofrenikh
Registered Member
Posts
3
Karma
0
OS
Finally I managed to use ARPACK++ for my problem:
Code: Select all
#include <arpack++/arssym.h>
#include <vector>
#include <eigen2/Eigen/Eigen>

class TMatrixForArpackpp {
private:
    Eigen::SparseMatrix< double > &M;
public:
    TMatrixForArpackpp( Eigen::SparseMatrix< double > &_M ) :
        M(_M) {
        ;
    };
    void MultMv( double *v, double *w ) {
        Eigen::Map< Eigen::VectorXd > v_map = Eigen::VectorXd::Map( v, M.rows() );
        Eigen::Map< Eigen::VectorXd > w_map = Eigen::VectorXd::Map( w, M.cols() );
        w_map = M.marked<Eigen::SelfAdjoint|Eigen::LowerTriangular>()*v_map;
    }
};


void Lanczos_symm( Eigen::SparseMatrix< double > &M, std::vector< double > &eigenValues, std::vector< Eigen::VectorXd > &eigenVectors ) {
    int n = M.cols();
    TMatrixForArpackpp M_arp( M );
    ARSymStdEig< double, TMatrixForArpackpp > prob( n, n-1, &M_arp, &TMatrixForArpackpp::MultMv, "SM" ); //"SM" to get smallest eigenvalues
    prob.FindEigenvectors();
    //prob.FindEigenvalues();
    int m = prob.ConvergedEigenvalues();
    eigenValues.resize(m);
    eigenVectors.resize(m);
    eigenValues.assign( prob.RawEigenvalues(), prob.RawEigenvalues()+m );
    for( int i=0; i<m; i++ )
        eigenVectors[i] = Eigen::VectorXd::Map( prob.RawEigenvector(i), n);
    /*eigenValues = *( prob.StlEigenvalues() );
    eigenVectors = *( prob.StlEigenvectors() );*/
}

To compile with arpack on my debian system I had to add
Code: Select all
-lblas -lgfortran -lgfortranbegin -lnsl -larpack -larpack++

to g++ command line while linking.

The code above is far from being reusable but for now I just need one type of matrix to deal with. I hope it will save others the effort I had to put to find out how to get this working.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
many thanks for sharing this.
erickb
Registered Member
Posts
1
Karma
0
giving this thread a bump -- can we humble and appreciative users expect a sparse matrix eigenvalue/eigenvector method anytime in the near future?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
No concrete plan yet.
berthou
Registered Member
Posts
1
Karma
0
OS
Hello,

I would like to know if it is possible to use Eigen on a cluster of Intel multithreaded processors (sparse matrix also). Is it design to be running on several nodes with multithreading ?. I'm looking for a library which can do that but on the documentation it is not very explicit (mkl, scalapack, slepc).

If not, do you one which could do that ? thanks.

berthou.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Eigen is not designed to exploit a cluster, on the other hand you can use Eigen for the low level operations if you distribute yourself the tasks.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]