diff options
author | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
commit | 8c751c3929b1727c1e2e2781259ddaa39cfd8df3 (patch) | |
tree | 0e680ea9182032cc82a732230217980ada093ee9 /src/common/include/gudhi | |
parent | a11db9cb0c8b35fa393c95d698754bb0c652b1d6 (diff) | |
parent | 9acc59fcc1d5001a212e7b9cd6f00a569a625882 (diff) |
Merge branch 'dfsg/latest' into debian/sid
Diffstat (limited to 'src/common/include/gudhi')
-rw-r--r-- | src/common/include/gudhi/Unitary_tests_utils.h | 12 | ||||
-rw-r--r-- | src/common/include/gudhi/random_point_generators.h | 2 | ||||
-rw-r--r-- | src/common/include/gudhi/reader_utils.h | 10 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/common/include/gudhi/Unitary_tests_utils.h b/src/common/include/gudhi/Unitary_tests_utils.h index 4ad4dae8..9b86460a 100644 --- a/src/common/include/gudhi/Unitary_tests_utils.h +++ b/src/common/include/gudhi/Unitary_tests_utils.h @@ -14,6 +14,7 @@ #include <iostream> #include <limits> // for std::numeric_limits<> +#include <cmath> // for std::fabs template<typename FloatingType > void GUDHI_TEST_FLOAT_EQUALITY_CHECK(FloatingType a, FloatingType b, @@ -25,4 +26,15 @@ void GUDHI_TEST_FLOAT_EQUALITY_CHECK(FloatingType a, FloatingType b, BOOST_CHECK(std::fabs(a - b) <= epsilon); } +// That's the usual x86 issue where a+b==a+b can return false (without any NaN) because one of them was stored in +// memory (and thus rounded to 64 bits) while the other is still in a register (80 bits). +template<typename FloatingType > +FloatingType GUDHI_PROTECT_FLOAT(FloatingType value) { + volatile FloatingType protected_value = value; +#ifdef DEBUG_TRACES + std::cout << "GUDHI_PROTECT_FLOAT - " << protected_value << std::endl; +#endif + return protected_value; +} + #endif // UNITARY_TESTS_UTILS_H_ diff --git a/src/common/include/gudhi/random_point_generators.h b/src/common/include/gudhi/random_point_generators.h index fb69f832..9dd88ac4 100644 --- a/src/common/include/gudhi/random_point_generators.h +++ b/src/common/include/gudhi/random_point_generators.h @@ -21,7 +21,7 @@ // Make compilation fail - required for external projects - https://github.com/GUDHI/gudhi-devel/issues/10 #if CGAL_VERSION_NR < 1041101000 -# error Alpha_complex_3d is only available for CGAL >= 4.11 +# error random_point_generators is only available for CGAL >= 4.11 #endif namespace Gudhi { diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h index 98335552..db31bf5c 100644 --- a/src/common/include/gudhi/reader_utils.h +++ b/src/common/include/gudhi/reader_utils.h @@ -293,6 +293,9 @@ Note: the function does not check that birth <= death. **/ template <typename OutputIterator> void read_persistence_intervals_and_dimension(std::string const& filename, OutputIterator out) { +#ifdef DEBUG_TRACES + std::cout << "read_persistence_intervals_and_dimension - " << filename << std::endl; +#endif // DEBUG_TRACES std::ifstream in(filename); if (!in.is_open()) { std::string error_str("read_persistence_intervals_and_dimension - Unable to open file "); @@ -307,6 +310,13 @@ void read_persistence_intervals_and_dimension(std::string const& filename, Outpu if (line.length() != 0 && line[0] != '#') { double numbers[4]; int n = sscanf(line.c_str(), "%lf %lf %lf %lf", &numbers[0], &numbers[1], &numbers[2], &numbers[3]); +#ifdef DEBUG_TRACES + std::cout << "[" << n << "] = "; + for (int i = 0; i < n; i++) { + std::cout << numbers[i] << ","; + } + std::cout << std::endl; +#endif // DEBUG_TRACES if (n >= 2) { int dim = (n >= 3 ? static_cast<int>(numbers[n - 3]) : -1); *out++ = std::make_tuple(dim, numbers[n - 2], numbers[n - 1]); |