concatenated slices
import mir.ndslice.fuse : fuse; import mir.ndslice.topology : universal; import mir.ndslice.dynamic : transposed; auto m = fuse([[1, 2],[3, 4]]); auto u = fuse([[5, 6]]); assert(concatenate(m, u) == [[1, 2], [3, 4], [5, 6]]); assert(concatenate(u, m) == [[5, 6], [1, 2], [3, 4]]); auto uT = u.universal.transposed; assert(concatenate!1(m, uT) == [[1, 2, 5], [3, 4, 6]]);
import mir.ndslice.fuse : fuse; import mir.ndslice.topology : iota; assert(concatenate!0([[0, 1]].fuse, [[2, 3]].fuse, [[4, 5]].fuse) == iota(3, 2)); assert(concatenate!1([[0, 1]].fuse, [[2, 3]].fuse, [[4, 5]].fuse) == [iota(6)]); // axis=-1 is the same to axis=$-1 assert(concatenate!(-1)([[0, 1]].fuse, [[2, 3]].fuse, [[4, 5]].fuse) == [iota(6)]); assert(concatenate!(-1)([[0, 1]].fuse, [[2]].fuse) == [[0, 1, 2]]);
Join multiple slices along an axis.