n-dimensional slice
import mir.ndslice.topology: iota; auto slice = iota(3, 4); assert(slice == [[0,1,2,3], [4,5,6,7], [8,9,10,11]]); // Template assert(slice.strided!0(2) == [[0,1,2,3], [8,9,10,11]]); assert(slice.strided!1(3) == [[0, 3], [4, 7], [8, 11]]); assert(slice.strided!(0, 1)(2, 3) == [[0, 3], [8, 11]]); // Function assert(slice.strided(0, 2) == [[0,1,2,3], [8,9,10,11]]); assert(slice.strided(1, 3) == [[0, 3], [4, 7], [8, 11]]); assert(slice.strided(0, 2).strided(1, 3) == [[0, 3], [8, 11]]);
import mir.ndslice.topology: iota, universal; static assert(iota(13, 40).universal.strided!(0, 1)(2, 5).shape == [7, 8]); static assert(iota(93).universal.strided!(0, 0)(7, 3).shape == [5]);
import mir.ndslice.topology: iota, canonical; auto slice = iota(3, 4).canonical; assert(slice == [[0,1,2,3], [4,5,6,7], [8,9,10,11]]); // Template assert(slice.strided!0(2) == [[0,1,2,3], [8,9,10,11]]); // Function assert(slice.strided(0, 2) == [[0,1,2,3], [8,9,10,11]]);
import mir.ndslice.topology: iota; // 0 1 2 3 // 4 5 6 7 // 8 9 10 11 assert(iota(3, 4).strided(2) == [[0, 2], [8, 10]]);
Multiplies the stride of the selected dimension by a factor.