[SciPy-user] bug crash
David M. Cooke
cookedm at physics.mcmaster.ca
Wed Jun 16 15:25:56 EDT 2004
On June 16, 2004 02:57 pm, eric jones wrote:
> Pearu Peterson wrote:
> >In [1]: from scipy import *
> >In [6]: b=arange(100000000).astype('f')
> >
> >In [7]: b=b*1j
> >Segmentation fault
>
> It would be nice if the failure wasn't so violent...
>
> eric
Yet another reason to switch to numarray...
>>> import numarray
>>> b = numarray.arange(100000000, type=numarray.Float64)
>>> b = b*1j
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py", line 723,
in __mul__
return ufunc.multiply(self, operand)
File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 877, in
_cache_miss2
mode, win1, win2, wout, cfunc, ufargs = \
File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 913, in
_setup
if out is None: wout = in1.new(outtype[0])
File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py", line 643,
in new
return self.__class__(shape=self._shape, type=type)
MemoryError
>>>
And by the way, arange(1000000).astype('f') is a bad idea: it allocates an
array of integers, then makes a new array of floats.
You should use arange(1000000, typecode=Float), which allocates one array of
Floats.
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca
More information about the SciPy-User
mailing list