Author: mattip
Branch: numpypy-axisops
Changeset: r50918:ff482782c5fe
Date: 2011-12-28 02:57 +0200
http://bitbucket.org/pypy/pypy/changeset/ff482782c5fe/

Log:    bugfix, passes tests

diff --git a/pypy/module/micronumpy/interp_numarray.py 
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -738,7 +738,9 @@
         shape=values.shape[0:dim] + values.shape[dim+1:len(values.shape)]
         VirtualArray.__init__(self, name, shape, res_dtype)
         self.values = values
-        self.size = values.size
+        self.size = 1
+        for s in shape:
+            self.size *= s
         self.ufunc = ufunc
         self.res_dtype = res_dtype
         self.dim = dim
@@ -758,16 +760,18 @@
     def compute(self):
         dtype = self.res_dtype
         result = W_NDimArray(self.size, self.shape, dtype)
+        self.values = self.values.get_concrete()
         shapelen = len(result.shape)
         objlen = len(self.values.shape)
         target_len = self.values.shape[self.dim]
         #sig = self.find_sig(result.shape) ##Don't do this, it causes an 
infinite recursion
         sig = self.create_sig(result.shape)
-        ri = ArrayIterator(self.size)
+        ri = ArrayIterator(result.size)
         si = axis_iter_from_arr(self.values, self.dim)
         while not ri.done():
             chunks = []
-            for i in range(objlen - 1, -1, -1):
+            #for i in range(objlen - 1, -1, -1):
+            for i in range(objlen):
                 if i==self.dim:
                     chunks.append((0, target_len, 1, target_len))
                 else:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to