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

Function array_count_nonzero

numpy/core/src/multiarray/multiarraymodule.c:2316–2337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2314}
2315
2316static PyObject *
2317array_count_nonzero(PyObject *NPY_UNUSED(self), PyObject *const *args, Py_ssize_t len_args)
2318{
2319 PyArrayObject *array;
2320 npy_intp count;
2321
2322 NPY_PREPARE_ARGPARSER;
2323 if (npy_parse_arguments("count_nonzero", args, len_args, NULL,
2324 "", PyArray_Converter, &array,
2325 NULL, NULL, NULL) < 0) {
2326 return NULL;
2327 }
2328
2329 count = PyArray_CountNonzero(array);
2330
2331 Py_DECREF(array);
2332
2333 if (count == -1) {
2334 return NULL;
2335 }
2336 return PyLong_FromSsize_t(count);
2337}
2338
2339static PyObject *
2340array_fromstring(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds)

Callers

nothing calls this directly

Calls 1

PyArray_CountNonzeroFunction · 0.85

Tested by

no test coverage detected