From 490a5774601e344bb732de5eab2a8cf6d5a7e81f Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 16 Dec 2019 13:38:58 +0100 Subject: Rollback exact version mechanism --- src/python/gudhi/alpha_complex.pyx | 11 +++-------- src/python/include/Alpha_complex_interface.h | 4 ++-- src/python/test/test_alpha_complex.py | 12 +++--------- 3 files changed, 8 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index bfb9783a..24e36bea 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -28,7 +28,7 @@ cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": # bool from_file is a workaround for cython to find the correct signature Alpha_complex_interface(string off_file, bool from_file) vector[double] get_point(int vertex) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, bool exact_version) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) # AlphaComplex python interface cdef class AlphaComplex: @@ -99,22 +99,17 @@ cdef class AlphaComplex: cdef vector[double] point = self.thisptr.get_point(vertex) return point - def create_simplex_tree(self, max_alpha_square = float('inf'), - exact_version = False): + def create_simplex_tree(self, max_alpha_square = float('inf')): """ :param max_alpha_square: The maximum alpha square threshold the simplices shall not exceed. Default is set to infinity, and there is very little point using anything else since it does not save time. :type max_alpha_square: float - :param exact_version: :code:`EXACT` computation version if set. - Default is false which means :code:`SAFE` version is used. - :type exact_version: bool :returns: A simplex tree created from the Delaunay Triangulation. :rtype: SimplexTree """ stree = SimplexTree() cdef intptr_t stree_int_ptr=stree.thisptr - self.thisptr.create_simplex_tree(stree_int_ptr, - max_alpha_square, exact_version) + self.thisptr.create_simplex_tree(stree_int_ptr, max_alpha_square) return stree diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index a7621f2b..e9bbadb0 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -60,8 +60,8 @@ class Alpha_complex_interface { return vd; } - void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, bool exact_version) { - alpha_complex_->create_complex(*simplex_tree, max_alpha_square, exact_version); + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square) { + alpha_complex_->create_complex(*simplex_tree, max_alpha_square); simplex_tree->initialize_filtration(); } diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py index ab84daaa..9b27fff2 100755 --- a/src/python/test/test_alpha_complex.py +++ b/src/python/test/test_alpha_complex.py @@ -93,7 +93,7 @@ def test_filtered_alpha(): assert simplex_tree.get_star([0]) == [([0], 0.0), ([0, 1], 0.25), ([0, 2], 0.25)] assert simplex_tree.get_cofaces([0], 1) == [([0, 1], 0.25), ([0, 2], 0.25)] -def alpha_persistence_comparison(exact_version): +def test_safe_alpha_persistence_comparison(): #generate periodic signal time = np.arange(0, 10, 1) signal = [math.sin(x) for x in time] @@ -106,10 +106,10 @@ def alpha_persistence_comparison(exact_version): #build alpha complex and simplex tree alpha_complex1 = AlphaComplex(points=embedding1) - simplex_tree1 = alpha_complex1.create_simplex_tree(exact_version = exact_version) + simplex_tree1 = alpha_complex1.create_simplex_tree() alpha_complex2 = AlphaComplex(points=embedding2) - simplex_tree2 = alpha_complex2.create_simplex_tree(exact_version = exact_version) + simplex_tree2 = alpha_complex2.create_simplex_tree() diag1 = simplex_tree1.persistence() diag2 = simplex_tree2.persistence() @@ -117,9 +117,3 @@ def alpha_persistence_comparison(exact_version): for (first_p, second_p) in itertools.zip_longest(diag1, diag2): assert first_p[0] == pytest.approx(second_p[0]) assert first_p[1] == pytest.approx(second_p[1]) - -def test_exact_alpha_version(): - alpha_persistence_comparison(exact_version = True) - -def test_safe_alpha_version(): - alpha_persistence_comparison(exact_version = False) -- cgit v1.2.3