1
$\begingroup$

I have a real sparse matrix of the form

$$ \left( \begin{array}{ccc} h_{11} & h_{12} & 0 & h_{14} & & & \\ h_{21} & h_{22} & h_{23} & 0 & h_{25} & & \\ 0 & h_{32} & h_{33} & h_{34} & 0 & h_{36} & \\ h_{41} & 0 & h_{43} & h_{44} & h_{45} & 0 & \dots \\ & h_{52} & 0 & h_{54} & h_{55} & h_{56} & \\ & & h_{63} & 0 & h_{65} & h_{66} & \\ & & & \vdots & & & \ddots\\ \end{array} \right) $$

It typically has dimensions $2500\times 2500$

I've written a small routine using the LAPACK routine dsyev, which is fine for small matrices but takes a while for the above dimensions I am interested in.

Would anyone suggest a more appropriate routine? I am only interested in the lower eigenvalues, so an iterative procedure would probably be suitable.

Or are there any (ready-made) routines that exploit sparse matrices? LAPACK seems to be primarily for dense matrices.

$\endgroup$
  • $\begingroup$ Have you done a search for 'band-diagonal eigenvalue solver'? $\endgroup$ – Kyle Kanos Nov 15 '16 at 18:36
  • 1
    $\begingroup$ Would Computational Science be a better home for this question? (If so, you can flag it and ask a moderator to migrate it there; don't cross-post.) $\endgroup$ – Emilio Pisanty Nov 15 '16 at 18:40
  • $\begingroup$ I'll have a look for 'band-diagonal eigenvalue solvers'. Thanks. Also yeah that might be more appropriate. I'll flag it. $\endgroup$ – DJames Nov 15 '16 at 18:59
  • 1
    $\begingroup$ This matrix is not "block"-diagonal but banded. BTW, what you intend by Hamiltonian? Hamiltonian matrix has a quite special meaning, in linear algebra: mathworld.wolfram.com/HamiltonianMatrix.html $\endgroup$ – Stefano M Nov 16 '16 at 8:12
  • 1
    $\begingroup$ Arpack has routines for banded matrices, have you checked it? $\endgroup$ – nicoguaro Nov 16 '16 at 15:19
1
$\begingroup$

As nicoguaro mentioned, ARPACK has routines that will naturally handle banded matrices that are stored in LAPACK band format. Moreover, since ARPACK uses matrix-vector products (MVP) to find eigenvalues, you might "connect" it to your own MVP subroutine without the need to reorganize matrix storage.

As a primarily C++ user, at some point, I tried using Eigen unsupported ARPACK module, but did not check it for a while. Eigen will provide you with convenient wrappers for your matrix storage and basic linear algebra operations. Though you can use ARPACK via Matlab, Python, and many other ways.

The python scipy page on Sparse Eigenvalue Problems with ARPACK gives an idea of what to do for your problem of finding $n$ smallest eigenvalues by switching to a corresponding computation mode. See references on the which parameter: SM (smallest magnitude), SR (smallest real part), SI (smallest imaginary part), SA (smallest algebraic).

$2500 \times 2500$ does not sound like a large problem; however, if the scaling to larger sizes becomes an issue, one might also look into SLEPc.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.