Reverses the direction of iteration for all dimensions.
Returns maximal multidimensional cube.
Reverses the order of dimensions.
Reverses iteration order for dimensions with negative strides, they become not negative; and sorts dimensions according to the strides, dimensions with larger strides are going first.
Reverses the direction of iteration for selected dimensions.
Rotates two selected dimensions by k*90 degrees. The order of dimensions is important. If the slice has two dimensions, the default direction is counterclockwise.
Multiplies the stride of the selected dimension by a factor.
Swaps two dimensions.
N-dimensional transpose operator. Brings selected dimensions to the first position.
Reverses the direction of iteration for selected dimensions.
Rotates two selected dimensions by k*90 degrees. The order of dimensions is important. If the slice has two dimensions, the default direction is counterclockwise.
Multiplies the stride of the selected dimension by a factor.
Swaps two dimensions.
N-dimensional transpose operator. Brings selected dimensions to the first position.
This is a submodule of mir.ndslice.
Operators only change strides and lengths of a slice. The range of a slice remains unmodified. All operators return slice as the type of the argument, maybe except slice kind.
Transpose operators
iota(3, 4, 5, 6, 7).transposed!(4, 0, 1).shape returns [7, 3, 4, 5, 6].
iota(3, 4, 5).swapped!(1, 2).shape returns [3, 5, 4].
iota(3, 4, 5).everted.shape returns [5, 4, 3].
See also evertPack.
Iteration operators
iota(13, 40).strided!(0, 1)(2, 5).shape equals to [7, 8].
slice.reversed!0 returns the slice with reversed direction of iteration for top level dimension.
iota(4, 5).allReversed equals to 20.iota.retro.sliced(4, 5).
Other operators
iota(2, 3).rotated equals to [[2, 5], [1, 4], [0, 3]].
Bifacial operators
Some operators are bifacial, i.e. they have two versions: one with template parameters, and another one with function parameters. Versions with template parameters are preferable because they allow compile time checks and can be optimized better.
$(TR $(TDNW $(LREF swapped)) $(TD No) $(TD <tt class="inline-code">slice.swapped!(2, 3)</tt>) $(TD <tt class="inline-code">slice.swapped(2, 3)</tt>)) $(TR $(TDNW $(LREF rotated)) $(TD No) $(TD <tt class="inline-code">slice.rotated!(2, 3)(-1)</tt>) $(TD <tt class="inline-code">slice.rotated(2, 3, -1)</tt>)) $(TR $(TDNW $(LREF strided)) $(TD Yes/No) $(TD <tt class="inline-code">slice.strided!(1, 2)(20, 40)</tt>) $(TD <tt class="inline-code">slice.strided(1, 20).strided(2, 40)</tt>)) $(TR $(TDNW $(LREF transposed)) $(TD Yes) $(TD <tt class="inline-code">slice.transposed!(1, 4, 3)</tt>) $(TD <tt class="inline-code">slice.transposed(1, 4, 3)</tt>)) $(TR $(TDNW $(LREF reversed)) $(TD Yes) $(TD <tt class="inline-code">slice.reversed!(0, 2)</tt>) $(TD <tt class="inline-code">slice.reversed(0, 2)</tt>))
Bifacial interface of drop, dropBack dropExactly, and dropBackExactly is identical to that of strided.
Bifacial interface of dropOne and dropBackOne is identical to that of reversed.