Overload List
| # | Signature | Description |
|---|---|---|
| 1 | double Mean() const; | Mean value. |
| 2 | double Mean(int Index, int Len) const; | Returns real mean value from calling object elements [Index]..[Index+Len-1]. |
| 3 | void Mean(double &AMean, int Index, int Len) const; | Calculate the mean value from calling object elements [Index]..[Index+Len-1]. |
Overload 1: double Mean() const;
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 Matrix::Complex property is true.
Examples
#include "MtxExpr.h"
#include "Units.Math387.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
void Example()
{
Matrix a;
a.SetIt(2, 2, false, DewArray<double>{ 1.0, 2.0, 3.0, 4.0 });
double result = a.Mean();
if (Abs(result - 2.5) > 1e-10)
throw tException(DewString("Matrix.Mean: expected 2.5, got ") + SampleToStr(result));
}
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
double b;
a.SetIt(4, 1, false, DewArray<double>{1, 2, 3, 4});
b = a.Mean(); // b = 2.5
}
See Also: Matrix::Sum, Matrix::Meanc
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler
Overload 2: double Mean(int Index, int Len) const;
Returns real mean value from calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | int | |
| 2 | Len | int |
Remarks:
An exception is raised if calling object Matrix::Complex property is true or array borders are overrun.
Examples
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
double b;
a = {{1}, {2}, {3}, {4}};
b = a.Mean(); // b = 2.5
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler
Overload 3: void Mean(double &AMean, int Index, int Len) const;
Calculate the mean value from calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AMean | double & | |
| 2 | Index | int | |
| 3 | Len | int |
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.
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler