37 double EuclidDist::calc(
const double* v1,
const double* v2,
38 const unsigned int& dim) {
40 for (
int i = dim - 1; i >= 0; i--)
41 sum += pow(v1[i] - v2[i], 2);
45 double MaximumDist::calc(
const double* v1,
const double* v2,
46 const unsigned int& dim) {
47 double currValue, maxValue = 0.0;
48 for (
int i = dim - 1; i >= 0; i--) {
49 currValue = fabs(v1[i] - v2[i]);
50 if (currValue > maxValue) {
69 const unsigned int& dim) {
78 const unsigned int& dim) {
84 dim(dim), windowSize(window), metricCondition(condition) {
86 for (
unsigned int i = 0; i <
dim; i++)
96 const unsigned int& dim) {
97 if (dim != this->dim) {
99 s <<
"Given dimension " << dim
100 <<
" of argument vector does not match preliminarily defined dimension "
102 throw std::domain_error(s.str());
108 for (
unsigned int i = 0; i < this->
dim; i++)
109 this->
prev_v[i] = new_v[i];
112 if (!currfulfilled) {
bool isFulfilled(const double *v1, const double *v2, const unsigned int &dim)
tests whether two vectors fulfill the AboveThreshold - condition
int cnt
Counts whether the condition is fulfilled long enough.
bool isFulfilled(const double *v1, const double *v2, const unsigned int &dim)
tests whether two vectors fulfill the BelowUpperThreshold - condition
double * prev_v
Previous sequence element.
BelowThreshold(const MetricPtr m, const double threshold)
boost::shared_ptr< MetricCondition > MetricConditionPtr
SequenceMonitor(const unsigned int dim, const unsigned int window, MetricConditionPtr condition)
Constructor.
Defines a interface for metric conditions.
bool isConditionFulfilled(double *new_v, const unsigned int &dim)
Test whether the difference of consecutive sequence members fulfills the condition for the given 'tim...
virtual ~MetricCondition()
AboveThreshold(const MetricPtr m, const double threshold)
const unsigned int windowSize
boost::shared_ptr< Metric > MetricPtr
MetricConditionPtr metricCondition