Author: Matti Picus <matti.pi...@gmail.com> Branch: numpypy-nditer Changeset: r70700:71c0ca886656 Date: 2014-04-17 14:04 +0300 http://bitbucket.org/pypy/pypy/changeset/71c0ca886656/
Log: revert merge cruft diff --git a/pypy/module/micronumpy/iterators.py b/pypy/module/micronumpy/iterators.py --- a/pypy/module/micronumpy/iterators.py +++ b/pypy/module/micronumpy/iterators.py @@ -42,6 +42,7 @@ """ from rpython.rlib import jit from pypy.module.micronumpy import support +from pypy.module.micronumpy.strides import calc_strides from pypy.module.micronumpy.base import W_NDimArray @@ -143,6 +144,39 @@ self.array.setitem(self.offset, elem) +class SliceIterator(ArrayIter): + def __init__(self, arr, strides, backstrides, shape, order="C", + backward=False, dtype=None): + if dtype is None: + dtype = arr.implementation.dtype + self.dtype = dtype + self.arr = arr + if backward: + self.slicesize = shape[0] + self.gap = [support.product(shape[1:]) * dtype.elsize] + strides = strides[1:] + backstrides = backstrides[1:] + shape = shape[1:] + strides.reverse() + backstrides.reverse() + shape.reverse() + size = support.product(shape) + else: + shape = [support.product(shape)] + strides, backstrides = calc_strides(shape, dtype, order) + size = 1 + self.slicesize = support.product(shape) + self.gap = strides + + ArrayIter.__init__(self, arr.implementation, size, shape, strides, backstrides) + + def getslice(self): + from pypy.module.micronumpy.concrete import SliceArray + retVal = SliceArray(self.offset, self.gap, self.backstrides, + [self.slicesize], self.arr.implementation, self.arr, self.dtype) + return retVal + + def AxisIter(array, shape, axis, cumulative): strides = array.get_strides() backstrides = array.get_backstrides() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit