Matrix.Mean Method

Overload List

#SignatureDescription
1function Mean: Double;Mean value.
└ indexed: function Mean(Index: Integer; Len: Integer): Double;
2procedure Mean(out AMean: Double; Index: Integer; Len: Integer);Calculate the mean value from calling object elements [Index]..[Index+Len-1].

Overload 1: function Mean: Double;

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 Matrix.Complex property is true.

Examples
var a: Matrix;
    b: double;
begin
    a.SetIt(4,1,False,[1,2,3,4]);
    b := a.Mean; // b = 2.5
end;
var
    a: Matrix;
    result: double;
begin
    a := [[1.0, 2.0], [3.0, 4.0]];
    result := a.Mean;
    if Abs(result - 2.5) > 1e-10 then
        raise Exception.Create('Matrix.Mean: expected 2.5, got ' + result.ToString);
end;
See Also: Matrix.Sum, Matrix.Meanc

Indexed: function Mean(Index: Integer; Len: Integer): Double;

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

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Returns: Double

Remarks:

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

Overload 2: procedure Mean(out AMean: Double; Index: Integer; Len: Integer);

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

#NameTypeDescription
1AMeanDoublepre-computed mean
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

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