# Efficient Eigen Solver

I am working on a flow physics problem (2D), which ultimately boils down to solving Eigen value problem. Even for a grid size of 60 x 60, the matrix in the Eigen value problem end up with 1260 million elements (This matrix has to be solved iteratively!). Sometimes the matrix is sparse and other times it is not depending on the nature of problem to be solved.

I use ARPACK written in Fortran to solve the problem. Surprisingly, MATLAB solves the same Eigen value problems at least 5 times faster than the Fortran counterpart. (And I wonder how!)

My question is : Are there any techniques that is known in the computation community to speed up the Eigen solver?

Parallel-ized ARPACK is one solution that I tried, but still not up to the level of MATLAB

• You did not say whether you are trying to calculate a few of the smallest, largest, or other subset of the eigenvalues of your matrix? (If you are trying to calculate all eigenvalues for such a large matrix, my suggestion would be to look for a different solution approach.) The eigs function in MATLAB uses arpack so you should be able to duplicate its performance by calling arpack directly. – Bill Greene Dec 20 '16 at 13:54
• @BillGreene : Now, that you asked this, I thought about it and I realised that I need only the set of smallest eigen values and corresponding eigen vectors. Also, I would like add that my matrix is Complex(data type) – Rhinocerotidae Dec 20 '16 at 14:31
• It's likely that MATLAB is using a more efficient matrix-vector multiplication than you are. In particular, if your computer has multiple processor cores, MATLAB might be doing the matrix-vector multiplications in parallel. – Brian Borchers Dec 20 '16 at 14:44
• OK, arpack is a good choice if you want only a few of the smallest eigenpairs. It would be a poor choice if you are trying to calculate all eigenvalues-- which it sounds like you might be doing. You say that sometimes your matrix is sparse and sometimes dense? That is unusual. The approaches to making arpack faster will be fairly different depending on those two situations. – Bill Greene Dec 20 '16 at 15:45
• Sometimes problems are just caused by memory operations like copying. Profile your program to actually see what the critical part is. – Tobias Dec 21 '16 at 0:30

MATLAB's eigs function simply calls ARPACK. So if you are using that, there is no difference and they should be equally fast. If they are not, the difference is in your own code.

I'm not an expert on this, but from what I can tell all of your matrix operations essentially reduce to polynomial time algorithms at best. MatLab, being purpose-specific software might be using some tricks to get results faster (heuristics, caching or look-up tables). People might look at you funny if you tell them math is hard, but most of it is NP-hard or NPC. ColPack is another related software library that does a great job with graph coloring.