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

Function array_compress

numpy/core/src/multiarray/methods.c:2527–2551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2525}
2526
2527static PyObject *
2528array_compress(PyArrayObject *self, PyObject *args, PyObject *kwds)
2529{
2530 int axis = NPY_MAXDIMS;
2531 PyObject *condition;
2532 PyArrayObject *out = NULL;
2533 static char *kwlist[] = {"condition", "axis", "out", NULL};
2534
2535 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O&O&:compress", kwlist,
2536 &condition,
2537 PyArray_AxisConverter, &axis,
2538 PyArray_OutputConverter, &out)) {
2539 return NULL;
2540 }
2541
2542 PyObject *ret = PyArray_Compress(self, condition, axis, out);
2543
2544 /* this matches the unpacking behavior of ufuncs */
2545 if (out == NULL) {
2546 return PyArray_Return((PyArrayObject *)ret);
2547 }
2548 else {
2549 return ret;
2550 }
2551}
2552
2553
2554static PyObject *

Callers

nothing calls this directly

Calls 2

PyArray_CompressFunction · 0.85
PyArray_ReturnFunction · 0.85

Tested by

no test coverage detected