From 97d80185d6ec4d5e8f81b4cd4936d29a6d63b05b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 29 Nov 2016 16:50:55 +0000 Subject: Fix interface for Alpha complex and Tangential complex git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1801 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 995b53c7f65057ec155988b90f17299665eab4ae --- src/cython/doc/alpha_complex_user.rst | 14 +++--- .../doc/persistence_graphical_tools_user.rst | 3 +- src/cython/doc/tangential_complex_user.rst | 53 ++++++++++++++++++---- 3 files changed, 51 insertions(+), 19 deletions(-) (limited to 'src/cython/doc') diff --git a/src/cython/doc/alpha_complex_user.rst b/src/cython/doc/alpha_complex_user.rst index 5ad3a9e7..ed2a470c 100644 --- a/src/cython/doc/alpha_complex_user.rst +++ b/src/cython/doc/alpha_complex_user.rst @@ -25,14 +25,13 @@ This example builds the Delaunay triangulation from the given points, and initia import gudhi alpha_complex = gudhi.AlphaComplex(points=[[1, 1], [7, 0], [4, 6], [9, 6], [0, 14], [2, 19], [9, 17]]) - simplex_tree = gudhi.SimplexTree() - alpha_complex.create_simplex_tree(simplex_tree, max_alpha_square=60.0) + simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=60.0) result_str = 'Alpha complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \ repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for fitered_value in simplex_tree.get_filtered_tree(): - print(fitered_value) + for filtered_value in simplex_tree.get_filtered_tree(): + print(filtered_value) The output is: @@ -156,14 +155,13 @@ Then, it is asked to display information about the alpha complex: import gudhi alpha_complex = gudhi.AlphaComplex(off_file='alphacomplexdoc.off') - simplex_tree = gudhi.SimplexTree() - alpha_complex.create_simplex_tree(simplex_tree, max_alpha_square=59.0) + simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=59.0) result_str = 'Alpha complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \ repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for fitered_value in simplex_tree.get_filtered_tree(): - print(fitered_value) + for filtered_value in simplex_tree.get_filtered_tree(): + print(filtered_value) the program output is: diff --git a/src/cython/doc/persistence_graphical_tools_user.rst b/src/cython/doc/persistence_graphical_tools_user.rst index b23ad5e6..43c695bf 100644 --- a/src/cython/doc/persistence_graphical_tools_user.rst +++ b/src/cython/doc/persistence_graphical_tools_user.rst @@ -41,7 +41,6 @@ This function can display the persistence result as a diagram: import gudhi alpha_complex = gudhi.AlphaComplex(off_file='tore3D_300.off') - simplex_tree = gudhi.SimplexTree() - alpha_complex.create_simplex_tree(simplex_tree) + simplex_tree = alpha_complex.create_simplex_tree() diag = simplex_tree.persistence() gudhi.diagram_persistence(diag) diff --git a/src/cython/doc/tangential_complex_user.rst b/src/cython/doc/tangential_complex_user.rst index 588de08c..33c03e34 100644 --- a/src/cython/doc/tangential_complex_user.rst +++ b/src/cython/doc/tangential_complex_user.rst @@ -111,20 +111,55 @@ itself and/or after the perturbation process. Simple example -------------- -This example builds the Tangential complex of point set. Note that the -dimension of the kernel here is dynamic, which is slower, but more flexible: -the intrinsic and ambient dimensions does not have to be known at compile-time. +This example builds the Tangential complex of point set. -testcode:: +.. testcode:: - import gudhi - tc = gudhi.TangentialComplex(points=[[1, 1], [7, 0], [4, 6], [9, 6], [0, 14], [2, 19], [9, 17]]) + import gudhi + tc = gudhi.TangentialComplex(points=[[1, 1], [7, 0], [4, 6], [9, 6], [0, 14], [2, 19], [9, 17]]) + result_str = 'Tangential contains ' + repr(tc.num_simplices()) + \ + ' simplices - ' + repr(tc.num_vertices()) + ' vertices.' + print(result_str) -The output is: + st = tc.create_simplex_tree() + result_str = 'Simplex tree is of dimension ' + repr(st.dimension()) + \ + ' - ' + repr(st.num_simplices()) + ' simplices - ' + \ + repr(st.num_vertices()) + ' vertices.' + print(result_str) + for filtered_value in st.get_filtered_tree(): + print(filtered_value) -testoutput:: +The output is: - Tangential complex is of dimension 2 - 25 simplices - 7 vertices. +.. testoutput:: + + Tangential contains 18 simplices - 7 vertices. + Simplex tree is of dimension 2 - 25 simplices - 7 vertices. + ([0], 0.0) + ([1], 0.0) + ([0, 1], 0.0) + ([2], 0.0) + ([0, 2], 0.0) + ([1, 2], 0.0) + ([0, 1, 2], 0.0) + ([3], 0.0) + ([1, 3], 0.0) + ([2, 3], 0.0) + ([1, 2, 3], 0.0) + ([4], 0.0) + ([0, 4], 0.0) + ([2, 4], 0.0) + ([0, 2, 4], 0.0) + ([5], 0.0) + ([4, 5], 0.0) + ([6], 0.0) + ([2, 6], 0.0) + ([3, 6], 0.0) + ([2, 3, 6], 0.0) + ([4, 6], 0.0) + ([2, 4, 6], 0.0) + ([5, 6], 0.0) + ([4, 5, 6], 0.0) Example with perturbation -- cgit v1.2.3