From c85464b9ea96d21731e710fa7d7a15e645d2c89a Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 8 Aug 2019 10:44:30 +0200 Subject: Rename bottleneck_distance module name as bottleneck. Cannot have gudhi.bottleneck_distance.bottleneck_distance and gudhi.bottleneck_distance. --- src/cython/CMakeLists.txt | 6 ++-- src/cython/gudhi/bottleneck.pyx | 49 ++++++++++++++++++++++++++++++++ src/cython/gudhi/bottleneck_distance.pyx | 49 -------------------------------- 3 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 src/cython/gudhi/bottleneck.pyx delete mode 100644 src/cython/gudhi/bottleneck_distance.pyx (limited to 'src') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index dc0dd59d..6dc11400 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -42,8 +42,8 @@ if(PYTHONINTERP_FOUND) set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'reader_utils', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'witness_complex', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'strong_witness_complex', ") - set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'persistence_graphical_tools' ") - set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'bottleneck_distance', ") + set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'persistence_graphical_tools', ") + set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'bottleneck', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'nerve_gic', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'subsampling', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'tangential_complex', ") @@ -103,7 +103,7 @@ if(PYTHONINTERP_FOUND) set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'witness_complex', ") set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'strong_witness_complex', ") if (NOT CGAL_VERSION VERSION_LESS 4.11.0) - set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'bottleneck_distance', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'bottleneck', ") set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'nerve_gic', ") endif () if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) diff --git a/src/cython/gudhi/bottleneck.pyx b/src/cython/gudhi/bottleneck.pyx new file mode 100644 index 00000000..4b378cbc --- /dev/null +++ b/src/cython/gudhi/bottleneck.pyx @@ -0,0 +1,49 @@ +from cython cimport numeric +from libcpp.vector cimport vector +from libcpp.utility cimport pair +import os + +""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + Author(s): Vincent Rouvreau + + Copyright (C) 2016 Inria + + Modification(s): + - YYYY/MM Author: Description of the modification +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 Inria" +__license__ = "GPL v3" + +cdef extern from "Bottleneck_distance_interface.h" namespace "Gudhi::persistence_diagram": + double bottleneck(vector[pair[double, double]], vector[pair[double, double]], double) + double bottleneck(vector[pair[double, double]], vector[pair[double, double]]) + +def bottleneck_distance(diagram_1, diagram_2, e=None): + """This function returns the point corresponding to a given vertex. + + :param diagram_1: The first diagram. + :type diagram_1: vector[pair[double, double]] + :param diagram_2: The second diagram. + :type diagram_2: vector[pair[double, double]] + :param e: If `e` is 0, this uses an expensive algorithm to compute the + exact distance. + If `e` is not 0, it asks for an additive `e`-approximation, and + currently also allows a small multiplicative error (the last 2 or 3 + bits of the mantissa may be wrong). This version of the algorithm takes + advantage of the limited precision of `double` and is usually a lot + faster to compute, whatever the value of `e`. + + Thus, by default, `e` is the smallest positive double. + :type e: float + :rtype: float + :returns: the bottleneck distance. + """ + if e is None: + # Default value is the smallest double value (not 0, 0 is for exact version) + return bottleneck(diagram_1, diagram_2) + else: + # Can be 0 for exact version + return bottleneck(diagram_1, diagram_2, e) diff --git a/src/cython/gudhi/bottleneck_distance.pyx b/src/cython/gudhi/bottleneck_distance.pyx deleted file mode 100644 index 4b378cbc..00000000 --- a/src/cython/gudhi/bottleneck_distance.pyx +++ /dev/null @@ -1,49 +0,0 @@ -from cython cimport numeric -from libcpp.vector cimport vector -from libcpp.utility cimport pair -import os - -""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - Author(s): Vincent Rouvreau - - Copyright (C) 2016 Inria - - Modification(s): - - YYYY/MM Author: Description of the modification -""" - -__author__ = "Vincent Rouvreau" -__copyright__ = "Copyright (C) 2016 Inria" -__license__ = "GPL v3" - -cdef extern from "Bottleneck_distance_interface.h" namespace "Gudhi::persistence_diagram": - double bottleneck(vector[pair[double, double]], vector[pair[double, double]], double) - double bottleneck(vector[pair[double, double]], vector[pair[double, double]]) - -def bottleneck_distance(diagram_1, diagram_2, e=None): - """This function returns the point corresponding to a given vertex. - - :param diagram_1: The first diagram. - :type diagram_1: vector[pair[double, double]] - :param diagram_2: The second diagram. - :type diagram_2: vector[pair[double, double]] - :param e: If `e` is 0, this uses an expensive algorithm to compute the - exact distance. - If `e` is not 0, it asks for an additive `e`-approximation, and - currently also allows a small multiplicative error (the last 2 or 3 - bits of the mantissa may be wrong). This version of the algorithm takes - advantage of the limited precision of `double` and is usually a lot - faster to compute, whatever the value of `e`. - - Thus, by default, `e` is the smallest positive double. - :type e: float - :rtype: float - :returns: the bottleneck distance. - """ - if e is None: - # Default value is the smallest double value (not 0, 0 is for exact version) - return bottleneck(diagram_1, diagram_2) - else: - # Can be 0 for exact version - return bottleneck(diagram_1, diagram_2, e) -- cgit v1.2.3