[SciPy-User] Eigenvectors of sparse symmetric matrix

David david@silveregg.co...
Wed Oct 27 01:40:36 CDT 2010


On 10/27/2010 03:19 PM, Lutz Maibaum wrote:
> 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

There is a big download button so that you can download the working tree 
corresponding to that revision :)

http://github.com/pv/scipy-work/archives/bug/1313-arpack

> 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.

I think this is a fined method, except that you should use ImportError 
in the except clause to avoid hiding arbitrary exception (if you make a 
typo in the try section, for example).

An alternative is to explicitly handle the versions (using 
scipy.__version__). This has the advantage of being more explicit, but 
potentially more fragile (making errors in version handling is 
suprisingly easy in my experience),

cheers,

David


More information about the SciPy-User mailing list