Closed
Description
I have been looking on and off at moving sagemath beyond numpy 1.8.x and numpy 1.10.1 behaves better for us than the 1.9 series [ see http://trac.sagemath.org/ticket/17642]. However we have a strange conversion problem within numpy's linspace
function
sage: import numpy
sage: u1min, u1max = -1.5, 1.5
sage: u1num = 10
sage: u1min.__array_interface__
{'typestr': '=f8'}
sage: u1max.__array_interface__
{'typestr': '=f8'}
sage: u1_array = numpy.linspace(u1min, u1max, u1num)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-666f5f61234c> in <module>()
----> 1 u1_array = numpy.linspace(u1min, u1max, u1num)
/home/frb15/gentoo/usr/lib/python2.7/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype)
91 stop = stop * 1.
92
---> 93 dt = result_type(start, stop, float(num))
94 if dtype is None:
95 dtype = dt
TypeError: data type not understood
It appears that start
and stop
are not converted to float by the multiplication by 1.
. The initial suggestion in issue #3504 to use float
to cast the value to the right types would work here. Of course in that context dt
becomes trivially float
.
Metadata
Metadata
Assignees
Labels
No labels