[Scipy-svn] r3608 - in trunk/scipy/sparse: . tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Sun Dec 2 16:59:07 EST 2007
Author: wnbell
Date: 2007-12-02 15:59:04 -0600 (Sun, 02 Dec 2007)
New Revision: 3608
Modified:
trunk/scipy/sparse/sparse.py
trunk/scipy/sparse/tests/test_sparse.py
Log:
make spkron work for mixed types
Modified: trunk/scipy/sparse/sparse.py
===================================================================
--- trunk/scipy/sparse/sparse.py 2007-12-02 21:53:53 UTC (rev 3607)
+++ trunk/scipy/sparse/sparse.py 2007-12-02 21:59:04 UTC (rev 3608)
@@ -2761,8 +2761,7 @@
row,col = row.reshape(-1),col.reshape(-1)
# compute block entries
- data = data.reshape(-1,b.nnz)
- data *= b.data
+ data = data.reshape(-1,b.nnz) * b.data
data = data.reshape(-1)
return coo_matrix((data,(row,col)), dims=output_shape)
Modified: trunk/scipy/sparse/tests/test_sparse.py
===================================================================
--- trunk/scipy/sparse/tests/test_sparse.py 2007-12-02 21:53:53 UTC (rev 3607)
+++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-02 21:59:04 UTC (rev 3608)
@@ -1171,7 +1171,8 @@
cases.append(array([[5,4],[0,0],[6,0]]))
cases.append(array([[5,4,4],[1,0,0],[6,0,8]]))
cases.append(array([[0,1,0,2,0,5,8]]))
-
+ cases.append(array([[0.5,0.125,0,3.25],[0,2.5,0,0]]))
+
for a in cases:
for b in cases:
result = spkron(csr_matrix(a),csr_matrix(b)).todense()
More information about the Scipy-svn
mailing list