From 3b5b94c90c81ae4938a89b2b4df8b1173f100ee3 Mon Sep 17 00:00:00 2001 From: fgodi Date: Thu, 2 Jun 2016 17:09:48 +0000 Subject: renaming git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneckDistance@1240 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 53bcbf20e176a21dc41ef3c4d4295b1e9aa959b0 --- .../include/CGAL/Miscellaneous.h | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/Bottleneck_distance/include/CGAL/Miscellaneous.h (limited to 'src/Bottleneck_distance/include/CGAL/Miscellaneous.h') diff --git a/src/Bottleneck_distance/include/CGAL/Miscellaneous.h b/src/Bottleneck_distance/include/CGAL/Miscellaneous.h new file mode 100644 index 00000000..4de787fb --- /dev/null +++ b/src/Bottleneck_distance/include/CGAL/Miscellaneous.h @@ -0,0 +1,51 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Francois Godi + * + * Copyright (C) 2015 INRIA Sophia-Antipolis (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SRC_BOTTLENECK_INCLUDE_CGAL_MISCELLANEOUS_H_ +#define SRC_BOTTLENECK_INCLUDE_CGAL_MISCELLANEOUS_H_ + +#include + +namespace CGAL { + +typedef Gudhi::bipartite_graph_matching::Internal_point Internal_point; + +template <> +struct Kernel_traits { + struct Kernel { + typedef double FT; + typedef double RT; + }; +}; + + +struct Construct_coord_iterator { + typedef const double* result_type; + const double* operator()(const Internal_point& p) const + { return static_cast(p.vec); } + const double* operator()(const Internal_point& p, int) const + { return static_cast(p.vec+2); } +}; + +} //namespace CGAL + +#endif // SRC_BOTTLENECK_INCLUDE_CGAL_MISCELLANEOUS_H_ -- cgit v1.2.3 From 714a97d8b9c64a0a5ccc837184def8122ec8b4cd Mon Sep 17 00:00:00 2001 From: fgodi Date: Fri, 3 Jun 2016 09:32:46 +0000 Subject: compile git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneckDistance@1245 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a26ddc43a1f71052b594d5e0d65d28d952a0917e --- src/Bottleneck_distance/example/bottleneck_example.cpp | 3 +-- src/Bottleneck_distance/include/CGAL/Miscellaneous.h | 2 +- src/Bottleneck_distance/include/gudhi/Graph_matching.h | 3 +++ src/Bottleneck_distance/include/gudhi/Persistence_diagrams_graph.h | 4 ++-- src/Bottleneck_distance/test/bottleneck_chrono.cpp | 2 +- src/Bottleneck_distance/test/bottleneck_unit_test.cpp | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/Bottleneck_distance/include/CGAL/Miscellaneous.h') diff --git a/src/Bottleneck_distance/example/bottleneck_example.cpp b/src/Bottleneck_distance/example/bottleneck_example.cpp index bbd83547..c6a06235 100644 --- a/src/Bottleneck_distance/example/bottleneck_example.cpp +++ b/src/Bottleneck_distance/example/bottleneck_example.cpp @@ -23,7 +23,6 @@ #include #include -using namespace Gudhi::Bottleneck_distance; int main() { std::vector< std::pair > v1, v2; @@ -36,7 +35,7 @@ int main() { v2.push_back(std::pair(9.5,14.1)); - double b = bottleneck_distance(v1, v2); + double b = Gudhi::Bottleneck_distance::compute(v1, v2); std::cout << "Bottleneck distance = " << b << std::endl; diff --git a/src/Bottleneck_distance/include/CGAL/Miscellaneous.h b/src/Bottleneck_distance/include/CGAL/Miscellaneous.h index 4de787fb..21be0bc7 100644 --- a/src/Bottleneck_distance/include/CGAL/Miscellaneous.h +++ b/src/Bottleneck_distance/include/CGAL/Miscellaneous.h @@ -27,7 +27,7 @@ namespace CGAL { -typedef Gudhi::bipartite_graph_matching::Internal_point Internal_point; +typedef Gudhi::Bottleneck_distance::Internal_point Internal_point; template <> struct Kernel_traits { diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h index d8860841..f0ce633f 100644 --- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h +++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h @@ -40,6 +40,9 @@ namespace Bottleneck_distance { template double compute(const Persistence_diagram1& diag1, const Persistence_diagram2& diag2, double e = 0.); +template +double compute_exactly(const Persistence_diagram1& diag1, const Persistence_diagram2& diag2); + /** \internal \brief Structure representing a graph matching. The graph is a Persistence_diagrams_graph. * * \ingroup bottleneck_distance diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_diagrams_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_diagrams_graph.h index e8a46f1c..52e7c583 100644 --- a/src/Bottleneck_distance/include/gudhi/Persistence_diagrams_graph.h +++ b/src/Bottleneck_distance/include/gudhi/Persistence_diagrams_graph.h @@ -154,9 +154,9 @@ inline Internal_point G::get_v_point(int v_point_index) { inline double G::diameter() { double max = 0.; - for(it = u.cbegin(); it != u.cend(); it++) + for(auto it = u.cbegin(); it != u.cend(); it++) max = std::max(max,it->y()); - for(it = v.cbegin(); it != v.cend(); it++) + for(auto it = v.cbegin(); it != v.cend(); it++) max = std::max(max,it->y()); return max; } diff --git a/src/Bottleneck_distance/test/bottleneck_chrono.cpp b/src/Bottleneck_distance/test/bottleneck_chrono.cpp index 8f187a91..cde8afb1 100644 --- a/src/Bottleneck_distance/test/bottleneck_chrono.cpp +++ b/src/Bottleneck_distance/test/bottleneck_chrono.cpp @@ -51,7 +51,7 @@ int main(){ v2.emplace_back(std::max(a,b),std::max(a,b)+y); } std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now(); - double b = bottleneck_approx(v1,v2, 0.); + double b = compute(v1,v2, 0.01); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); typedef std::chrono::duration millisecs_t; millisecs_t duration(std::chrono::duration_cast(end-start)); diff --git a/src/Bottleneck_distance/test/bottleneck_unit_test.cpp b/src/Bottleneck_distance/test/bottleneck_unit_test.cpp index 33ac3f1b..d5b71156 100644 --- a/src/Bottleneck_distance/test/bottleneck_unit_test.cpp +++ b/src/Bottleneck_distance/test/bottleneck_unit_test.cpp @@ -184,5 +184,5 @@ BOOST_AUTO_TEST_CASE(global){ if(i%3==0) v2.emplace_back(std::max(a,b),std::max(a,b)+y); } - BOOST_CHECK(bottleneck_distance(v1, v2) <= upper_bound/100.); + BOOST_CHECK(compute(v1, v2) <= upper_bound/100.); } -- cgit v1.2.3