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

Function PyArray_Trace

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

NUMPY_API * Trace */

Source from the content-addressed store, hash-verified

1207 * Trace
1208 */
1209NPY_NO_EXPORT PyObject *
1210PyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2,
1211 int rtype, PyArrayObject *out)
1212{
1213 PyObject *diag = NULL, *ret = NULL;
1214
1215 diag = PyArray_Diagonal(self, offset, axis1, axis2);
1216 if (diag == NULL) {
1217 return NULL;
1218 }
1219 ret = PyArray_GenericReduceFunction((PyArrayObject *)diag, n_ops.add, -1, rtype, out);
1220 Py_DECREF(diag);
1221 return ret;
1222}

Callers 1

array_traceFunction · 0.85

Calls 2

PyArray_DiagonalFunction · 0.85

Tested by

no test coverage detected