diff options
author | Travis E. Oliphant <teoliphant@gmail.com> | 2012-02-13 10:41:01 -0600 |
---|---|---|
committer | Travis E. Oliphant <teoliphant@gmail.com> | 2012-02-13 10:41:01 -0600 |
commit | d4ec9096aebb7e9eef2adaa85db9c266eda943b1 (patch) | |
tree | 54684ab5f93f83bce2286ec29bc771e9a6c61bab | |
parent | aa2b608d2faf417bbf0fdb018d0c2b94082c0683 (diff) | |
download | numpy-d4ec9096aebb7e9eef2adaa85db9c266eda943b1.tar.gz |
Add comment.
-rw-r--r-- | numpy/core/src/multiarray/number.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c index 9874eb8d4..66bc14368 100644 --- a/numpy/core/src/multiarray/number.c +++ b/numpy/core/src/multiarray/number.c @@ -275,8 +275,14 @@ array_remainder(PyArrayObject *m1, PyObject *m2) return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder); } +/* Determine if object is a scalar and if so, convert the object + * to a double and place it in the out_exponent argument + * and return the "scalar kind" as a result. If the object is + * not a scalar (or if there are other error conditions) + * return NPY_NOSCALAR, and out_exponent is undefined. + */ static NPY_SCALARKIND -array_power_is_scalar(PyObject *o2, double* out_exponent) +is_scalar_with_conversion(PyObject *o2, double* out_exponent) { PyObject *temp; const int optimize_fpexps = 1; @@ -343,7 +349,7 @@ fast_scalar_power(PyArrayObject *a1, PyObject *o2, int inplace) double exponent; NPY_SCALARKIND kind; /* NPY_NOSCALAR is not scalar */ - if (PyArray_Check(a1) && ((kind=array_power_is_scalar(o2, &exponent))>0)) { + if (PyArray_Check(a1) && ((kind=is_scalar_with_conversion(o2, &exponent))>0)) { PyObject *fastop = NULL; if (PyArray_ISFLOAT(a1) || PyArray_ISCOMPLEX(a1)) { if (exponent == 1.0) { |