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

Function add_loop

numpy/core/src/umath/string_ufuncs.cpp:195–213  ·  view source on GitHub ↗

* This function replaces the strided loop with the passed in one, * and registers it with the given ufunc. */

Source from the content-addressed store, hash-verified

193 * and registers it with the given ufunc.
194 */
195static int
196add_loop(PyObject *umath, const char *ufunc_name,
197 PyArrayMethod_Spec *spec, PyArrayMethod_StridedLoop *loop)
198{
199 PyObject *name = PyUnicode_FromString(ufunc_name);
200 if (name == nullptr) {
201 return -1;
202 }
203 PyObject *ufunc = PyObject_GetItem(umath, name);
204 Py_DECREF(name);
205 if (ufunc == nullptr) {
206 return -1;
207 }
208 spec->slots[0].pfunc = (void *)loop;
209
210 int res = PyUFunc_AddLoopFromSpec(ufunc, spec);
211 Py_DECREF(ufunc);
212 return res;
213}
214
215
216template<bool rstrip, typename character, COMP...>

Callers 1

operator()Method · 0.85

Calls 1

PyUFunc_AddLoopFromSpecFunction · 0.85

Tested by

no test coverage detected