TMtx::Mean Method

Overload List

#SignatureDescription
1double Mean();Mean value.
2double Mean(int Index, int Len);Returns real mean value from calling object elements [Index]..[Index+Len-1].
3void Mean(double &AMean, int Index, int Len);Calculate the mean value from calling object elements [Index]..[Index+Len-1].
4void Mean(TCplx &AMean);Same as TMtx::Meanc.
5void Mean(TCplx &AMean, int Index, int Len);Same as TMtx::Meanc.

Overload 1: double Mean();

Mean value.

Remarks:

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

Examples
#include "Units.MtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVec;

void Example()
{
    TVec* a;
    CreateIt(a);
    a->SetIt(false, DewArray<double>{1,2,3,4});
    double m = a->Mean(); // 2.5
    FreeIt(a);
}
#include "MtxExpr.h"
#include "Units.Math387.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;

void Example()
{
    Vector a;
    a.SetIt(DewArray<double>{ 1.0, 2.0, 3.0, 4.0 });
    double result = a.Mean();
    if (Abs(result - 2.5) > 1e-10)
        throw tException(DewString("Vector.Mean: expected 2.5, got ") + SampleToStr(result));
}
See Also: TMtx::Sum, TMtx::Meanc
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 2: double Mean(int Index, int Len);

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

#NameTypeDescription
1Indexint
2Lenint
Remarks:

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

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 3: void Mean(double &AMean, int Index, int Len);

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

#NameTypeDescription
1AMeandouble &
2Indexint
3Lenint
Remarks:

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

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 4: void Mean(TCplx &AMean);

Same as TMtx::Meanc.

#NameTypeDescription
1AMeanTCplx &
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 5: void Mean(TCplx &AMean, int Index, int Len);

Same as TMtx::Meanc.

#NameTypeDescription
1AMeanTCplx &
2Indexint
3Lenint
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler