diff options
Diffstat (limited to 'src')
10 files changed, 39 insertions, 16 deletions
diff --git a/src/Bottleneck_distance/example/bottleneck_basic_example.cpp b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp index 91a7302f..d0ca4e20 100644 --- a/src/Bottleneck_distance/example/bottleneck_basic_example.cpp +++ b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp @@ -21,10 +21,13 @@ */ #include <gudhi/Bottleneck.h> + #include <iostream> +#include <vector> +#include <utility> // for pair +#include <limits> // for numeric_limits int main() { - std::vector< std::pair<double, double> > v1, v2; v1.emplace_back(2.7, 3.7); @@ -44,5 +47,4 @@ int main() { b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2, 0.1); std::cout << "Approx bottleneck distance = " << b << std::endl; - } diff --git a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp index 4c74b66e..bde05825 100644 --- a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp +++ b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp @@ -24,6 +24,8 @@ #include <gudhi/Bottleneck.h> #include <iostream> +#include <vector> +#include <utility> // for pair #include <fstream> #include <sstream> #include <string> 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 { diff --git a/src/Doxyfile b/src/Doxyfile index 28bb079a..a41c6d6f 100644 --- a/src/Doxyfile +++ b/src/Doxyfile @@ -784,7 +784,8 @@ EXCLUDE = data/ \ example/ \ GudhUI/ \ cmake/ \ - debian/ + debian/ \ + include/gudhi_patches/ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index ccdc7c1a..ca5a919c 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -277,9 +277,11 @@ make \endverbatim * Persistent_cohomology/custom_persistence_sort.cpp</a> * * The following example requires CGAL version ≥ 4.8.0: - * \li <a href="_bottleneck_distance_2_bottleneck_example_8cpp-example.html"> - * - * Bottleneck_distance/bottleneck_example.cpp</a> + * \li <a href="_bottleneck_distance_2_bottleneck_basic_example_8cpp-example.html"> + * Bottleneck_distance/bottleneck_basic_example.cpp</a> + * \li <a href="_bottleneck_distance_2_bottleneck_read_file_example_8cpp-example.html"> + * Bottleneck_distance/bottleneck_read_file_example.cpp</a> + * * \subsection eigen3 Eigen3 * The \ref alpha_complex data structure and few examples requires * <a target="_blank" href="http://eigen.tuxfamily.org/">Eigen3</a> is a C++ template library for linear algebra: @@ -291,8 +293,10 @@ make \endverbatim * Alpha_complex/Alpha_complex_from_off.cpp</a> * \li <a href="_alpha_complex_2_alpha_complex_from_points_8cpp-example.html"> * Alpha_complex/Alpha_complex_from_points.cpp</a> - * \li <a href="_bottleneck_distance_2_bottleneck_example_8cpp-example.html"> - * Bottleneck_distance/bottleneck_example.cpp</a> + * \li <a href="_bottleneck_distance_2_bottleneck_basic_example_8cpp-example.html"> + * Bottleneck_distance/bottleneck_basic_example.cpp</a> + * \li <a href="_bottleneck_distance_2_bottleneck_read_file_example_8cpp-example.html"> + * Bottleneck_distance/bottleneck_read_file_example.cpp</a> * \li <a href="_persistent_cohomology_2alpha_complex_persistence_8cpp-example.html"> * Persistent_cohomology/alpha_complex_persistence.cpp</a> * \li <a href="_persistent_cohomology_2periodic_alpha_complex_3d_persistence_8cpp-example.html"> @@ -380,7 +384,8 @@ make \endverbatim /*! @file Examples * @example Alpha_complex/Alpha_complex_from_off.cpp * @example Alpha_complex/Alpha_complex_from_points.cpp - * @example Bottleneck_distance/bottleneck_example.cpp + * @example Bottleneck_distance/bottleneck_basic_example.cpp + * @example Bottleneck_distance/bottleneck_read_file_example.cpp * @example Bitmap_cubical_complex/Bitmap_cubical_complex.cpp * @example Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp * @example Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp diff --git a/src/common/example/example_CGAL_3D_points_off_reader.cpp b/src/common/example/example_CGAL_3D_points_off_reader.cpp index d48bb17d..665b7a29 100644 --- a/src/common/example/example_CGAL_3D_points_off_reader.cpp +++ b/src/common/example/example_CGAL_3D_points_off_reader.cpp @@ -32,7 +32,7 @@ int main(int argc, char **argv) { // Retrieve the triangulation std::vector<Point_3> point_cloud = off_reader.get_point_cloud(); - int n {0}; + int n {}; for (auto point : point_cloud) { ++n; std::cout << "Point[" << n << "] = (" << point[0] << ", " << point[1] << ", " << point[2] << ")\n"; diff --git a/src/common/example/example_CGAL_points_off_reader.cpp b/src/common/example/example_CGAL_points_off_reader.cpp index 4522174a..8c6a6b54 100644 --- a/src/common/example/example_CGAL_points_off_reader.cpp +++ b/src/common/example/example_CGAL_points_off_reader.cpp @@ -34,7 +34,7 @@ int main(int argc, char **argv) { // Retrieve the triangulation std::vector<Point_d> point_cloud = off_reader.get_point_cloud(); - int n {0}; + int n {}; for (auto point : point_cloud) { std::cout << "Point[" << n << "] = "; for (std::size_t i {0}; i < point.size(); i++) |