normalizeStructure

Reverses iteration order for dimensions with negative strides, they become not negative; and sorts dimensions according to the strides, dimensions with larger strides are going first.

@optmath
bool
normalizeStructure
(
Iterator
size_t N
SliceKind kind
)
(
ref Slice!(Iterator, N, kind) slice
)

Parameters

slice Slice!(Iterator, N, kind)

a slice to normalize dimension

Return Value

Type: bool

true if the slice can be safely casted to Contiguous kind using assumeContiguous and false otherwise.

Examples

import mir.ndslice.topology: iota;

auto g = iota(2, 3); //contiguous
auto c = g.reversed!0; //canonical
auto u = g.transposed.allReversed; //universal

assert(g.normalizeStructure);
assert(c.normalizeStructure);
assert(u.normalizeStructure);

assert(c == g);
assert(u == g);

c.popFront!1;
u.popFront!1;

assert(!c.normalizeStructure);
assert(!u.normalizeStructure);

Meta