diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-01-20 14:12:04 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-01-20 14:12:04 +0000 |
commit | cbf1a50068a2c5dea6d732d40dfc66d34460d863 (patch) | |
tree | ac9b7fe3d89c1f98582c4355e9cdc53da893aea2 /src/Bottleneck_distance/include/gudhi | |
parent | aa06a8774e45500718dd6bf0259b328a720fedd1 (diff) | |
parent | a5326d01abe8968a23c42084ce75da88fad58f59 (diff) |
Merge bottleneck_misc_fixes branch to fix bottleneck cpplint issue and doxygen warning
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1974 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: a8704c1ff42c8e0f78ba2e70d83b71c91b3274a0
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi')
4 files changed, 18 insertions, 5 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h index 2b7e4767..b5641e29 100644 --- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h +++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h @@ -24,6 +24,11 @@ #define BOTTLENECK_H_ #include <gudhi/Graph_matching.h> + +#include <vector> +#include <algorithm> // for max +#include <limits> // for numeric_limits + #include <cmath> namespace Gudhi { @@ -41,7 +46,7 @@ double bottleneck_distance_approx(Persistence_graph& g, double e) { if (step <= b_lower_bound || step >= b_upper_bound) // Avoid precision problem break; m.set_r(step); - while (m.multi_augment()); // compute a maximum matching (in the graph corresponding to the current r) + while (m.multi_augment()) {}; // compute a maximum matching (in the graph corresponding to the current r) if (m.perfect()) { m = biggest_unperfect; b_upper_bound = step; @@ -63,7 +68,7 @@ double bottleneck_distance_exact(Persistence_graph& g) { while (lower_bound_i != upper_bound_i) { long step = lower_bound_i + static_cast<long> ((upper_bound_i - lower_bound_i - 1) / alpha); m.set_r(sd.at(step)); - while (m.multi_augment()); // compute a maximum matching (in the graph corresponding to the current r) + while (m.multi_augment()) {}; // compute a maximum matching (in the graph corresponding to the current r) if (m.perfect()) { m = biggest_unperfect; upper_bound_i = step; diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h index 253c89b4..e1708c5b 100644 --- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h +++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h @@ -25,6 +25,9 @@ #include <gudhi/Neighbors_finder.h> +#include <vector> +#include <list> + namespace Gudhi { namespace persistence_diagram { diff --git a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h index 96ece360..cd5486f8 100644 --- a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h +++ b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h @@ -34,6 +34,7 @@ #include <gudhi/Internal_point.h> #include <unordered_set> +#include <vector> namespace Gudhi { diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h index 3a4a5fec..39efc082 100644 --- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h +++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h @@ -23,9 +23,11 @@ #ifndef PERSISTENCE_GRAPH_H_ #define PERSISTENCE_GRAPH_H_ +#include <gudhi/Internal_point.h> + #include <vector> #include <algorithm> -#include <gudhi/Internal_point.h> +#include <limits> // for numeric_limits namespace Gudhi { @@ -92,10 +94,12 @@ Persistence_graph::Persistence_graph(const Persistence_diagram1 &diag1, swap(u, v); std::sort(u_alive.begin(), u_alive.end()); std::sort(v_alive.begin(), v_alive.end()); - if (u_alive.size() != v_alive.size()) + if (u_alive.size() != v_alive.size()) { b_alive = std::numeric_limits<double>::infinity(); - else for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v) + } else { + for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v) b_alive = std::max(b_alive, std::fabs(*it_u - *it_v)); + } } inline bool Persistence_graph::on_the_u_diagonal(int u_point_index) const { |