Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
abs_diff.cpp
Go to the documentation of this file.
1 
8 #include "abs_diff.h"
9 #include <cmath>
10 
11 namespace UA_CoMP {
12 namespace Num {
13 
14 using std::function;
15 
16 double abs_diff(double b, double e, double h, function<double(double)> f1, function<double(double)> f2)
17 {
18  double maxDiff = 0.0;
19  auto n = static_cast<unsigned int>((e - b) / h);
20  for (unsigned int i = 0; i < n; ++i) {
21  double y = b + static_cast<double>(i) * h;
22  double const temp = std::fabs(f1(y) - f2(y));
23  maxDiff = (temp > maxDiff ? temp : maxDiff);
24  }
25  return maxDiff;
26 }
27 
28 } // namespace Num
29 } // namespace UA_CoMP
Utilities.
double abs_diff(double b, double e, double h, function< double(double)> f1, function< double(double)> f2)
Definition: abs_diff.cpp:16