[pypy-commit] pypy matrixmath-dot: fix merge
mattip
noreply at buildbot.pypy.org
Sat Jan 14 22:35:57 CET 2012
Author: mattip
Branch: matrixmath-dot
Changeset: r51332:cdee39d4ae23
Date: 2012-01-14 23:05 +0200
http://bitbucket.org/pypy/pypy/changeset/cdee39d4ae23/
Log: fix merge
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
@@ -194,7 +194,8 @@
n_new_elems_used = 1
oldI = -1
n_old_elems_to_use = old_shape[-1]
- for s in new_shape[::-1]:
+ for i in range(len(new_shape) - 1, -1, -1):
+ s = new_shape[i]
new_strides.insert(0, cur_step * n_new_elems_used)
n_new_elems_used *= s
while n_new_elems_used > n_old_elems_to_use:
@@ -383,7 +384,6 @@
the second-to-last of `b`::
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])'''
- #numpy's doc string :)
w_other = convert_to_array(space, w_other)
if isinstance(w_other, Scalar):
return self.descr_mul(space, w_other)
@@ -420,10 +420,13 @@
for os in out_shape:
out_size *= os
out_ndims = len(out_shape)
- #TODO: what should the order be? C or F?
+ # TODO: what should the order be? C or F?
arr = W_NDimArray(out_size, out_shape, dtype=dtype)
- out_iter = view_iter_from_arr(arr)
- #TODO: invalidate self, w_other with arr ?
+ # TODO: this is all a bogus mess of previous work,
+ # rework within the context of transformations
+ '''
+ out_iter = ViewIterator(arr.start, arr.strides, arr.backstrides, arr.shape)
+ # TODO: invalidate self, w_other with arr ?
while not out_iter.done():
my_index = self.start
other_index = w_other.start
@@ -443,6 +446,7 @@
value = w_res.descr_sum(space)
arr.setitem(out_iter.get_offset(), value)
out_iter = out_iter.next(out_ndims)
+ '''
return arr
def get_concrete(self):
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
@@ -516,7 +516,7 @@
b = a * a
for i in range(5):
assert b[i] == i * i
- assert b.dtype is numpypy.dtype(int)
+ assert b.dtype is a.dtype
a = _numpypy.array(range(5), dtype=bool)
b = a * a
@@ -740,8 +740,7 @@
def test_sum(self):
from _numpypy import array
a = array(range(5))
- b = a.sum()
- assert b == 10
+ assert a.sum() == 10
assert a[:4].sum() == 6
a = array([True] * 5, bool)
More information about the pypy-commit
mailing list