[SciPy-user] scipy 0.7 changes behavior of sparse.spdiags

Tony S Yu tonyyu@MIT....
Sat Jan 24 11:03:25 CST 2009


Thanks to all the scipy developers work on the new scipy release.

I just upgraded scipy 0.6 to scipy 0.7rc2. I think it's worth  
proclaiming very loudly (or at least mentioning in the release notes)  
that the behavior of sparse.spdiags has change since 0.6. See example  
below.

Cheers,
-Tony


 >>> import numpy as np
 >>> from scipy import sparse
 >>> data = np.array([[1,2,3,4],[1,2,3,4],[1,2,3,4]])
 >>> diags = np.array([0,-1,2])
 >>> sparse.spdiags(data, diags, 4, 4).todense()

In scipy 0.7rc2
-------------------
matrix([[1, 0, 3, 0],
         [1, 2, 0, 4],
         [0, 2, 3, 0],
         [0, 0, 3, 4]])

In scipy 0.6
-------------------
matrix([[1, 0, 1, 0],
         [1, 2, 0, 2],
         [0, 2, 3, 0],
         [0, 0, 3, 4]])


More information about the SciPy-user mailing list