ISAMAX, IDAMAX
import mir.ndslice.allocation: slice; auto x = slice!double(6); // 0 1 2 3 4 5 x[] = [0, -1, -2, -3, 3, 2]; assert(iamax(x) == 3); // -1 for empty vectors assert(iamax(x[0 .. 0]) == -1);
ICAMAX, IZAMAX
import mir.ndslice.allocation: slice; auto x = slice!cdouble(4); // 0 1 2 3 x[] = [0 + -1i, -2 + 3i, 2 + 3i, 2 + 2i]; assert(iamax(x) == 1); // -1 for empty vectors assert(iamax(x[$ .. $]) == -1);
Finds the index of the first element having maximum |Re(.)| + |Im(.)|. Return: index of the first element having maximum |Re(.)| + |Im(.)|