amax

Takes the sum of the |Re(.)| + |Im(.)|'s of a vector and returns a single precision result.

@fastmath
amax
(
SliceKind kind
size_t N
Iterator
)
(
Slice!(Iterator, N, kind) x
)

Parameters

x Slice!(Iterator, N, kind)

n-dimensional tensor BLAS: SASUM, DASUM, SCASUM, DZASUM

Return Value

Type: auto

sum of the |Re(.)| + |Im(.)|'s

Examples

import mir.ndslice.allocation: slice;
auto x = slice!double(6);
x[] = [0, -1, -2, -7, 6, 2];
assert(amax(x) == 7);
// 0 for empty vectors
assert(amax(x[0 .. 0]) == 0);
import mir.ndslice.allocation: slice;

auto x = slice!cdouble(4);
x[] = [0 + -1i, -7 + 3i, 2 + 3i, 2 + 2i];

assert(amax(x) == 10);
// 0 for empty vectors
assert(amax(x[$ .. $]) == 0);

Meta