window weight slice
import numir.signal; import std.meta : AliasSeq; import mir.ndslice : maxIndex; import std.math : approxEqual; // test windows are symmetry and peaked at median auto n = 11; static foreach (wfun; AliasSeq!(blackman, hann)) {{ auto w = wfun(n); assert(w.maxIndex[0] == n / 2); foreach (i; 0 .. n / 2 - 1) { assert(w[i].approxEqual(w[$ - 1 - i])); } }}
Hann window slice generator