[Scipy-svn] r2508 - trunk/Lib/sparse
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Jan 8 21:36:37 EST 2007
Author: timl
Date: 2007-01-08 20:36:32 -0600 (Mon, 08 Jan 2007)
New Revision: 2508
Modified:
trunk/Lib/sparse/sparse.py
Log:
ensure that the correct dtype is used for lil_matrix.__setitem__
Modified: trunk/Lib/sparse/sparse.py
===================================================================
--- trunk/Lib/sparse/sparse.py 2007-01-08 11:06:48 UTC (rev 2507)
+++ trunk/Lib/sparse/sparse.py 2007-01-09 02:36:32 UTC (rev 2508)
@@ -2391,6 +2391,10 @@
def __setitem__(self, index, x):
+ if isscalar(x):
+ x = self.dtype.type(x)
+ elif not isinstance(x, spmatrix):
+ x = numpy.asarray(x, dtype=self.dtype)
try:
assert len(index) == 2
except (AssertionError, TypeError):
More information about the Scipy-svn
mailing list