[Numpy-tickets] [NumPy] #928: histogramdd() overflow error on high-dimension arrays
NumPy
numpy-tickets@scipy....
Mon Oct 13 12:27:41 CDT 2008
#928: histogramdd() overflow error on high-dimension arrays
------------------------+---------------------------------------------------
Reporter: jvansanten | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: numpy.lib | Version: none
Severity: normal | Resolution:
Keywords: |
------------------------+---------------------------------------------------
Old description:
> When histogramdd() is called on a large array (say, 5 dimensions with 100
> bins each), it tries to create a flat array of the bins. The size of the
> flat array is given by nbin.prod(). prod() uses the dtype of nbin by
> default (int32), which on arrays like the example above overflows into a
> negative integer, throwing an error.
>
> This is of course not a problem until one starts working with gigantic
> histograms, but it can be tricky nonetheless. Forcing nbin.prod() to use
> a long would clean this up nicely (I think).
New description:
When histogramdd() is called on a large array (say, 5 dimensions with 100
bins each), it tries to create a flat array of the bins. The size of the
flat array is given by nbin.prod(). prod() uses the dtype of nbin by
default (int32), which on arrays like the example above overflows into a
negative integer, throwing an error.
This is of course not a problem until one starts working with gigantic
histograms, but it can be tricky nonetheless. Forcing nbin.prod() to use a
long would clean this up nic
Comment (by charris):
Yes they can -- on 64 bits. So it would be worth booting up a 64 bit
system to see what the default sizes are. I suspect the default numpy type
for array indices should be intp.
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/928#comment:2>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list