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

Function PyUFunc_GeneralizedFunctionInternal

numpy/core/src/umath/ufunc_object.c:2180–2654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2178}
2179
2180static int
2181PyUFunc_GeneralizedFunctionInternal(PyUFuncObject *ufunc,
2182 PyArrayMethodObject *ufuncimpl, PyArray_Descr *operation_descrs[],
2183 PyArrayObject *op[], PyObject *extobj,
2184 NPY_CASTING casting, NPY_ORDER order,
2185 PyObject *axis, PyObject *axes, int keepdims)
2186{
2187 int nin, nout;
2188 int i, j, idim, nop;
2189 const char *ufunc_name;
2190 int retval;
2191 int needs_api = 0;
2192
2193 /* Use remapped axes for generalized ufunc */
2194 int broadcast_ndim, iter_ndim;
2195 int op_core_num_dims[NPY_MAXARGS];
2196 int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
2197 int *op_axes[NPY_MAXARGS];
2198 npy_uint32 core_dim_flags[NPY_MAXARGS];
2199
2200 npy_uint32 op_flags[NPY_MAXARGS];
2201 npy_intp iter_shape[NPY_MAXARGS];
2202 NpyIter *iter = NULL;
2203 npy_uint32 iter_flags;
2204 npy_intp total_problem_size;
2205
2206 /* These parameters come from extobj= or from a TLS global */
2207 int buffersize = 0, errormask = 0;
2208
2209 /* The dimensions which get passed to the inner loop */
2210 npy_intp inner_dimensions[NPY_MAXDIMS+1];
2211 /* The strides which get passed to the inner loop */
2212 npy_intp *inner_strides = NULL;
2213 /* Auxiliary data allocated by the ufuncimpl (ArrayMethod) */
2214 NpyAuxData *auxdata = NULL;
2215
2216 /* The sizes of the core dimensions (# entries is ufunc->core_num_dim_ix) */
2217 npy_intp *core_dim_sizes = inner_dimensions + 1;
2218 int core_dim_ixs_size;
2219 /* swapping around of axes */
2220 int *remap_axis_memory = NULL;
2221 int **remap_axis = NULL;
2222
2223 nin = ufunc->nin;
2224 nout = ufunc->nout;
2225 nop = nin + nout;
2226
2227 ufunc_name = ufunc_get_name_cstr(ufunc);
2228
2229 NPY_UF_DBG_PRINT1("\nEvaluating ufunc %s\n", ufunc_name);
2230
2231 if (validate_casting(ufuncimpl,
2232 ufunc, op, operation_descrs, casting) < 0) {
2233 return -1;
2234 }
2235
2236 /* Initialize possibly variable parts to the values from the ufunc */
2237 retval = _initialize_variable_parts(ufunc, op_core_num_dims,

Callers 1

ufunc_generic_fastcallFunction · 0.85

Calls 15

ufunc_get_name_cstrFunction · 0.85
validate_castingFunction · 0.85
_check_keepdims_supportFunction · 0.85
_check_axis_supportFunction · 0.85
_validate_num_dimsFunction · 0.85
PyArray_NDIMFunction · 0.85
_parse_axis_argFunction · 0.85
_parse_axes_argFunction · 0.85
_get_coredim_sizesFunction · 0.85
_get_bufsize_errmaskFunction · 0.85
_ufunc_setup_flagsFunction · 0.85

Tested by

no test coverage detected