diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-22 21:36:13 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-22 21:36:13 +0000 |
commit | 6b7d9286e9f68ff388ac487d644482c862b57782 (patch) | |
tree | 19eb374c75857ccb16415d4fd3482efda82a3d88 /src/cython | |
parent | 0724c2bcab0fa444ecf8178c27f59ca788a0aa03 (diff) |
rename get_star function
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2221 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: fff57c25d175a6aed355efeb449f94a1af2249b3
Diffstat (limited to 'src/cython')
-rw-r--r-- | src/cython/cython/simplex_tree.pyx | 8 | ||||
-rwxr-xr-x | src/cython/example/alpha_complex_from_points_example.py | 2 | ||||
-rwxr-xr-x | src/cython/example/rips_complex_from_points_example.py | 2 | ||||
-rw-r--r-- | src/cython/include/Simplex_tree_interface.h | 8 | ||||
-rwxr-xr-x | src/cython/test/test_alpha_complex.py | 4 | ||||
-rwxr-xr-x | src/cython/test/test_rips_complex.py | 4 |
6 files changed, 14 insertions, 14 deletions
diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 4e23fbde..148227e1 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -49,7 +49,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": bint insert_simplex(vector[int] simplex, double filtration) vector[pair[vector[int], double]] get_filtered_tree() vector[pair[vector[int], double]] get_skeleton_tree(int dimension) - vector[pair[vector[int], double]] get_stars(vector[int] simplex) + vector[pair[vector[int], double]] get_star(vector[int] simplex) vector[pair[vector[int], double]] get_cofaces(vector[int] simplex, int dimension) void remove_maximal_simplex(vector[int] simplex) @@ -268,7 +268,7 @@ cdef class SimplexTree: ct.append((v, filtered_complex.second)) return ct - def get_stars(self, simplex): + def get_star(self, simplex): """This function returns the stars of a given N-simplex. :param simplex: The N-simplex, represented by a list of vertex. @@ -280,7 +280,7 @@ cdef class SimplexTree: for i in simplex: complex.push_back(i) cdef vector[pair[vector[int], double]] stars \ - = self.thisptr.get_stars(complex) + = self.thisptr.get_star(complex) ct = [] for filtered_complex in stars: v = [] @@ -296,7 +296,7 @@ cdef class SimplexTree: :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int. :param codimension: The codimension. If codimension = 0, all cofaces - are returned (equivalent of get_stars function) + are returned (equivalent of get_star function) :type codimension: int. :returns: The coface tree of a simplex. :rtype: list of tuples(simplex, filtration) diff --git a/src/cython/example/alpha_complex_from_points_example.py b/src/cython/example/alpha_complex_from_points_example.py index c50c45f6..688edb65 100755 --- a/src/cython/example/alpha_complex_from_points_example.py +++ b/src/cython/example/alpha_complex_from_points_example.py @@ -60,7 +60,7 @@ else: print("dimension=", simplex_tree.dimension()) print("filtered_tree=", simplex_tree.get_filtered_tree()) -print("star([0])=", simplex_tree.get_stars([0])) +print("star([0])=", simplex_tree.get_star([0])) print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1)) print("point[0]=", alpha_complex.get_point(0)) diff --git a/src/cython/example/rips_complex_from_points_example.py b/src/cython/example/rips_complex_from_points_example.py index 6ed54229..9b7fc79d 100755 --- a/src/cython/example/rips_complex_from_points_example.py +++ b/src/cython/example/rips_complex_from_points_example.py @@ -36,5 +36,5 @@ rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], simplex_tree = rips.create_simplex_tree(max_dimension=1) print("filtered_tree=", simplex_tree.get_filtered_tree()) -print("star([0])=", simplex_tree.get_stars([0])) +print("star([0])=", simplex_tree.get_star([0])) print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1)) diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 6a35684d..c2783e22 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -113,8 +113,8 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { return skeleton_tree; } - Complex get_stars(const Simplex& simplex) { - Complex stars; + Complex get_star(const Simplex& simplex) { + Complex star; for (auto f_simplex : Base::star_simplex_range(Base::find(simplex))) { Simplex simplex_star; for (auto vertex : Base::simplex_vertex_range(f_simplex)) { @@ -122,9 +122,9 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { simplex_star.insert(simplex_star.begin(), vertex); } std::cout << std::endl; - stars.push_back(std::make_pair(simplex_star, Base::filtration(f_simplex))); + star.push_back(std::make_pair(simplex_star, Base::filtration(f_simplex))); } - return stars; + return star; } Complex get_cofaces(const Simplex& simplex, int dimension) { diff --git a/src/cython/test/test_alpha_complex.py b/src/cython/test/test_alpha_complex.py index f5601ab7..2625d529 100755 --- a/src/cython/test/test_alpha_complex.py +++ b/src/cython/test/test_alpha_complex.py @@ -47,7 +47,7 @@ def test_infinite_alpha(): ([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25), ([2, 3], 0.25), ([1, 2], 0.5), ([0, 1, 2], 0.5), ([1, 2, 3], 0.5)] - assert simplex_tree.get_stars([0]) == \ + assert simplex_tree.get_star([0]) == \ [([0], 0.0), ([0, 1], 0.25), ([0, 1, 2], 0.5), ([0, 2], 0.25)] assert simplex_tree.get_cofaces([0], 1) == \ @@ -80,7 +80,7 @@ def test_filtered_alpha(): [([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0), ([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25), ([2, 3], 0.25)] - assert simplex_tree.get_stars([0]) == \ + 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)] diff --git a/src/cython/test/test_rips_complex.py b/src/cython/test/test_rips_complex.py index 4acf0a30..286a645b 100755 --- a/src/cython/test/test_rips_complex.py +++ b/src/cython/test/test_rips_complex.py @@ -49,7 +49,7 @@ def test_rips_from_points(): ([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0), ([2, 3], 1.0), ([1, 2], 1.4142135623730951), ([0, 3], 1.4142135623730951)] - assert simplex_tree.get_stars([0]) == \ + assert simplex_tree.get_star([0]) == \ [([0], 0.0), ([0, 1], 1.0), ([0, 2], 1.0), ([0, 3], 1.4142135623730951)] assert simplex_tree.get_cofaces([0], 1) == \ @@ -88,7 +88,7 @@ def test_rips_from_distance_matrix(): ([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0), ([2, 3], 1.0), ([1, 2], 1.4142135623730951), ([0, 3], 1.4142135623730951)] - assert simplex_tree.get_stars([0]) == \ + assert simplex_tree.get_star([0]) == \ [([0], 0.0), ([0, 1], 1.0), ([0, 2], 1.0), ([0, 3], 1.4142135623730951)] assert simplex_tree.get_cofaces([0], 1) == \ |