Author: Maciej Fijalkowski <[email protected]>
Branch: missing-ndarray-attributes
Changeset: r58637:02887579c3d1
Date: 2012-10-29 15:46 +0100
http://bitbucket.org/pypy/pypy/changeset/02887579c3d1/
Log: conjugate
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
@@ -422,10 +422,6 @@
loop.clip(space, self, shape, min, max, out)
return out
- def descr_conj(self, space):
- raise OperationError(space.w_NotImplementedError, space.wrap(
- "conj not implemented yet"))
-
def descr_ctypes(self, space):
raise OperationError(space.w_NotImplementedError, space.wrap(
"ctypes not implemented yet"))
@@ -467,10 +463,6 @@
raise OperationError(space.w_NotImplementedError, space.wrap(
"getfield not implemented yet"))
- def descr_imag(self, space):
- raise OperationError(space.w_NotImplementedError, space.wrap(
- "imag not implemented yet"))
-
def descr_itemset(self, space, w_arg):
raise OperationError(space.w_NotImplementedError, space.wrap(
"itemset not implemented yet"))
@@ -488,10 +480,6 @@
raise OperationError(space.w_NotImplementedError, space.wrap(
"put not implemented yet"))
- def descr_real(self, space):
- raise OperationError(space.w_NotImplementedError, space.wrap(
- "real not implemented yet"))
-
def descr_resize(self, space, w_new_shape, w_refcheck=True):
raise OperationError(space.w_NotImplementedError, space.wrap(
"resize not implemented yet"))
@@ -557,6 +545,8 @@
descr_get_real = _unaryop_impl("real")
descr_get_imag = _unaryop_impl("imag")
+ descr_conj = _unaryop_impl('conjugate')
+
def descr_nonzero(self, space):
if self.get_size() > 1:
raise OperationError(space.w_ValueError, space.wrap(
@@ -804,6 +794,7 @@
item = interp2app(W_NDimArray.descr_item),
real = GetSetProperty(W_NDimArray.descr_get_real),
imag = GetSetProperty(W_NDimArray.descr_get_imag),
+ conj = interp2app(W_NDimArray.descr_conj),
argsort = interp2app(W_NDimArray.descr_argsort),
astype = interp2app(W_NDimArray.descr_astype),
diff --git a/pypy/module/micronumpy/test/test_complex.py
b/pypy/module/micronumpy/test/test_complex.py
--- a/pypy/module/micronumpy/test/test_complex.py
+++ b/pypy/module/micronumpy/test/test_complex.py
@@ -552,6 +552,12 @@
assert(real(c2) == 3.0)
assert(imag(c2) == 4.0)
+ def test_conj(self):
+ from _numpypy import array
+
+ a = array([1 + 2j, 1 - 2j])
+ assert (a.conj() == [1 - 2j, 1 + 2j]).all()
+
def test_math(self):
if self.isWindows:
skip('windows does not support c99 complex')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit