expand

expand dimension i.e. repeat n time on dim

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

Examples

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

Meta