diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/number.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c index 1f5523b90..d86cef5a1 100644 --- a/numpy/core/src/multiarray/number.c +++ b/numpy/core/src/multiarray/number.c @@ -565,7 +565,7 @@ array_negative(PyArrayObject *m1) static PyObject * array_absolute(PyArrayObject *m1) { - if (can_elide_temp_unary(m1)) { + if (can_elide_temp_unary(m1) && !PyArray_ISCOMPLEX(m1)) { return PyArray_GenericInplaceUnaryFunction(m1, n_ops.absolute); } return PyArray_GenericUnaryFunction(m1, n_ops.absolute); diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 835d03528..44dd17496 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -2850,6 +2850,9 @@ class TestBinop(object): d = f.astype(np.float64) assert_equal(((f + f) + d).dtype, np.dtype('f8')) + c = np.ones(100000, dtype=np.complex) + assert_equal(abs(c * 2.0).dtype, np.dtype('f8')) + def test_elide_broadcast(self): # test no elision on broadcast to higher dimension # only triggers elision code path in debug mode as triggering it in |