Commit 9a24414f authored by Paul's avatar Paul
Browse files

Formatting

parent 2b1f1aad
...@@ -16,7 +16,10 @@ using range_value = std::decay_t<decltype(*std::declval<R>().begin())>; ...@@ -16,7 +16,10 @@ using range_value = std::decay_t<decltype(*std::declval<R>().begin())>;
struct sum_fn struct sum_fn
{ {
template <class T, class U> template <class T, class U>
auto operator()(T x, U y) const { return x + y; } auto operator()(T x, U y) const
{
return x + y;
}
}; };
static constexpr sum_fn sum{}; static constexpr sum_fn sum{};
...@@ -29,7 +32,10 @@ struct max_fn ...@@ -29,7 +32,10 @@ struct max_fn
} }
template <class T, class U> template <class T, class U>
auto operator()(T x, U y) const { return x > y ? x : y; } auto operator()(T x, U y) const
{
return x > y ? x : y;
}
}; };
static constexpr max_fn max{}; static constexpr max_fn max{};
...@@ -38,7 +44,10 @@ using std::fabs; ...@@ -38,7 +44,10 @@ using std::fabs;
struct fn struct fn
{ {
template <class T, class U> template <class T, class U>
auto operator()(T x, U y) const { return fabs(x - y); } auto operator()(T x, U y) const
{
return fabs(x - y);
}
}; };
} // namespace abs_diff_detail } // namespace abs_diff_detail
...@@ -91,7 +100,9 @@ bool range_empty(R1&& r1) ...@@ -91,7 +100,9 @@ bool range_empty(R1&& r1)
template <class R1> template <class R1>
auto range_distance(R1&& r1) auto range_distance(R1&& r1)
{ return std::distance(r1.begin(), r1.end()); } {
return std::distance(r1.begin(), r1.end());
}
template <class R1> template <class R1>
bool range_zero(R1&& r1) bool range_zero(R1&& r1)
...@@ -131,10 +142,7 @@ double max_diff(R1&& r1, R2&& r2) ...@@ -131,10 +142,7 @@ double max_diff(R1&& r1, R2&& r2)
template <class R1, class R2, class T> template <class R1, class R2, class T>
std::size_t mismatch_diff(R1&& r1, R2&& r2, T diff) std::size_t mismatch_diff(R1&& r1, R2&& r2, T diff)
{ {
return mismatch_idx( return mismatch_idx(r1, r2, [&](auto x, auto y) {
r1,
r2,
[&](auto x, auto y) {
auto d = abs_diff(x, y); auto d = abs_diff(x, y);
return !(d > diff && d < diff); return !(d > diff && d < diff);
}); });
...@@ -157,8 +165,8 @@ double rms_range(R1&& r1, R2&& r2) ...@@ -157,8 +165,8 @@ double rms_range(R1&& r1, R2&& r2)
return std::numeric_limits<range_value<R1>>::max(); return std::numeric_limits<range_value<R1>>::max();
} }
template<class R1, class R2> template <class R1, class R2>
bool verify_range(R1&& r1, R2&& r2, double tolerance=80) bool verify_range(R1&& r1, R2&& r2, double tolerance = 80)
{ {
double threshold = std::numeric_limits<range_value<R1>>::epsilon() * tolerance; double threshold = std::numeric_limits<range_value<R1>>::epsilon() * tolerance;
auto error = rms_range(r1, r2); auto error = rms_range(r1, r2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment