Skip to main content

โš– Mean

Returns the mean of the time series array.

This is an alias for the inherited get() method from DataTomeMvAvg.
Click here to read about the ๐Ÿ“ค Get method.

๐Ÿ“ Syntaxโ€‹

TypeOfArray mean() { return this->get(); }

๐Ÿ”ฎ Exampleโ€‹

DataTomeAnalysis<int, long int> intAverage(10);

// Array: 8 0 0 0
intAverage.push(8);
// Array: 8 8 0 0
intAverage.push(8);
// Array: 4 8 8 0
intAverage.push(4);
// Array: 4 4 8 8
intAverage.push(4);

// Returns the average
// Value: (4 + 4 + 8 + 8) / 4 = 6
intAverage.mean();

// Value: (4 + 4) / 2 = 4
intAverage.mean(2);

โฑ Complexityโ€‹

Constant (O(1)).