[pypy-commit] pypy numpy-back-to-applevel: take for 1d arrays
fijal
noreply at buildbot.pypy.org
Thu Jan 26 12:59:11 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-back-to-applevel
Changeset: r51790:4209800a8a51
Date: 2012-01-26 13:58 +0200
http://bitbucket.org/pypy/pypy/changeset/4209800a8a51/
Log: take for 1d arrays
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
@@ -625,13 +625,12 @@
res = W_NDimArray(size, res_shape[:], self.dtype, self.order)
res_i = res.create_iter()
longdtype = interp_dtype.get_dtype_cache(space).w_longdtype
+ shapelen = len(index.shape)
while not index_i.done():
w_item = index.getitem(index_i.offset).convert_to(longdtype)
- import pdb
- pdb.set_trace()
res.setitem(res_i.offset, self.descr_getitem(space, w_item))
- index_i = index_i.next()
- res_i = res_i.next()
+ index_i = index_i.next(shapelen)
+ res_i = res_i.next(shapelen)
return res
def convert_to_array(space, w_obj):
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1404,7 +1404,7 @@
def test_take(self):
from _numpypy import arange
- assert(arange(10).take([1, 2, 1, 1]) == [1, 2, 1, 1])
+ assert (arange(10).take([1, 2, 1, 1]) == [1, 2, 1, 1]).all()
class AppTestSupport(BaseNumpyAppTest):
def setup_class(cls):
More information about the pypy-commit
mailing list