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

Function array_take

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

Source from the content-addressed store, hash-verified

109
110
111static PyObject *
112array_take(PyArrayObject *self,
113 PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames)
114{
115 int dimension = NPY_MAXDIMS;
116 PyObject *indices;
117 PyArrayObject *out = NULL;
118 NPY_CLIPMODE mode = NPY_RAISE;
119 NPY_PREPARE_ARGPARSER;
120
121 if (npy_parse_arguments("take", args, len_args, kwnames,
122 "indices", NULL, &indices,
123 "|axis", &PyArray_AxisConverter, &dimension,
124 "|out", &PyArray_OutputConverter, &out,
125 "|mode", &PyArray_ClipmodeConverter, &mode,
126 NULL, NULL, NULL) < 0) {
127 return NULL;
128 }
129
130 PyObject *ret = PyArray_TakeFrom(self, indices, dimension, out, mode);
131
132 /* this matches the unpacking behavior of ufuncs */
133 if (out == NULL) {
134 return PyArray_Return((PyArrayObject *)ret);
135 }
136 else {
137 return ret;
138 }
139}
140
141static PyObject *
142array_fill(PyArrayObject *self, PyObject *args)

Callers

nothing calls this directly

Calls 2

PyArray_TakeFromFunction · 0.85
PyArray_ReturnFunction · 0.85

Tested by

no test coverage detected