diff options
| author | Tim Hochberg <tim_hochberg@local> | 2006-06-19 21:14:39 +0000 |
|---|---|---|
| committer | Tim Hochberg <tim_hochberg@local> | 2006-06-19 21:14:39 +0000 |
| commit | 1dc30f8d0bcc069afe3a2eadcc9d7f7121e64a94 (patch) | |
| tree | 46a89016ea5f4233e306b86e31e3156c900a84c4 /numpy | |
| parent | 4eca92870b244259efee5585c6a856dd1e35ec87 (diff) | |
| download | numpy-1dc30f8d0bcc069afe3a2eadcc9d7f7121e64a94.tar.gz | |
**= Was being invoked twice when it should have gone through the fast path. Fixed and added a test that should capture it. Results was that that [0, 1, 2] **= 2 => [0, 1, 16].
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/src/arrayobject.c | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_umath.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 360694a94..7053eb81d 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -2999,7 +2999,7 @@ fast_scalar_power(PyArrayObject *a1, PyObject *o2, int inplace) { return NULL; } if (inplace) { - PyArray_GenericInplaceUnaryFunction(a1, + return PyArray_GenericInplaceUnaryFunction(a1, fastop); } else { return PyArray_GenericUnaryFunction(a1, diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 618186106..e26b231b2 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -12,6 +12,9 @@ class test_power(ScipyTestCase): assert_equal(x**0, [1., 1., 1.]) assert_equal(x**1, x) assert_equal(x**2, [1., 4., 9.]) + y = x.copy() + y **= 2 + assert_equal(y, [1., 4., 9.]) assert_almost_equal(x**(-1), [1., 0.5, 1./3]) assert_almost_equal(x**(0.5), [1., ncu.sqrt(2), ncu.sqrt(3)]) |
