MCPcopy Create free account
hub / github.com/numpy/numpy / _slow_array_clip

Function _slow_array_clip

numpy/core/src/multiarray/calculation.c:817–847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

815}
816
817static PyObject *
818_slow_array_clip(PyArrayObject *self, PyObject *min, PyObject *max, PyArrayObject *out)
819{
820 PyObject *res1=NULL, *res2=NULL;
821
822 if (max != NULL) {
823 res1 = _GenericBinaryOutFunction(self, max, out, n_ops.minimum);
824 if (res1 == NULL) {
825 return NULL;
826 }
827 }
828 else {
829 res1 = (PyObject *)self;
830 Py_INCREF(res1);
831 }
832
833 if (min != NULL) {
834 res2 = _GenericBinaryOutFunction((PyArrayObject *)res1,
835 min, out, n_ops.maximum);
836 if (res2 == NULL) {
837 Py_XDECREF(res1);
838 return NULL;
839 }
840 }
841 else {
842 res2 = res1;
843 Py_INCREF(res2);
844 }
845 Py_DECREF(res1);
846 return res2;
847}
848
849/*NUMPY_API
850 * Clip

Callers 1

PyArray_ClipFunction · 0.85

Calls 1

Tested by

no test coverage detected