sqnrm2

Forms the square of the euclidean norm. Uses unrolled loops for stride equal to one.

  1. F sqnrm2(Slice!(Iterator, N, kind) x)
  2. auto sqnrm2(Slice!(Iterator, N, kind) x)
    @fastmath
    sqnrm2
    (
    SliceKind kind
    size_t N
    Iterator
    )
    (
    Slice!(Iterator, N, kind) x
    )

Parameters

x Slice!(Iterator, N, kind)

n-dimensional tensor

Return Value

Type: auto

conj(xᐪ) × x

Examples

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

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

assert(sqnrm2(x) == 1.0 + 4 + 9);

Meta