[pypy-commit] pypy numpypy-complex2: fix for ufunc tests

mattip noreply at buildbot.pypy.org
Fri Aug 24 16:41:48 CEST 2012


Author: mattip <matti.picus at gmail.com>
Branch: numpypy-complex2
Changeset: r56838:7658692d114a
Date: 2012-08-24 17:40 +0300
http://bitbucket.org/pypy/pypy/changeset/7658692d114a/

Log:	fix for ufunc tests

diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -499,4 +499,4 @@
     __new__ = interp2app(W_Complex64Box.descr__new__.im_func),
     real = GetSetProperty(W_Complex64Box.descr_get_real),
     imag = GetSetProperty(W_Complex64Box.descr_get_imag),
-)
\ No newline at end of file
+)
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -976,6 +976,22 @@
         assert isinstance(box, self.BoxType)
         return box.real, box.imag
 
+    def store(self, arr, i, offset, box):
+        real, imag = self.unbox(box)
+        raw_storage_setitem(arr.storage, i+offset, real)
+        raw_storage_setitem(arr.storage,
+                i+offset+rffi.sizeof(self._COMPONENTS_T), imag)
+
+    def _read(self, storage, i, offset):
+        real = raw_storage_getitem(self._COMPONENTS_T, storage, i + offset)
+        imag = raw_storage_getitem(self._COMPONENTS_T, storage,
+                              i + offset + rffi.sizeof(self._COMPONENTS_T))
+        return real, imag
+
+    def read(self, arr, i, offset, dtype=None):
+        real, imag = self._read(arr.storage, i, offset)
+        return self.box_complex(real, imag)
+
     @complex_binary_op
     def add(self, v1, v2):
         return rcomplex.c_add(v1, v2)


More information about the pypy-commit mailing list