mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-10 19:20:44 +01:00
StatArray: ambiguity removed in mean function
This commit is contained in:
parent
d93f75dac6
commit
b90d410e6b
@ -53,7 +53,6 @@ public:
|
|||||||
// statistics
|
// statistics
|
||||||
void bin(Index binSize);
|
void bin(Index binSize);
|
||||||
T mean(const Index pos = 0, const Index n = -1) const;
|
T mean(const Index pos = 0, const Index n = -1) const;
|
||||||
T mean(void) const;
|
|
||||||
T covariance(const StatArray<T, os> &array, const Index pos = 0,
|
T covariance(const StatArray<T, os> &array, const Index pos = 0,
|
||||||
const Index n = -1) const;
|
const Index n = -1) const;
|
||||||
T covarianceMatrix(const StatArray<T, os> &array, const Index pos = 0,
|
T covarianceMatrix(const StatArray<T, os> &array, const Index pos = 0,
|
||||||
@ -155,13 +154,12 @@ T StatArray<T, os>::mean(const Index pos, const Index n) const
|
|||||||
{
|
{
|
||||||
T result = T();
|
T result = T();
|
||||||
const Index m = (n >= 0) ? n : size();
|
const Index m = (n >= 0) ? n : size();
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
result = this->segment(pos+os, m).redux(&ReducOp::sum<T>);
|
result = this->segment(pos+os, m).redux(&ReducOp::sum<T>);
|
||||||
}
|
}
|
||||||
|
return result/static_cast<double>(m);
|
||||||
return result/static_cast<double>(n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, Index os>
|
template <typename T, Index os>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user