summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2008-04-25 18:00:09 +0000
committerdhuard <dhuard@localhost>2008-04-25 18:00:09 +0000
commitbb61ebca77749343bea38bcc7e8eaaee667a4f02 (patch)
treeec26b4fa09067680e054a89e5b4dbc411521eb42 /numpy/lib/function_base.py
parentc4119518e1c77d4699bdedc0f558797828dba1c3 (diff)
downloadnumpy-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.py12
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]