[SciPy-User] Eigenvectors of sparse symmetric matrix

Lutz Maibaum lutz.maibaum@gmail....
Wed Oct 27 01:19:48 CDT 2010


On Oct 26, 2010, at 9:33 AM, Pauli Virtanen wrote:
> If you have time, please test:
> 
> 	http://github.com/pv/scipy-work/tree/bug/1313-arpack

I am not sure how to use github, so I just replaced the arpack.py with the new version. The 32 bit version still works, and the 64 bit version now correctly tries to raise an exception. It seems to fail in doing so, however:

Traceback (most recent call last):
  File "check.py", line 38, in <module>
    compute_eigenvalues(a.astype(np.float64))
  File "check.py", line 22, in compute_eigenvalues
    print scipy.sparse.linalg.eigs(a)[0]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 521, in eigs
    params.iterate()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 332, in iterate
    self._raise_no_convergence()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 201, in _raise_no_convergence
    ev, vec = self.extract(True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 358, in extract
    raise ArpackError(ierr, infodict=_NEUPD_ERRORS)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 121, in __init__
    RuntimeError.__init__("ARPACK error %d: %s" % (info, msg))
TypeError: descriptor '__init__' requires a 'exceptions.RuntimeError' object but received a 'str'

Again, this might be because I simply replaced the arpack.py file.

Would it be possible to add to the docstrings that maxiter=None is interpreted as maxiter=10*n (size of matrix)?

> Note that the function is there renamed from `eigen` to `eigs`, as the 
> name shadowed with the package name (plus obvious reasons).

That's good to know. A while ago there was some discussion about this (http://mail.scipy.org/pipermail/scipy-user/2010-August/026401.html). In SciPy 0.7, I used

scipy.sparse.linalg.eigen.arpack.eigen()

which no longer worked in SciPy 0.8, where I now use

scipy.sparse.linalg.eigen()

Does your change mean that for SciPy 0.9, I will have to use

scipy.sparse.linalg.eigen.arpack.eigs() ?

I help maintain a software package that is supposed to work with all 3 versions of SciPy. What would be a good way to handle this? To support 0.7 and 0.8, I am currently using something like

try:  
  import scipy.sparse.linalg.eigen.arpack as arpack  # this works for 0.7 but fails for 0.8
  scipy.sparse.linalg.eigen = arpack.eigen
except:
  import scipy.sparse.linalg.eigen         # this works for 0.8

Any suggestions would be much appreciated.

Thanks for all your help,

  Lutz



More information about the SciPy-User mailing list