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

Function NpyIter_AdvancedNew

numpy/core/src/multiarray/nditer_constr.c:107–520  ·  view source on GitHub ↗

NUMPY_API * Allocate a new iterator for multiple array objects, and advanced * options for controlling the broadcasting, shape, and buffer size. */

Source from the content-addressed store, hash-verified

105 * options for controlling the broadcasting, shape, and buffer size.
106 */
107NPY_NO_EXPORT NpyIter *
108NpyIter_AdvancedNew(int nop, PyArrayObject **op_in, npy_uint32 flags,
109 NPY_ORDER order, NPY_CASTING casting,
110 npy_uint32 *op_flags,
111 PyArray_Descr **op_request_dtypes,
112 int oa_ndim, int **op_axes, npy_intp *itershape,
113 npy_intp buffersize)
114{
115 npy_uint32 itflags = NPY_ITFLAG_IDENTPERM;
116 int idim, ndim;
117 int iop;
118
119 /* The iterator being constructed */
120 NpyIter *iter;
121
122 /* Per-operand values */
123 PyArrayObject **op;
124 PyArray_Descr **op_dtype;
125 npyiter_opitflags *op_itflags;
126 char **op_dataptr;
127
128 npy_int8 *perm;
129 NpyIter_BufferData *bufferdata = NULL;
130 int any_allocate = 0, any_missing_dtypes = 0, need_subtype = 0;
131
132 /* The subtype for automatically allocated outputs */
133 double subtype_priority = NPY_PRIORITY;
134 PyTypeObject *subtype = &PyArray_Type;
135
136#if NPY_IT_CONSTRUCTION_TIMING
137 npy_intp c_temp,
138 c_start,
139 c_check_op_axes,
140 c_check_global_flags,
141 c_calculate_ndim,
142 c_malloc,
143 c_prepare_operands,
144 c_fill_axisdata,
145 c_compute_index_strides,
146 c_apply_forced_iteration_order,
147 c_find_best_axis_ordering,
148 c_get_priority_subtype,
149 c_find_output_common_dtype,
150 c_check_casting,
151 c_allocate_arrays,
152 c_coalesce_axes,
153 c_prepare_buffers;
154#endif
155
156 NPY_IT_TIME_POINT(c_start);
157
158 if (nop > NPY_MAXARGS) {
159 PyErr_Format(PyExc_ValueError,
160 "Cannot construct an iterator with more than %d operands "
161 "(%d were requested)", NPY_MAXARGS, nop);
162 return NULL;
163 }
164

Callers 12

npyiter_initFunction · 0.85
NpyIter_NestedItersFunction · 0.85
NpyIter_MultiNewFunction · 0.85
NpyIter_NewFunction · 0.85
PyArray_MapIterNewFunction · 0.85
PyUFunc_ReduceWrapperFunction · 0.85
execute_ufunc_loopFunction · 0.85
PyUFunc_AccumulateFunction · 0.85
PyUFunc_ReduceatFunction · 0.85
ufunc_at__slow_iterFunction · 0.85

Tested by

no test coverage detected