The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Unit: SDL_math1
Class: None
Declaration: [1] function MeanVarOfArray (Data: TDoubleArray; FirstIx, LastIx: integer; var Mean, Vari: double): integer;
[2] function MeanVarOfArray (Data: TDouble2DArray; LowCol, LowRow, HighCol, HighRow: integer; var Mean, Vari: double): integer;

The function MeanVarOfArray returns the mean and the variance of an array in the variable parameters Mean and Vari. The function is available in two overloaded variants: version [1] accepts a one-dimensional open array of double precision values, version [2] operates on a two-dimensional open array (parameter Data).

The parameters FirstIx and LastIx defines the search range for version [1], the parameters LowCol, LowRow, HighCol and HighRow specify the search range of version [2].

The function returns a zero value if everything is OK and the Mean and Vari parameters contain the mean and the variance. If any of the range parameters is invalid (i.e. negative or greater than size of the array) a -1 value is returned. In this case the Mean and Vari parameters are invalid.

Last Update: 2016-Aug-02