mean_variance

T[2]
mean_variance
pure nothrow @property @nogc
(
T
)
(
in T[] arr
)
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 > 1); }

Return Value

Type: T[2]

mean (0 element), variance (1 element)

Examples

1 auto a = [ 1.0f, 1, 1 ];
2 assert( a.mean_variance == [ 1.0f, 0.0f ] );
3 
4 auto b = [ 1.0f, 2, 3 ];
5 assert( b.mean_variance == [ 2.0f, 1.0f ] );
import des.math.linear.vector;

auto a = [ vec3(1,2,3), vec3(2,3,4), vec3(3,4,5) ];
assert( a.mean_variance == [ vec3(2,3,4), vec3(1,1,1) ] );

Meta