a slice
canonical slice
auto slice = iota(2, 3).universal.assumeContiguous; assert(slice == [[0, 1, 2], [3, 4, 5]]); assert(slice._lengths == [2, 3]); static assert(slice._strides.length == 0);
import mir.ndslice.slice; import mir.ndslice.allocation: slice; auto dataframe = slice!(double, int, string)(2, 3); dataframe.label[] = [1, 2]; dataframe.label!1[] = ["Label1", "Label2", "Label3"]; auto assmcontdf = dataframe.canonical.assumeContiguous; assert(assmcontdf._lengths == [2, 3]); static assert(assmcontdf._strides.length == 0); assert(is(typeof(assmcontdf) == Slice!(double*, 2, Contiguous, int*, string*))); assert(assmcontdf.label!0[0] == 1); assert(assmcontdf.label!1[1] == "Label2");
Converts a slice to contiguous kind (unsafe).