input slice
n-dimensional slice
Template
import mir.ndslice.slice; import mir.ndslice.topology: iota; assert(iota(3, 4, 5, 6, 7) .transposed!(3, 1, 0) .shape == cast(size_t[5])[6, 4, 3, 5, 7]); assert(iota(3, 4, 5, 6, 7) .transposed!(4, 1, 0) .shape == cast(size_t[5])[7, 4, 3, 5, 6]);
Function
import mir.ndslice.slice; import mir.ndslice.topology: iota; assert(iota(3, 4, 5, 6, 7) .transposed(3, 1, 0) .shape == cast(size_t[5])[6, 4, 3, 5, 7]); assert(iota(3, 4, 5, 6, 7) .transposed(4, 1, 0) .shape == cast(size_t[5])[7, 4, 3, 5, 6]);
Single-argument function
import mir.ndslice.slice; import mir.ndslice.topology: iota; assert(iota(3, 4, 5, 6, 7) .transposed(3) .shape == cast(size_t[5])[6, 3, 4, 5, 7]); assert(iota(3, 4, 5, 6, 7) .transposed(4) .shape == cast(size_t[5])[7, 3, 4, 5, 6]);
_2-dimensional transpose
import mir.ndslice.slice; import mir.ndslice.topology: iota; assert(iota(3, 4) .transposed .shape == cast(size_t[2])[4, 3]);
N-dimensional transpose operator. Brings selected dimensions to the first position.