So the SciPy package for Python is full of lots of goodness. Be very careful using the eigh() routine to get eigenvalues, though. There's a "gotcha" buried in it.
The syntax is:
(eigenvalues, eigenvectors) = eigh(matrix)
This returns an array of eigenvalues and a 2D array of eigenvectors (each eigenvector consists of many components).
And there's the gotcha. Let's say you want the nth eigenvalue and eigenvector. I would write:
And I would be horribly wrong. The eigenvectors and eigenvalues do share an index, but the index on the eigenvector is SECOND column:
Update: It turns out that this is due to eigh() being part of LAPACK, which is a non-Python library (Fortran?) that has a different internal storage model for 2D arrays. So possibly less WTF, but still dangerous as all hell.