[pypy-commit] pypy numpypy-axisops: iterators, frames in place, but still not correct
mattip
noreply at buildbot.pypy.org
Tue Dec 27 21:48:38 CET 2011
Author: mattip
Branch: numpypy-axisops
Changeset: r50916:a1810346784a
Date: 2011-12-27 22:46 +0200
http://bitbucket.org/pypy/pypy/changeset/a1810346784a/
Log: iterators, frames in place, but still not correct
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
@@ -756,15 +756,19 @@
def compute(self):
result = W_NDimArray(self.size, self.shape, self.find_dtype())
shapelen = len(result.shape)
- sig = self.find_sig()
+ #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)
- si = axis_iter_from_arr(self, self.dim)
+ si = axis_iter_from_arr(self.values, self.dim)
while not ri.done():
- frame = sig.create_frame(self, self.values, chunks = si.indices)
- val = sig.eval(frame, self)
+ #frame = sig.create_frame(self.values, chunks = [si.indices])
+ #Frame should be returning self.func applied to the axis starting at si.offset
+ frame = sig.create_frame(self.values, chunks = [])
+ val = sig.eval(frame, self.values).convert_to( self.find_dtype())
result.dtype.setitem(result.storage, ri.offset, val)
ri = ri.next(shapelen)
si = si.next(shapelen)
+ frame = frame.next
return result
diff --git a/pypy/module/micronumpy/signature.py b/pypy/module/micronumpy/signature.py
--- a/pypy/module/micronumpy/signature.py
+++ b/pypy/module/micronumpy/signature.py
@@ -90,13 +90,11 @@
allnumbers.append(no)
self.iter_no = no
- def create_frame(self, arr, res_shape=None):
- #def create_frame(self, arr, res_shape=None, chunks = []):
+ def create_frame(self, arr, res_shape=None, chunks = []):
res_shape = res_shape or arr.shape
iterlist = []
arraylist = []
- #self._create_iter(iterlist, arraylist, arr, res_shape, chunks)
- self._create_iter(iterlist, arraylist, arr, res_shape, [])
+ self._create_iter(iterlist, arraylist, arr, res_shape, chunks)
return NumpyEvalFrame(iterlist, arraylist)
class ConcreteSignature(Signature):
More information about the pypy-commit
mailing list