contiguous or canonical slice
canonical slice
auto slice = iota(2, 3).canonical; assert(slice == [[0, 1, 2], [3, 4, 5]]); assert(slice._lengths == [2, 3]); assert(slice._strides == [3]);
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 canonicaldf = dataframe.canonical; assert(canonicaldf._lengths == [2, 3]); assert(canonicaldf._strides == [3]); assert(is(typeof(canonicaldf) == Slice!(double*, 2, Canonical, int*, string*))); assert(canonicaldf.label!0[0] == 1); assert(canonicaldf.label!1[1] == "Label2");
Converts a slice to canonical kind.