asum

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

  1. F asum(Slice!(Iterator, N, kind) x)
  2. auto asum(Slice!(Iterator, N, kind) x)
    @fastmath
    asum
    (
    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

SASUM, DASUM

import mir.ndslice.allocation: slice;
auto x = slice!double(4);
x[] = [0, -1, -2, 3];
assert(asum(x) == 1 + 2 + 3);

SCASUM, DZASUM

import mir.ndslice.allocation: slice;

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

assert(asum(x) == 1 + 2 + 3);

Meta