Matrix.Mean Method

Overload List

#SignatureDescription
1Double MeanMean value.
└ indexed: Double Mean(Int32 Index, Int32 Len)
2void Mean(ref Double AMean, Int32 Index, Int32 Len)Calculate the mean value from calling object elements [Index]..[Index+Len-1].

Overload 1: Double Mean

Mean value.

Returns: Double

Remarks:

Calculate the mean value of all calling object elements. The result is a real value. An exception is raised if calling object Dew.Math.Matrix.Complex property is true.

Examples
Matrix a = new Matrix();
a.SetIt(2, 2, false, new double[] { 1.0, 2.0, 3.0, 4.0 });
double result = a.Mean();
if (Math.Abs(result - 2.5) > 1e-10)
    throw new Exception("Matrix.Mean: expected 2.5, got " + result);
Matrix a;
double b;
a.SetIt(4,1,false,new double[] {1,2,3,4});
b = a.Mean; // b = 2.5
See Also: Matrix.Sum, Matrix.Meanc

Indexed: Double Mean(Int32 Index, Int32 Len)

Returns real mean value from calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1IndexInt32start index
2LenInt32element count

Returns: Double

Remarks:

An exception is raised if calling object Dew.Math.Matrix.Complex property is true or array borders are overrun.

Overload 2: void Mean(ref Double AMean, Int32 Index, Int32 Len)

Calculate the mean value from calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1AMeanDouble (ref)pre-computed mean
2IndexInt32start index
3LenInt32element count

Result: stored in self (calling object)

Remarks:

The result AMean is a real value. An exception is raised if calling object Dew.Math.Matrix.Complex property is true or array borders are overrun/underrun.