[Scipy-tickets] [SciPy] #1604: lil_matrix changes dtype from float to int during assignment
SciPy Trac
scipy-tickets@scipy....
Tue Feb 21 19:48:02 CST 2012
#1604: lil_matrix changes dtype from float to int during assignment
----------------------+-----------------------------------------------------
Reporter: turcksin | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: Other | Version: 0.9.0
Keywords: |
----------------------+-----------------------------------------------------
This bug is similar (the same ?) than Ticket #1533 "toarray on sparse
matrices can't handle dtype=bool"
When some elements of a lil_matrix are initialized using an array, the
type is changed from float to int.
{{{
a = scipy.sparse.lil_matrix((3,3),dtype='float64')
b = numpy.array([3.3,4.4])
a[0,0:2] += b
a.todense() :
matrix([[ 3., 4., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.]])
}}}
Now if I add b again, everything is fine :
{{{
a[0,0:2] += b
a.todense() :
matrix([[ 6.3, 8.4, 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]])
}}}
if the values in b are in ]-1,1[, then the values in a will always stay at
0.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1604>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list