Peano
Loading...
Searching...
No Matches
GlidingAverageMeasurement.h
Go to the documentation of this file.
1// Copyright (C) 2009 Technische Universitaet Muenchen
2// This file is part of the Peano project. For conditions of distribution and
3// use, please see the copyright notice at www.peano-framework.org
4#pragma once
5
6
7#include <string>
8#include <vector>
9
10#include "tarch/logging/Log.h"
11
12
13namespace tarch::timing {
15} // namespace tarch::timing
16
17
34 private:
36
40 const double _weight;
41 const int _maxEntries;
42
46 std::vector<double> _values;
47
48 public:
49 static constexpr double DefaultWeight = 0.7;
50
60 GlidingAverageMeasurement(double weight = DefaultWeight, int maxEntries = 16);
62
73 double getValue() const;
74
82 double getStandardDeviation() const;
83
89
95 bool isAccurateValue(double factor = 0.1) const;
96
102 void setValue(const double& value);
103
104 std::string toString() const;
105
106 double max() const;
107 double min() const;
108
109 void erase();
110
116};
Log Device.
Definition Log.h:517
bool isAccurateValue(double factor=0.1) const
Is value accurate.
GlidingAverageMeasurement(double weight=DefaultWeight, int maxEntries=16)
Construct a measurement with a gliding measurement.
const double _weight
The weights q determine the weight via $q^0,q^1,q^2,...$.
double getStandardDeviation() const
To compute the standard deviation, we rely on the formula.
double getValue() const
Return the value of the gliding value.
void setValue(const double &value)
Set the value.