centralMoment

T
centralMoment
pure nothrow @property @nogc
(
T
)
(
in T[] arr
,
size_t k = 1
)
if (
is(typeof(T.init + T.init) == T) &&
is(typeof(T.init * T.init) == T)
&&
is(typeof(T.init / T.init) == T)
&&
is(typeof(T.init / 1UL) == T)
)
in { assert (arr.length > 0); }

Examples

auto a = [ 1.0f, 2, 3, 4 ];
assert( a.centralMoment(1) == 0 );
assert( a.centralMoment(2) == 1.25 );
assert( a.centralMoment(3) == 0 );

Meta