Author: Maciej Fijalkowski <[email protected]>
Branch: matrixmath-dot
Changeset: r51968:821ef0f19e33
Date: 2012-01-30 22:17 +0200
http://bitbucket.org/pypy/pypy/changeset/821ef0f19e33/

Log:    small cleanups

diff --git a/pypy/module/micronumpy/REVIEW b/pypy/module/micronumpy/REVIEW
--- a/pypy/module/micronumpy/REVIEW
+++ b/pypy/module/micronumpy/REVIEW
@@ -2,6 +2,9 @@
 Please read the basics of our jit in [1]. Essentially assembler will be
 specialized on greens, that's why we do the dance of all the signature stuff,
 so it's compiled for each green. 'left' in green is obviously unacceptable.
+I removed this but we still need signature.
 
+More precisely - we want different assembler for the right side being Array
+or View.
 
 .. [1] http://doc.pypy.org/en/latest/jit/index.html
\ No newline at end of file
diff --git a/pypy/module/micronumpy/dot.py b/pypy/module/micronumpy/dot.py
--- a/pypy/module/micronumpy/dot.py
+++ b/pypy/module/micronumpy/dot.py
@@ -3,13 +3,12 @@
 from pypy.module.micronumpy.interp_iter import ViewIterator
 from pypy.rlib import jit
 
-
-def dot_printable_location(shapelen, sig):
-    return 'numpy dot [%d dims]' % (shapelen)
+def dot_printable_location(shapelen):
+    return 'numpy dot [%d]' % shapelen
 
 dot_driver = jit.JitDriver(
-    greens=['shape_len'],
-    reds=['lefti', 'righti', 'outi', 'result', 'right', 'sig', 'dtype',
+    greens=['shapelen'],
+    reds=['lefti', 'righti', 'outi', 'result', 'right', 'dtype',
           'left'],
     get_printable_location=dot_printable_location,
     name='dot',
@@ -35,7 +34,6 @@
                                         "objects are not aligned"))
     return out_shape, right_critical_dim
 
-
 def multidim_dot(space, left, right, result, dtype, right_critical_dim):
     ''' assumes left, right are concrete arrays
     given left.shape == [3, 5, 7],
@@ -51,7 +49,7 @@
      right should skip 0, 1
     '''
     broadcast_shape = left.shape[:-1] + right.shape
-    shape_len = len(broadcast_shape)
+    shapelen = len(broadcast_shape)
     left_skip = [len(left.shape) - 1 + i for i in range(len(right.shape))
                                          if i != right_critical_dim]
     right_skip = range(len(left.shape) - 1)
@@ -68,7 +66,7 @@
     while not outi.done():
         dot_driver.jit_merge_point(left=left,
                                    right=right,
-                                   shape_len=shape_len,
+                                   shapelen=shapelen,
                                    lefti=lefti,
                                    righti=righti,
                                    outi=outi,
@@ -81,7 +79,7 @@
         v = dtype.itemtype.mul(lval, rval)
         value = dtype.itemtype.add(v, outval).convert_to(dtype)
         result.setitem(outi.offset, value)
-        outi = outi.next(shape_len)
-        righti = righti.next(shape_len)
-        lefti = lefti.next(shape_len)
+        outi = outi.next(shapelen)
+        righti = righti.next(shapelen)
+        lefti = lefti.next(shapelen)
     return result
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
@@ -260,13 +260,11 @@
         dtype = interp_ufuncs.find_binop_result_dtype(space,
                                      self.find_dtype(), other.find_dtype())
         if self.size < 1 and other.size < 1:
-            #numpy compatability
+            # numpy compatability
             return scalar_w(space, dtype, space.wrap(0))
-        #Do the dims match?
+        # Do the dims match?
         out_shape, other_critical_dim = match_dot_shapes(space, self, other)
-        out_size = 1
-        for o in out_shape:
-            out_size *= o
+        out_size = support.product(out_shape)
         result = W_NDimArray(out_size, out_shape, dtype)
         # This is the place to add fpypy and blas
         return multidim_dot(space, self.get_concrete(), 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to