summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-04-08 14:22:50 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-04-08 15:01:27 -0700
commitb3a2b026652f62ae998014544547721340ffb435 (patch)
tree60e3b3185fb5d1800333d8ce6b4ddefd540c15f4 /numpy/lib
parentf4df81f8dcd5c7361a273b7c6cf294a9e8c0841c (diff)
downloadnumpy-b3a2b026652f62ae998014544547721340ffb435.tar.gz
MAINT: Don't reimplement `ravel_multi_index`
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/histograms.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py
index f402a02c1..f0796fbac 100644
--- a/numpy/lib/histograms.py
+++ b/numpy/lib/histograms.py
@@ -925,9 +925,8 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
hist = np.zeros(nbin, float).reshape(-1)
# Compute the sample indices in the flattened histogram matrix.
- xy = np.zeros(N, np.intp)
- for i in np.arange(0, D):
- xy += Ncount[i] * nbin[i+1:].prod()
+ # This raises an error if the array is too large.
+ xy = np.ravel_multi_index(Ncount, nbin)
# Compute the number of repetitions in xy and assign it to the
# flattened histmat.