A predicate.
import mir.ndslice.slice: sliced; auto s = [ 2, 6, 4, -3, 0, -4, -3, 3, -3, -2, 7, 8, ].sliced(3, 4); auto index = s.minIndex; assert(index == [1, 1]); assert(s[index] == -4); index = s.maxIndex; assert(index == [2, 3]); assert(s[index] == 8);
import mir.ndslice.slice: sliced; auto s = [ -8, 6, 4, -3, 0, -4, -3, 3, -3, -2, 7, 8, ].sliced(3, 4); auto index = s.minIndex; assert(index == [0, 0]); assert(s[index] == -8);
Finds an index such that slice[index] is minimal(maximal).