* Undo the axis permutation of the iterator. When the operand has fewer * dimensions then the iterator, this can return negative values for * inserted (broadcast) dimensions. * * @param axis Axis for which to undo the iterator axis permutation. * @param ndim If `op_axes` is being used, this is the iterator dimension, * otherwise this is the operand dimension. * @param perm The i
| 333 | * `op_axes` this indexes into `op_axes` (unpermuted iterator axis) |
| 334 | */ |
| 335 | static inline int |
| 336 | npyiter_undo_iter_axis_perm( |
| 337 | int axis, int ndim, const npy_int8 *perm, npy_bool *axis_flipped) |
| 338 | { |
| 339 | npy_int8 p = perm[axis]; |
| 340 | /* The iterator treats axis reversed, thus adjust by ndim */ |
| 341 | npy_bool flipped = p < 0; |
| 342 | if (axis_flipped != NULL) { |
| 343 | *axis_flipped = flipped; |
| 344 | } |
| 345 | if (flipped) { |
| 346 | axis = ndim + p; |
| 347 | } |
| 348 | else { |
| 349 | axis = ndim - p - 1; |
| 350 | } |
| 351 | return axis; |
| 352 | } |
| 353 | |
| 354 | NPY_NO_EXPORT void |
| 355 | npyiter_coalesce_axes(NpyIter *iter); |
no outgoing calls
no test coverage detected