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

Function npyiter_reverse_axis_ordering

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

Source from the content-addressed store, hash-verified

2234}
2235
2236static void
2237npyiter_reverse_axis_ordering(NpyIter *iter)
2238{
2239 npy_uint32 itflags = NIT_ITFLAGS(iter);
2240 int ndim = NIT_NDIM(iter);
2241 int nop = NIT_NOP(iter);
2242
2243 npy_intp i, temp, size;
2244 npy_intp *first, *last;
2245 npy_int8 *perm;
2246
2247 size = NIT_AXISDATA_SIZEOF(itflags, ndim, nop)/NPY_SIZEOF_INTP;
2248 first = (npy_intp*)NIT_AXISDATA(iter);
2249 last = first + (ndim-1)*size;
2250
2251 /* This loop reverses the order of the AXISDATA array */
2252 while (first < last) {
2253 for (i = 0; i < size; ++i) {
2254 temp = first[i];
2255 first[i] = last[i];
2256 last[i] = temp;
2257 }
2258 first += size;
2259 last -= size;
2260 }
2261
2262 /* Store the perm we applied */
2263 perm = NIT_PERM(iter);
2264 for(i = ndim-1; i >= 0; --i, ++perm) {
2265 *perm = (npy_int8)i;
2266 }
2267
2268 NIT_ITFLAGS(iter) &= ~NPY_ITFLAG_IDENTPERM;
2269}
2270
2271static inline npy_intp
2272intp_abs(npy_intp x)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected