diff options
author | dhuard <dhuard@localhost> | 2008-04-25 18:00:09 +0000 |
---|---|---|
committer | dhuard <dhuard@localhost> | 2008-04-25 18:00:09 +0000 |
commit | bb61ebca77749343bea38bcc7e8eaaee667a4f02 (patch) | |
tree | ec26b4fa09067680e054a89e5b4dbc411521eb42 /numpy/lib/function_base.py | |
parent | c4119518e1c77d4699bdedc0f558797828dba1c3 (diff) | |
download | numpy-bb61ebca77749343bea38bcc7e8eaaee667a4f02.tar.gz |
Fix to histogram with respect to block updating.a
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index c813b49c1..0470930f5 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -237,18 +237,18 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, new=False): else: ntype = weights.dtype n = np.zeros(bins.shape, ntype) - + block = 65536 if weights is None: - for i in xrange(0, a.size, block): - sa = sort(a[:block]) + for i in arange(0, len(a), block): + sa = sort(a[i:i+block]) n += np.r_[sa.searchsorted(bins[:-1], 'left'), \ sa.searchsorted(bins[-1], 'right')] else: zero = array(0, dtype=ntype) - for i in xrange(0, a.size, block): - tmp_a = a[:block] - tmp_w = weights[:block] + for i in arange(0, len(a), block): + tmp_a = a[i:i+block] + tmp_w = weights[i:i+block] sorting_index = np.argsort(tmp_a) sa = tmp_a[sorting_index] sw = tmp_w[sorting_index] |