Commits

Romain Guillebert  committed 7107aa4

Backed out changeset 730edc51d980

  • Participants
  • Parent commits 730edc5
  • Branches numpypy-nditer

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_nditer.py

 from pypy.interpreter.error import OperationError
 from pypy.module.micronumpy.base import W_NDimArray, convert_to_array
 from pypy.module.micronumpy.strides import (calculate_broadcast_strides,
-                                          shape_agreement_multiple, calc_steps)
+                                             shape_agreement_multiple)
 from pypy.module.micronumpy.iter import MultiDimViewIterator, SliceIterator
 from pypy.module.micronumpy import support
 from pypy.module.micronumpy.arrayimpl.concrete import SliceArray
         self.iters=[]
         self.shape = iter_shape = shape_agreement_multiple(space, self.seq)
         if self.external_loop:
-            steps = []
-            for seq in self.seq:
-                impl = seq.implementation
-                steps.append(calc_steps(impl.shape, impl.strides, self.order))
-            #XXX #find longest contiguous shape
-            print 'steps',steps,'tier_shape',iter_shape
-            iter_shape = [1]
+            #XXX find longest contiguous shape
+            iter_shape = iter_shape[1:]
         for i in range(len(self.seq)):
             self.iters.append(BoxIterator(get_iter(space, self.order,
-                            self.seq[i].implementation, iter_shape),
-                            self.op_flags[i]))
+                            self.seq[i].implementation, iter_shape), self.op_flags[i]))
 
     def descr_iter(self, space):
         return space.wrap(self)

File pypy/module/micronumpy/strides.py

             rstrides.append(strides[i])
             rbackstrides.append(backstrides[i])
     if backwards:
-        rstrides = rstrides + [0] * (len(res_shape) - len(orig_shape))
-        rbackstrides = rbackstrides + [0] * (len(res_shape) - len(orig_shape))
+        rstrides = rstrides + [0] * (len(res_shape) - len(orig_shape))  
+        rbackstrides = rbackstrides + [0] * (len(res_shape) - len(orig_shape)) 
     else:
         rstrides = [0] * (len(res_shape) - len(orig_shape)) + rstrides
         rbackstrides = [0] * (len(res_shape) - len(orig_shape)) + rbackstrides
     if (is_rec_type and space.isinstance_w(w_elem, space.w_tuple)):
         return True
     if (space.isinstance_w(w_elem, space.w_tuple) or
-        isinstance(w_elem, W_NDimArray) or
+        isinstance(w_elem, W_NDimArray) or    
         space.isinstance_w(w_elem, space.w_list)):
         return False
     return True
             rbackstrides[i] = backstrides[j]
             j += 1
     return rstrides, rbackstrides
-
-@jit.unroll_safe
-def calc_steps(shape, strides, order='C'):
-    steps = []
-    if order == 'K':
-        if strides[0] < strides[-1]:
-            order = 'F'
-        else:
-            order = 'C'
-    if order == 'F' or order == 'A':
-        last_step = strides[0]
-        for i in range(len(shape)):
-            steps.append(strides[i] / last_step)
-            last_step *= shape[i]
-        if order == 'A':
-            pass
-            #XXX test for all(steps==steps[0])
-    elif order == 'C':
-        last_step = strides[-1]
-        for i in range(len(shape) - 1, -1, -1):
-            steps.insert(0, strides[i] / last_step)
-            last_step *= shape[i]
-    return steps
-