A predicate.
import mir.ndslice.slice: sliced; auto s = [ 2, 6, 4, -3, 0, -4, -3, 3, -3, -2, 7, 2, ].sliced(3, 4); auto pos = s.minmaxPos; assert(pos[0] == s[$ - 2 .. $, $ - 3 .. $]); assert(pos[1] == s[$ - 1 .. $, $ - 2 .. $]); assert(pos[0].first == -4); assert(s.backward(pos[0].shape) == -4); assert(pos[1].first == 7); assert(s.backward(pos[1].shape) == 7);
minmaxIndex, minPos, maxPos, $(NDSLICEREF slice, Slice.backward).
Finds a positions (ndslices) such that position[0].first is minimal and position[1].first is maximal elements in the slice.
Position is sub-ndslice of the same dimension in the right-)down-)etc(( corner.