5 #ifndef HERALD_DISTANCE_CONVERSION_H
6 #define HERALD_DISTANCE_CONVERSION_H
10 #include "aggregates.h"
14 #include "../datatype/distance.h"
21 namespace algorithms {
24 using namespace herald::analysis::aggregates;
29 static constexpr
int runs = 1;
31 FowlerBasic(
double intercept,
double coefficient) : run(1), mode(), intercept(intercept), coefficient(coefficient) {}
34 void beginRun(
int thisRun) {
36 mode.beginRun(thisRun);
39 template <
typename ValT>
40 void map(ValT value) {
45 double exponent = (mode.reduce() - intercept) / coefficient;
46 return std::pow(10, exponent);
67 FowlerBasicAnalyser(
long interval,
double intercept,
double coefficient) : interval(interval), basic(intercept, coefficient), lastRan(0) {}
68 ~FowlerBasicAnalyser() =
default;
72 template <
typename SrcT, std::
size_t SrcSz,
typename DstT, std::
size_t DstSz,
typename CallableForNewSample>
78 template <std::
size_t SrcSz,std::
size_t DstSz,
typename CallableForNewSample>
80 if (lastRan + interval >= timeNow)
return false;
103 auto summary = newData
106 auto count = summary.template get<Count>();
112 auto mode = summary.template get<Mode>();
113 auto var = summary.template get<Variance>();
114 auto sd = std::sqrt(var);
126 auto agg =
distance.template get<FowlerBasic>();
127 auto d = agg.reduce();
130 Date latestTime = values.latest();
131 lastRan = latestTime;
136 callable(sampled,newSample);
Definition: time_interval.h:19
A set of structs compatible with, but not reliant upon, views and ranges in Herald.
Definition: sampling.h:17
SampleIterator< T >::difference_type distance(SampleIterator< T > first, SampleIterator< T > last)
for std::distance
Definition: sampling.h:321
std::size_t SampledID
Definition: sampling.h:24
Contains all low-level Herald datatype implementations.
Definition: base64_string.h:14
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15
Definition: aggregates.h:82
A Variadic aggregation function requiring aggregations to be prior initialised (i....
Definition: aggregates.h:326
Definition: aggregates.h:484
Definition: distance_conversion.h:61
FowlerBasicAnalyser()
default constructor required for array instantiation in manager AnalysisProviderManager
Definition: distance_conversion.h:66
Definition: distance_conversion.h:28
The Sample taken from an object with ID of type SampledID.
Definition: sampling.h:28
Definition: sampling.h:102
Definition: distance.h:15