[SciPy-User] Sparse eigensystem instability on OS X Lion

Chris Laumann claumann at physics.harvard.edu
Fri Jul 29 11:20:18 EDT 2011


Hi all-

I've recently upgraded to Lion and, because it broke my python setup, reinstalled scipy from two sources -- Enthought's full 64 bit latest distro (Scipy 0.9.0 and Numpy 1.6.0) and Chris Fonnesbeck's Scipy Superpack (with the latest dev versions from a few weeks ago). I'm now finding a bunch of numerical instability in symmetric sparse eigensystem solutions in scipy.sparse.linalg.eigsh. These didn't exist before the upgrade when I was using Snow Leopard and scipy 0.8.0 (eigen_symmetric instead of eigsh). 

The smallest example I've isolated is:

data = array([ 16.,  18.,  -4.,  -2.,  -4.,  25.,  -2.,   4.,  -2.,  17.,  16., 18.])
indices = array([0, 1, 2, 6, 1, 2, 4, 3, 2, 4, 5, 6], dtype='int32')
indptr = array([ 0,  1,  4,  7,  8, 10, 11, 12], dtype='int32')

ham1 = scipy.sparse.csr_matrix((data, indices, indptr))

e1 = np.linalg.eigvalsh(ham1.todense())

e2 = scipy.sparse.linalg.eigsh(ham1, k=6, which='SA', return_eigenvectors = False)
e2.sort()

This leads to (using the superpack -- the results from Enthought are similarly noisy but different):

>>> e1
array([  4.        ,  15.57851688,  16.        ,  16.        ,  17.27739936,  18.        ,  27.14408376])

>>> e2
array([  4.03171393,  15.47517729,  15.98093481,  16.   ,    16.76781718,  18.79560773])

These are big errors for a 7x7 matrix, especially for the minimum eigenvalue 4, which is well separated from the rest of the spectrum. Can anybody help? I believe the Superpack _arpack.so is linking against the apple Accelerate framework for LAPACK while I'm not sure about Enthoughts _arpack.so. As far as I can tell from a little otool snooping, Enthought seems to roll its own LAPACK functionality. In any event, neither seems to work. 

Thanks, Chris





More information about the SciPy-User mailing list