new view of a slice with dimension removed
AssertError if the length of the corresponding dimension doesn' equal 1.
import mir.ndslice.topology : iota; import mir.ndslice.allocation : slice; // [[0, 1, 2]] -> [0, 1, 2] assert([1, 3].iota.squeeze == [3].iota); // [[0], [1], [2]] -> [0, 1, 2] assert([3, 1].iota.squeeze!1 == [3].iota); assert([3, 1].iota.squeeze!(-1) == [3].iota); assert([1, 3].iota.canonical.squeeze == [3].iota); assert([3, 1].iota.canonical.squeeze!1 == [3].iota); assert([3, 1].iota.canonical.squeeze!(-1) == [3].iota); assert([1, 3].iota.universal.squeeze == [3].iota); assert([3, 1].iota.universal.squeeze!1 == [3].iota); assert([3, 1].iota.universal.squeeze!(-1) == [3].iota); assert([1, 3, 4].iota.squeeze == [3, 4].iota); assert([3, 1, 4].iota.squeeze!1 == [3, 4].iota); assert([3, 4, 1].iota.squeeze!(-1) == [3, 4].iota); assert([1, 3, 4].iota.canonical.squeeze == [3, 4].iota); assert([3, 1, 4].iota.canonical.squeeze!1 == [3, 4].iota); assert([3, 4, 1].iota.canonical.squeeze!(-1) == [3, 4].iota); assert([1, 3, 4].iota.universal.squeeze == [3, 4].iota); assert([3, 1, 4].iota.universal.squeeze!1 == [3, 4].iota); assert([3, 4, 1].iota.universal.squeeze!(-1) == [3, 4].iota);
Constructs a new view of an n-dimensional slice with dimension axis removed.