NUMPY_API * Ptp */
| 269 | * Ptp |
| 270 | */ |
| 271 | NPY_NO_EXPORT PyObject * |
| 272 | PyArray_Ptp(PyArrayObject *ap, int axis, PyArrayObject *out) |
| 273 | { |
| 274 | PyArrayObject *arr; |
| 275 | PyObject *ret; |
| 276 | PyObject *obj1 = NULL, *obj2 = NULL; |
| 277 | |
| 278 | arr=(PyArrayObject *)PyArray_CheckAxis(ap, &axis, 0); |
| 279 | if (arr == NULL) { |
| 280 | return NULL; |
| 281 | } |
| 282 | obj1 = PyArray_Max(arr, axis, out); |
| 283 | if (obj1 == NULL) { |
| 284 | goto fail; |
| 285 | } |
| 286 | obj2 = PyArray_Min(arr, axis, NULL); |
| 287 | if (obj2 == NULL) { |
| 288 | goto fail; |
| 289 | } |
| 290 | Py_DECREF(arr); |
| 291 | if (out) { |
| 292 | ret = PyObject_CallFunction(n_ops.subtract, "OOO", out, obj2, out); |
| 293 | } |
| 294 | else { |
| 295 | ret = PyNumber_Subtract(obj1, obj2); |
| 296 | } |
| 297 | Py_DECREF(obj1); |
| 298 | Py_DECREF(obj2); |
| 299 | return ret; |
| 300 | |
| 301 | fail: |
| 302 | Py_XDECREF(arr); |
| 303 | Py_XDECREF(obj1); |
| 304 | Py_XDECREF(obj2); |
| 305 | return NULL; |
| 306 | } |
| 307 | |
| 308 | |
| 309 |
nothing calls this directly
no test coverage detected