summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavpreet Singh <navpreet_np@yahoo.com>2022-11-18 02:57:11 -0500
committerCharles Harris <charlesr.harris@gmail.com>2022-11-19 10:52:16 -0700
commitdcd9404456e4af37041ee740045e95b10aaa46ad (patch)
tree31b6e40381ed0fbb978256a6d3c46dd8f285c7e6
parentbb5e3a671f1fab8bf39346c760cf65009f91bea2 (diff)
downloadnumpy-dcd9404456e4af37041ee740045e95b10aaa46ad.tar.gz
BUG: Histogramdd breaks on big arrays in Windows (#22561)
* BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * Removed the binary files * Update test_histograms.py * Update test_histograms.py * Update test_histograms.py
-rw-r--r--numpy/lib/histograms.py2
-rw-r--r--numpy/lib/tests/test_histograms.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py
index 98182f1c4..194ee6ce2 100644
--- a/numpy/lib/histograms.py
+++ b/numpy/lib/histograms.py
@@ -1019,7 +1019,7 @@ def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
sample = np.atleast_2d(sample).T
N, D = sample.shape
- nbin = np.empty(D, int)
+ nbin = np.empty(D, np.intp)
edges = D*[None]
dedges = D*[None]
if weights is not None:
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index 1a1327c84..14423f6f5 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -6,6 +6,7 @@ from numpy.testing import (
assert_array_almost_equal, assert_raises, assert_allclose,
assert_array_max_ulp, assert_raises_regex, suppress_warnings,
)
+from numpy.testing._private.utils import requires_memory
import pytest
@@ -421,6 +422,16 @@ class TestHistogram:
edges = histogram_bin_edges(arr, bins='auto', range=(0, 1))
assert_array_equal(edges, e)
+ @requires_memory(free_bytes=1e10)
+ @pytest.mark.slow
+ def test_big_arrays(self):
+ sample = np.zeros([100000000, 3])
+ xbins = 400
+ ybins = 400
+ zbins = np.arange(16000)
+ hist = np.histogramdd(sample=sample, bins=(xbins, ybins, zbins))
+ assert_equal(type(hist), type((1, 2)))
+
class TestHistogramOptimBinNums:
"""