diff options
author | Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> | 2022-11-25 15:15:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 15:15:56 +0100 |
commit | 29cefe8ff7840903fc5850c73300e9f641f0fcf8 (patch) | |
tree | aff80e6c553bc3be6fa153870431c9042d5f6a69 /src/Nerve_GIC/include/gudhi/GIC.h | |
parent | 26c0058813d7dba60a9d4af8db131b17f3f67708 (diff) | |
parent | 46f4ef780df47e977e9acd95436bded4f5a69ada (diff) |
Merge pull request #737 from mglisse/cover-hera
Fall back to Hera's bottleneck in Nerve_GIC
Diffstat (limited to 'src/Nerve_GIC/include/gudhi/GIC.h')
-rw-r--r-- | src/Nerve_GIC/include/gudhi/GIC.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h index 1b1f9323..047fba61 100644 --- a/src/Nerve_GIC/include/gudhi/GIC.h +++ b/src/Nerve_GIC/include/gudhi/GIC.h @@ -17,6 +17,14 @@ #include <mutex> #endif +#if __has_include(<CGAL/version.h>) +# define GUDHI_GIC_USE_CGAL 1 +# include <gudhi/Bottleneck.h> +#elif __has_include(<hera/bottleneck.h>) +# define GUDHI_GIC_USE_HERA 1 +# include <hera/bottleneck.h> +#endif + #include <gudhi/Debug_utils.h> #include <gudhi/graph_simplicial_complex.h> #include <gudhi/reader_utils.h> @@ -25,7 +33,6 @@ #include <gudhi/Points_off_io.h> #include <gudhi/distance_functions.h> #include <gudhi/Persistent_cohomology.h> -#include <gudhi/Bottleneck.h> #include <boost/config.hpp> #include <boost/graph/graph_traits.hpp> @@ -35,8 +42,6 @@ #include <boost/graph/subgraph.hpp> #include <boost/graph/graph_utility.hpp> -#include <CGAL/version.h> // for CGAL_VERSION_NR - #include <iostream> #include <vector> #include <map> @@ -1228,7 +1233,14 @@ class Cover_complex { Cboot.set_cover_from_function(); Cboot.find_simplices(); Cboot.compute_PD(); +#ifdef GUDHI_GIC_USE_CGAL double db = Gudhi::persistence_diagram::bottleneck_distance(this->PD, Cboot.PD); +#elif defined GUDHI_GIC_USE_HERA + double db = hera::bottleneckDistExact(this->PD, Cboot.PD); +#else + double db; + throw std::logic_error("This function requires CGAL or Hera for the bottleneck distance."); +#endif if (verbose) std::clog << db << std::endl; distribution.push_back(db); } |