maxElement

Returns the minimal(maximal) element of a multidimensional slice.

@fmamath
template maxElement (
alias pred = "a < b"
) {}

Parameters

pred

A predicate.

Examples

import mir.ndslice.slice: sliced;
auto s = [
    2, 6, 4, -3,
    0, -4, -3, 3,
    -3, -2, 7, 8,
    ].sliced(3, 4);

assert(s.minElement == -4);
assert(s.maxElement == 8);
import mir.ndslice.slice: sliced;
auto s = [
    -8, 6, 4, -3,
    0, -4, -3, 3,
    -3, -2, 7, 8,
    ].sliced(3, 4);

assert(s.minElement == -8);

See Also

minIndex, maxElement, maxIndex, maxPos.