n-dimensional slice composed of identical values, where n is dimension count.
auto sl = iota(3).repeat(4); assert(sl == [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]);
import mir.ndslice.dynamic : transposed; auto sl = iota(3) .repeat(4) .unpack .universal .transposed; assert(sl == [[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2]]);
import mir.ndslice.allocation; auto sl = iota([3], 6).slice; auto slC = sl.repeat(2, 3); sl[1] = 4; assert(slC == [[[6, 4, 8], [6, 4, 8], [6, 4, 8]], [[6, 4, 8], [6, 4, 8], [6, 4, 8]]]);
import mir.primitives: DeepElementType; auto sl = repeat(4.0, 2, 3); assert(sl == [[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]); static assert(is(DeepElementType!(typeof(sl)) == double)); sl[1, 1] = 3; assert(sl == [[3.0, 3.0, 3.0], [3.0, 3.0, 3.0]]);
Returns a slice with identical elements. RepeatSlice stores only single value.