Matrix::MeanCols Method

void MeanCols(TVec *result) const;

Calculates the mean value of each of the matrix columns.

#NameTypeDescription
1resultTVec *
Remarks:

Calculate the mean vale of each of the calling matrix columns and store the results in result vector. The Matrix::Length and Matrix::Complex properties of the result vector are adjusted automatically.

Examples
#include "MtxExpr.h"
#include "Units.MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxExpr;

void Example()
{
    Matrix A;
    Vector res;

    A.SetIt(2, 2, false, DewArray<double>{1, 5, -3, 6});
    A.MeanCols(res); // res = (-1.0, 5.5)
    //or
    res = MeanCols(A);
}
See Also: Matrix::MeanRows
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler