n-dimensional tensor BLAS: SNRM2, DNRM2, SCNRM2, DZNRM2
euclidean norm sqrt(conj(xᐪ) × x)
SNRM2, DNRM2
import mir.ndslice.allocation: slice; import std.math: sqrt, approxEqual; auto x = slice!double(4); x[] = [0, 1, 2, 3]; assert(nrm2(x).approxEqual(sqrt(1.0 + 4 + 9)));
SCNRM2, DZNRM2
import mir.ndslice.allocation: slice; import std.math: sqrt, approxEqual; auto x = slice!cdouble(2); x[] = [0 + 1i, 2 + 3i]; assert(nrm2(x).approxEqual(sqrt(1.0 + 4 + 9)));
Returns the euclidean norm of a vector. Uses unrolled loops for stride equal to one.