Skip to content

Commit

Permalink
MIR-678 improved weight matrix validation, integration test ported fr…
Browse files Browse the repository at this point in the history
…om Metview regrid testing, tests fix
  • Loading branch information
pmaciel committed Nov 19, 2024
1 parent 8b460ad commit 87af8ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mir/method/WeightMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "mir/method/WeightMatrix.h"

#include <cmath>
#include <limits>
#include <sstream>
#include <unordered_set>

Expand Down Expand Up @@ -131,7 +132,9 @@ void WeightMatrix::validate(const char* when, Check check) const {
check_duplicates &= cols.insert(it.col()).second;
}

auto check_sum = eckit::types::is_approximately_equal(sum, 0.) || eckit::types::is_approximately_equal(sum, 1.);
constexpr auto EPS = 1.e2 * std::numeric_limits<Scalar>::epsilon();
auto check_sum =
eckit::types::is_approximately_equal(sum, 0., EPS) || eckit::types::is_approximately_equal(sum, 1., EPS);

// ignore checks as required
check_duplicates |= !check.duplicates;
Expand Down

0 comments on commit 87af8ac

Please sign in to comment.