[pypy-commit] pypy numpy-single-jitdriver: fix and shuffle stuff around a bit

fijal noreply at buildbot.pypy.org
Thu Feb 2 17:48:07 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-single-jitdriver
Changeset: r52036:ad25c403e833
Date: 2012-02-02 18:47 +0200
http://bitbucket.org/pypy/pypy/changeset/ad25c403e833/

Log:	fix and shuffle stuff around a bit

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
@@ -867,7 +867,7 @@
     def compute_first_step(self, sig, frame):
         assert isinstance(sig, signature.ReduceSignature)
         if self.identity is None:
-            frame.cur_value = sig.right.eval(frame, self).convert_to(
+            frame.cur_value = sig.right.eval(frame, self.right).convert_to(
                 self.calc_dtype)
             frame.next(len(self.right.shape))
         else:
@@ -879,6 +879,17 @@
                                  signature.ScalarSignature(self.res_dtype),
                                          self.right.create_sig())
 
+class AxisReduce(Call2):
+    _immutable_fields_ = ['left', 'right']
+
+    def __init__(self, ufunc, name, shape, dtype, left, right, dim):
+        Call2.__init__(self, ufunc, name, shape, dtype, dtype,
+                       left, right)
+        self.dim = dim
+
+#    def create_sig(self):
+#        return signature.AxisReduceSignature(self.ufunc
+
 class SliceArray(Call2):
     def __init__(self, shape, dtype, left, right, no_broadcast=False):
         self.no_broadcast = no_broadcast
@@ -897,14 +908,6 @@
                                             self.calc_dtype,
                                             lsig, rsig)
 
-class AxisReduce(Call2):
-    _immutable_fields_ = ['left', 'right']
-
-    def __init__(self, ufunc, name, shape, dtype, left, right, dim):
-        Call2.__init__(self, ufunc, name, shape, dtype, dtype,
-                       left, right)
-        self.dim = dim
-
 class ConcreteArray(BaseArray):
     """ An array that have actual storage, whether owned or not
     """
diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -158,8 +158,7 @@
             raise operationerrfmt(space.w_ValueError, "zero-size array to "
                     "%s.reduce without identity", self.name)
         if shapelen > 1 and dim >= 0:
-            res = self.do_axis_reduce(obj, dtype, dim, keepdims)
-            return space.wrap(res)
+            return self.do_axis_reduce(obj, dtype, dim, keepdims)
         arr = ReduceArray(self.func, self.name, self.identity, obj, dtype)
         return loop.compute(arr)
 


More information about the pypy-commit mailing list