I need to compute the n smallest magnitude eigen vectors of a very large sparse symmetric matrix in a C++ program. For my example, lets say n=30 and the matrix is 10k by 10k with about 70k non-zero values.
Upon a lot of research and experimenting with some libraries I found that ARPACK++ would probably be my best bet, I installed it following the steps in this page.
The computation is made with the following snippet:
// L is an Eigen library matrix
L.makeCompressed();
ARluSymMatrix<MTYPE> A(L.cols(), L.nonZeros(), L.valuePtr(), L.innerIndexPtr(), L.outerIndexPtr(), 'U');
ARluSymStdEig<MTYPE> eig(n, A, "SM");
TIC
eig.FindEigenvectors();
TOC
which gets me the correct result but takes about 8.5 seconds, whereas in Matlab I can get the same result in about 0.5 seconds simply by calling
tic
[V,D] = eigs(L,30,'sm');
toc
From my reasearch on the topic Matlab eigs()
also calls the ARPACK fortran libs for the same computations so I don't understand why is the C++ wrapper so much slower.
Also ARPACK++ behaves very strangely in many situations such as when I try to use floats instead of doubles the program will simply stop and do nothing till I take it down, or when trying to compute the eigenvectors around a value like 0 or 0.0001, which should be equivalent to 'SM', it simply spits out garbage and crashes.
Therefore my doubt is if ARPACK++ is really that slow or all of these are symptoms of some bad configuration/installation and if so what can I do to solve it. Thanks for any help you can provide.