Skip to content

Commit

Permalink
Fix typo in oldnumeric and add Rick White's improvement to histogram …
Browse files Browse the repository at this point in the history
…for large arrays.
  • Loading branch information
teoliphant committed Dec 14, 2006
1 parent 8bd6fb7 commit 32789fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ def histogram(a, bins=10, range=None, normed=False):
mx += 0.5
bins = linspace(mn, mx, bins, endpoint=False)

n = sort(a).searchsorted(bins)
# best block size probably depends on processor cache size
block = 65536
n = sort(a[:block]).searchsorted(bins)
for i in xrange(block, a.size, block):
n += sort(a[i:i+block]).searchsorted(bins)
n = concatenate([n, [len(a)]])
n = n[1:]-n[:-1]

Expand Down
2 changes: 1 addition & 1 deletion numpy/oldnumeric/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def array_constructor(shape, typecode, thestr, Endian=LittleEndian):
x = mu.fromstring(thestr, typecode)
x.shape = shape
if LittleEndian != Endian:
return x.byteswap(TRUE)
return x.byteswap(True)
else:
return x

Expand Down

0 comments on commit 32789fd

Please sign in to comment.