[Numpy-svn] r5086 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Fri Apr 25 13:00:12 CDT 2008


Author: dhuard
Date: 2008-04-25 13:00:09 -0500 (Fri, 25 Apr 2008)
New Revision: 5086

Modified:
   trunk/numpy/lib/function_base.py
Log:
Fix to histogram with respect to block updating.a

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2008-04-25 17:41:04 UTC (rev 5085)
+++ trunk/numpy/lib/function_base.py	2008-04-25 18:00:09 UTC (rev 5086)
@@ -237,18 +237,18 @@
         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] 



More information about the Numpy-svn mailing list