expand

expand dimension i.e. repeat n time on dim

expand
(
size_t dim
S
)
(
S s
,
size_t n
)
if (
isSlice!S
)

Examples

1 import mir.ndslice;
2 assert(iota(1, 1, 3).expand!1(3) ==
3        [[[0,1,2],[0,1,2],[0,1,2]]]);
4 assert(iota(1, 1, 3).expand!0(2).expand!1(3) ==
5        [[[0,1,2],[0,1,2],[0,1,2]],
6         [[0,1,2],[0,1,2],[0,1,2]]]);
7 assert(iota(1, 3, 2).expand!0(2) == iota(3, 2).repeat(2).unpack);

Meta