diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-02-12 09:14:27 +0100 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-02-12 09:14:27 +0100 |
commit | 1dc713cd7ad9574d82cbd9cd6563b76236e9f853 (patch) | |
tree | 63637f6d0661e4fca99306e26535b5d4e75c1978 /src | |
parent | 22c946ecc9594fc496d641b70a19643057295dcf (diff) | |
parent | ee0f12f1df406c81c6ad860c494eed908021fad9 (diff) |
Merge branch 'master' into modern_cmake_for_boost
Diffstat (limited to 'src')
26 files changed, 300 insertions, 219 deletions
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h index a47d6889..2a6d4788 100644 --- a/src/Nerve_GIC/include/gudhi/GIC.h +++ b/src/Nerve_GIC/include/gudhi/GIC.h @@ -14,7 +14,7 @@ #ifdef GUDHI_USE_TBB #include <tbb/parallel_for.h> -#include <tbb/mutex.h> +#include <mutex> #endif #include <gudhi/Debug_utils.h> @@ -459,7 +459,7 @@ class Cover_complex { // This cannot be parallelized if thread_local is not defined // thread_local is not defined for XCode < v.8 #if defined(GUDHI_USE_TBB) && defined(GUDHI_CAN_USE_CXX11_THREAD_LOCAL) - tbb::mutex deltamutex; + std::mutex deltamutex; tbb::parallel_for(0, N, [&](int i){ std::vector<int> samples(m); SampleWithoutReplacement(n, m, samples); @@ -765,7 +765,7 @@ class Cover_complex { #ifdef GUDHI_USE_TBB if (verbose) std::cout << "Computing connected components (parallelized)..." << std::endl; - tbb::mutex covermutex, idmutex; + std::mutex covermutex, idmutex; tbb::parallel_for(0, res, [&](int i){ // Compute connected components Graph G = one_skeleton.create_subgraph(); @@ -895,7 +895,7 @@ class Cover_complex { // Compute the geodesic distances to subsamples with Dijkstra #ifdef GUDHI_USE_TBB if (verbose) std::cout << "Computing geodesic distances (parallelized)..." << std::endl; - tbb::mutex coverMutex; tbb::mutex mindistMutex; + std::mutex coverMutex; std::mutex mindistMutex; tbb::parallel_for(0, m, [&](int i){ int seed = voronoi_subsamples[i]; std::vector<double> dmap(n); diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index 6ba518fa..a0aabee2 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -16,6 +16,9 @@ endif() add_test(NAME Simplex_tree_example_simple_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_simple_simplex_tree>) add_executable ( Simplex_tree_example_mini_simplex_tree mini_simplex_tree.cpp ) +if (TBB_FOUND) + target_link_libraries(Simplex_tree_example_mini_simplex_tree ${TBB_LIBRARIES}) +endif() add_test(NAME Simplex_tree_example_mini_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_mini_simplex_tree>) # An example with Simplex-tree using CGAL alpha_shapes_3 diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h index f058fa9f..f007bdd5 100644 --- a/src/Tangential_complex/include/gudhi/Tangential_complex.h +++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h @@ -60,7 +60,7 @@ #ifdef GUDHI_USE_TBB #include <tbb/parallel_for.h> #include <tbb/combinable.h> -#include <tbb/mutex.h> +#include <mutex> #endif // #define GUDHI_TC_EXPORT_NORMALS // Only for 3D surfaces (k=2, d=3) @@ -147,7 +147,7 @@ class Tangential_complex { typedef typename Tr_traits::Vector_d Tr_vector; #if defined(GUDHI_USE_TBB) - typedef tbb::mutex Mutex_for_perturb; + typedef std::mutex Mutex_for_perturb; typedef Vector Translation_for_perturb; typedef std::vector<Atomic_wrapper<FT> > Weights; #else diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt index 5860f3a3..2659798e 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -12,10 +12,18 @@ install(TARGETS Witness_complex_example_nearest_landmark_table DESTINATION bin) # CGAL and Eigen3 are required for Euclidean version of Witness if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) + if (TBB_FOUND) + target_link_libraries(Witness_complex_example_off ${TBB_LIBRARIES}) + endif() add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp ) + if (TBB_FOUND) + target_link_libraries(Witness_complex_example_sphere ${TBB_LIBRARIES}) + endif() add_executable( Witness_complex_example_strong_off example_strong_witness_complex_off.cpp ) - target_link_libraries(Witness_complex_example_strong_off) + if (TBB_FOUND) + target_link_libraries(Witness_complex_example_strong_off ${TBB_LIBRARIES}) + endif() add_test(NAME Witness_complex_example_off_test_torus COMMAND $<TARGET_FILE:Witness_complex_example_off> diff --git a/src/common/doc/header.html b/src/common/doc/header.html index 9fdb2321..99ab6bb7 100644 --- a/src/common/doc/header.html +++ b/src/common/doc/header.html @@ -56,7 +56,7 @@ $extrastylesheet <a href="#">Download</a> <ul class="dropdown"> <li><a href="/licensing/">Licensing</a></li> - <li><a href="https://gforge.inria.fr/frs/download.php/latestzip/5253/library-latest.zip" target="_blank">Get the latest sources</a></li> + <li><a href="https://github.com/GUDHI/gudhi-devel/releases/latest" target="_blank">Get the latest sources</a></li> <li><a href="/conda/">Conda package</a></li> <li><a href="/dockerfile/">Dockerfile</a></li> </ul> diff --git a/src/common/doc/main_page.md b/src/common/doc/main_page.md index 0b4bfb7a..6ea10b88 100644 --- a/src/common/doc/main_page.md +++ b/src/common/doc/main_page.md @@ -4,8 +4,8 @@ \image html "Gudhi_banner.png" <br><br><br><br> -## Complexes {#Complexes} -### Cubical complex +## Data structures for cell complexes {#Complexes} +### Cubical complexes <table> <tr> @@ -29,246 +29,269 @@ </tr> </table> -### Simplicial complex - -#### Alpha complex +### Simplicial complexes +#### Simplex tree <table> <tr> <td width="35%" rowspan=2> - \image html "alpha_complex_representation.png" + \image html "Simplex_tree_representation.png" </td> <td width="50%"> - Alpha complex is a simplicial complex constructed from the finite cells of a Delaunay Triangulation.<br> - The filtration value of each simplex is computed as the square of the circumradius of the simplex if the - circumsphere is empty (the simplex is then said to be Gabriel), and as the minimum of the filtration - values of the codimension 1 cofaces that make it not Gabriel otherwise. - All simplices that have a filtration value \f$ > \alpha^2 \f$ are removed from the Delaunay complex - when creating the simplicial complex if it is specified.<br> - For performances reasons, it is advised to use \ref cgal ≥ 5.0.0. + The simplex tree is an efficient and flexible + data structure for representing general (filtered) simplicial complexes. The data structure + is described in \cite boissonnatmariasimplextreealgorithmica . </td> <td width="15%"> - <b>Author:</b> Vincent Rouvreau<br> - <b>Introduced in:</b> GUDHI 1.3.0<br> - <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> - <b>Requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 + <b>Author:</b> Clément Maria<br> + <b>Introduced in:</b> GUDHI 1.0.0<br> + <b>Copyright:</b> MIT<br> </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref alpha_complex + <b>User manual:</b> \ref simplex_tree </td> </tr> </table> -#### Čech complex +#### Toplex Map <table> - <tr> + <tr> <td width="35%" rowspan=2> - \image html "cech_complex_representation.png" + \image html "map.png" </td> <td width="50%"> - The Čech complex is a simplicial complex constructed from a proximity graph. - The set of all simplices is filtered by the radius of their minimal enclosing ball. + The Toplex map data structure is composed firstly of a raw storage of toplices (the maximal simplices) + and secondly of a map which associate any vertex to a set of pointers toward all toplices + containing this vertex. </td> <td width="15%"> - <b>Author:</b> Vincent Rouvreau<br> - <b>Introduced in:</b> GUDHI 2.2.0<br> - <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> - <b>Includes:</b> [Miniball](https://people.inf.ethz.ch/gaertner/subdir/software/miniball.html)<br> + <b>Author:</b> François Godi<br> + <b>Introduced in:</b> GUDHI 2.1.0<br> + <b>Copyright:</b> MIT<br> </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref cech_complex + <b>User manual:</b> \ref toplex_map </td> </tr> </table> -#### Rips complex +#### Skeleton blocker <table> <tr> <td width="35%" rowspan=2> - \image html "rips_complex_representation.png" + \image html "ds_representation.png" </td> <td width="50%"> - Rips complex is a simplicial complex constructed from a one skeleton graph.<br> - The filtration value of each edge is computed from a user-given distance function and is inserted until a - user-given threshold value.<br> - This complex can be built from a point cloud and a distance function, or from a distance matrix. + The Skeleton-Blocker data-structure proposes a light encoding for simplicial complexes by storing only an *implicit* + representation of its simplices \cite socg_blockers_2011,\cite blockers2012. Intuitively, it just stores the + 1-skeleton of a simplicial complex with a graph and the set of its "missing faces" that is very small in practice. + This data-structure handles all simplicial complexes operations such as simplex enumeration or simplex removal but + operations that are particularly efficient are operations that do not require simplex enumeration such as edge + iteration, link computation or simplex contraction. </td> <td width="15%"> - <b>Author:</b> Clément Maria, Pawel Dlotko, Vincent Rouvreau, Marc Glisse<br> - <b>Introduced in:</b> GUDHI 2.0.0<br> + <b>Author:</b> David Salinas<br> + <b>Introduced in:</b> GUDHI 1.1.0<br> <b>Copyright:</b> MIT<br> </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref rips_complex + <b>User manual:</b> \ref skbl </td> </tr> </table> -#### Witness complex +#### Basic operation: contraction <table> <tr> <td width="35%" rowspan=2> - \image html "Witness_complex_representation.png" + \image html "sphere_contraction_representation.png" </td> <td width="50%"> - Witness complex \f$ Wit(W,L) \f$ is a simplicial complex defined on two sets of points in \f$\mathbb{R}^D\f$. - The data structure is described in \cite boissonnatmariasimplextreealgorithmica . + The purpose of this package is to offer a user-friendly interface for edge contraction simplification of huge + simplicial complexes. It uses the \ref skbl data-structure whose size remains small during simplification of most + used geometrical complexes of topological data analysis such as the Rips or the Delaunay complexes. In practice, + the size of this data-structure is even much lower than the total number of simplices. </td> <td width="15%"> - <b>Author:</b> Siargey Kachanovich<br> - <b>Introduced in:</b> GUDHI 1.3.0<br> - <b>Copyright:</b> MIT ([GPL v3](../../licensing/) for Euclidean version)<br> - <b>Euclidean version requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 + <b>Author:</b> David Salinas<br> + <b>Introduced in:</b> GUDHI 1.1.0<br> + <b>Copyright:</b> MIT [(LGPL v3)](../../licensing/)<br> + <b>Requires:</b> \ref cgal ≥ 4.11.0 </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref witness_complex + <b>User manual:</b> \ref contr </td> </tr> </table> -### Cover Complexes +## Filtrations and reconstructions {#FiltrationsReconstructions} +### Alpha complex + <table> <tr> <td width="35%" rowspan=2> - \image html "gicvisu.jpg" + \image html "alpha_complex_representation.png" </td> <td width="50%"> - Nerves and Graph Induced Complexes are cover complexes, i.e. simplicial complexes that provably contain - topological information about the input data. They can be computed with a cover of the - data, that comes i.e. from the preimage of a family of intervals covering the image - of a scalar-valued function defined on the data. <br> + Alpha complex is a simplicial complex constructed from the finite cells of a Delaunay Triangulation.<br> + The filtration value of each simplex is computed as the square of the circumradius of the simplex if the + circumsphere is empty (the simplex is then said to be Gabriel), and as the minimum of the filtration + values of the codimension 1 cofaces that make it not Gabriel otherwise. + All simplices that have a filtration value \f$ > \alpha^2 \f$ are removed from the Delaunay complex + when creating the simplicial complex if it is specified.<br> + For performances reasons, it is advised to use \ref cgal ≥ 5.0.0. </td> <td width="15%"> - <b>Author:</b> Mathieu Carrière<br> - <b>Introduced in:</b> GUDHI 2.1.0<br> + <b>Author:</b> Vincent Rouvreau<br> + <b>Introduced in:</b> GUDHI 1.3.0<br> <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> - <b>Requires:</b> \ref cgal ≥ 4.11.0 + <b>Requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref cover_complex + <b>User manual:</b> \ref alpha_complex </td> </tr> </table> -## Data structures and basic operations {#DataStructuresAndBasicOperations} +### Čech complex -### Data structures +<table> + <tr> + <td width="35%" rowspan=2> + \image html "cech_complex_representation.png" + </td> + <td width="50%"> + The Čech complex is a simplicial complex constructed from a proximity graph. + The set of all simplices is filtered by the radius of their minimal enclosing ball. + </td> + <td width="15%"> + <b>Author:</b> Vincent Rouvreau<br> + <b>Introduced in:</b> GUDHI 2.2.0<br> + <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> + <b>Includes:</b> [Miniball](https://people.inf.ethz.ch/gaertner/subdir/software/miniball.html)<br> + </td> + </tr> + <tr> + <td colspan=2 height="25"> + <b>User manual:</b> \ref cech_complex + </td> + </tr> +</table> + +### Rips complex -#### Simplex tree <table> <tr> <td width="35%" rowspan=2> - \image html "Simplex_tree_representation.png" + \image html "rips_complex_representation.png" </td> <td width="50%"> - The simplex tree is an efficient and flexible - data structure for representing general (filtered) simplicial complexes. The data structure - is described in \cite boissonnatmariasimplextreealgorithmica . + Rips complex is a simplicial complex constructed from a one skeleton graph.<br> + The filtration value of each edge is computed from a user-given distance function and is inserted until a + user-given threshold value.<br> + This complex can be built from a point cloud and a distance function, or from a distance matrix. </td> <td width="15%"> - <b>Author:</b> Clément Maria<br> - <b>Introduced in:</b> GUDHI 1.0.0<br> + <b>Author:</b> Clément Maria, Pawel Dlotko, Vincent Rouvreau, Marc Glisse<br> + <b>Introduced in:</b> GUDHI 2.0.0<br> <b>Copyright:</b> MIT<br> </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref simplex_tree + <b>User manual:</b> \ref rips_complex </td> </tr> </table> -#### Skeleton blocker +### Witness complex <table> <tr> <td width="35%" rowspan=2> - \image html "ds_representation.png" + \image html "Witness_complex_representation.png" </td> <td width="50%"> - The Skeleton-Blocker data-structure proposes a light encoding for simplicial complexes by storing only an *implicit* - representation of its simplices \cite socg_blockers_2011,\cite blockers2012. Intuitively, it just stores the - 1-skeleton of a simplicial complex with a graph and the set of its "missing faces" that is very small in practice. - This data-structure handles all simplicial complexes operations such as simplex enumeration or simplex removal but - operations that are particularly efficient are operations that do not require simplex enumeration such as edge - iteration, link computation or simplex contraction. + Witness complex \f$ Wit(W,L) \f$ is a simplicial complex defined on two sets of points in \f$\mathbb{R}^D\f$. + The data structure is described in \cite boissonnatmariasimplextreealgorithmica . </td> <td width="15%"> - <b>Author:</b> David Salinas<br> - <b>Introduced in:</b> GUDHI 1.1.0<br> - <b>Copyright:</b> MIT<br> + <b>Author:</b> Siargey Kachanovich<br> + <b>Introduced in:</b> GUDHI 1.3.0<br> + <b>Copyright:</b> MIT ([GPL v3](../../licensing/) for Euclidean version)<br> + <b>Euclidean version requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref skbl + <b>User manual:</b> \ref witness_complex </td> </tr> </table> -#### Toplex Map - +### Cover Complexes <table> <tr> <td width="35%" rowspan=2> - \image html "map.png" + \image html "gicvisu.jpg" </td> <td width="50%"> - The Toplex map data structure is composed firstly of a raw storage of toplices (the maximal simplices) - and secondly of a map which associate any vertex to a set of pointers toward all toplices - containing this vertex. + Nerves and Graph Induced Complexes are cover complexes, i.e. simplicial complexes that provably contain + topological information about the input data. They can be computed with a cover of the + data, that comes i.e. from the preimage of a family of intervals covering the image + of a scalar-valued function defined on the data. <br> </td> <td width="15%"> - <b>Author:</b> François Godi<br> + <b>Author:</b> Mathieu Carrière<br> <b>Introduced in:</b> GUDHI 2.1.0<br> - <b>Copyright:</b> MIT<br> + <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> + <b>Requires:</b> \ref cgal ≥ 4.11.0 </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref toplex_map + <b>User manual:</b> \ref cover_complex </td> </tr> </table> -### Basic operations - -#### Contraction +### Tangential complex <table> <tr> <td width="35%" rowspan=2> - \image html "sphere_contraction_representation.png" + \image html "tc_examples.png" </td> <td width="50%"> - The purpose of this package is to offer a user-friendly interface for edge contraction simplification of huge - simplicial complexes. It uses the \ref skbl data-structure whose size remains small during simplification of most - used geometrical complexes of topological data analysis such as the Rips or the Delaunay complexes. In practice, - the size of this data-structure is even much lower than the total number of simplices. + A Tangential Delaunay complex is a <a target="_blank" href="https://en.wikipedia.org/wiki/Simplicial_complex">simplicial complex</a> + designed to reconstruct a \f$ k \f$-dimensional manifold embedded in \f$ d \f$-dimensional Euclidean space. + The input is a point sample coming from an unknown manifold. + The running time depends only linearly on the extrinsic dimension \f$ d \f$ + and exponentially on the intrinsic dimension \f$ k \f$. </td> <td width="15%"> - <b>Author:</b> David Salinas<br> - <b>Introduced in:</b> GUDHI 1.1.0<br> - <b>Copyright:</b> MIT [(LGPL v3)](../../licensing/)<br> - <b>Requires:</b> \ref cgal ≥ 4.11.0 + <b>Author:</b> Clément Jamin<br> + <b>Introduced in:</b> GUDHI 2.0.0<br> + <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> + <b>Requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 </td> </tr> <tr> <td colspan=2 height="25"> - <b>User manual:</b> \ref contr + <b>User manual:</b> \ref tangential_complex </td> </tr> </table> @@ -305,36 +328,6 @@ </tr> </table> -## Manifold reconstruction {#ManifoldReconstruction} - -### Tangential complex - -<table> - <tr> - <td width="35%" rowspan=2> - \image html "tc_examples.png" - </td> - <td width="50%"> - A Tangential Delaunay complex is a <a target="_blank" href="https://en.wikipedia.org/wiki/Simplicial_complex">simplicial complex</a> - designed to reconstruct a \f$ k \f$-dimensional manifold embedded in \f$ d \f$-dimensional Euclidean space. - The input is a point sample coming from an unknown manifold. - The running time depends only linearly on the extrinsic dimension \f$ d \f$ - and exponentially on the intrinsic dimension \f$ k \f$. - </td> - <td width="15%"> - <b>Author:</b> Clément Jamin<br> - <b>Introduced in:</b> GUDHI 2.0.0<br> - <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> - <b>Requires:</b> \ref eigen ≥ 3.1.0 and \ref cgal ≥ 4.11.0 - </td> - </tr> - <tr> - <td colspan=2 height="25"> - <b>User manual:</b> \ref tangential_complex - </td> - </tr> -</table> - ## Topological descriptors tools {#TopologicalDescriptorsTools} ### Bottleneck distance @@ -390,3 +383,26 @@ </td> </tr> </table> + +## Point cloud utilities {#PointCloudUtils} + +<table> + <tr> + <td width="35%" rowspan=2> + \f$(x_1,\ldots,x_d)\f$ + </td> + <td width="50%"> + This contains various tools to handle point clouds: spatial searching, subsampling, etc. + </td> + <td width="15%"> + <b>Author:</b> Clément Jamin<br> + <b>Introduced in:</b> GUDHI 1.3.0<br> + <b>Copyright:</b> MIT [(GPL v3)](../../licensing/)<br> + </td> + </tr> + <tr> + <td colspan=2 height="25"> + <b>Manuals:</b> \ref spatial_searching, \ref subsampling + </td> + </tr> +</table> diff --git a/src/python/doc/_templates/layout.html b/src/python/doc/_templates/layout.html index 2f2d9c72..a672a281 100644 --- a/src/python/doc/_templates/layout.html +++ b/src/python/doc/_templates/layout.html @@ -201,7 +201,7 @@ <a href="#">Download</a> <ul class="dropdown"> <li><a href="/licensing/">Licensing</a></li> - <li><a href="https://gforge.inria.fr/frs/download.php/latestzip/5253/library-latest.zip" target="_blank">Get the latest sources</a></li> + <li><a href="https://github.com/GUDHI/gudhi-devel/releases/latest" target="_blank">Get the latest sources</a></li> <li><a href="/conda/">Conda package</a></li> <li><a href="/dockerfile/">Dockerfile</a></li> </ul> diff --git a/src/python/doc/alpha_complex_sum.inc b/src/python/doc/alpha_complex_sum.inc index a1184663..b5af0d27 100644 --- a/src/python/doc/alpha_complex_sum.inc +++ b/src/python/doc/alpha_complex_sum.inc @@ -5,16 +5,13 @@ | .. figure:: | Alpha complex is a simplicial complex constructed from the finite | :Author: Vincent Rouvreau | | ../../doc/Alpha_complex/alpha_complex_representation.png | cells of a Delaunay Triangulation. | | | :alt: Alpha complex representation | | :Introduced in: GUDHI 2.0.0 | - | :figclass: align-center | The filtration value of each simplex is computed as the square of the | | - | | circumradius of the simplex if the circumsphere is empty (the simplex | :Copyright: MIT (`GPL v3 </licensing/>`_) | - | | is then said to be Gabriel), and as the minimum of the filtration | | - | | values of the codimension 1 cofaces that make it not Gabriel | :Requires: `Eigen <installation.html#eigen>`__ :math:`\geq` 3.1.0 and `CGAL <installation.html#cgal>`__ :math:`\geq` 4.11.0 | - | | otherwise. All simplices that have a filtration value | | - | | :math:`> \alpha^2` are removed from the Delaunay complex | | - | | when creating the simplicial complex if it is specified. | | + | :figclass: align-center | The filtration value of each simplex is computed as the **square** of | | + | | the circumradius of the simplex if the circumsphere is empty (the | :Copyright: MIT (`GPL v3 </licensing/>`_) | + | | simplex is then said to be Gabriel), and as the minimum of the | | + | | filtration values of the codimension 1 cofaces that make it not | :Requires: `Eigen <installation.html#eigen>`__ :math:`\geq` 3.1.0 and `CGAL <installation.html#cgal>`__ :math:`\geq` 4.11.0 | + | | Gabriel otherwise. | | | | | | - | | This package requires having CGAL version 4.7 or higher (4.8.1 is | | - | | advised for better performance). | | + | | For performances reasons, it is advised to use CGAL ≥ 5.0.0. | | +----------------------------------------------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ | * :doc:`alpha_complex_user` | * :doc:`alpha_complex_ref` | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/src/python/doc/reader_utils_ref.rst b/src/python/doc/diagram_readers_ref.rst index b8977a5a..c79daf9c 100644 --- a/src/python/doc/reader_utils_ref.rst +++ b/src/python/doc/diagram_readers_ref.rst @@ -2,13 +2,9 @@ .. To get rid of WARNING: document isn't included in any toctree -============================= -Reader utils reference manual -============================= - -.. autofunction:: gudhi.read_points_from_off_file - -.. autofunction:: gudhi.read_lower_triangular_matrix_from_csv_file +================================ +Diagram readers reference manual +================================ .. autofunction:: gudhi.read_persistence_intervals_grouped_by_dimension diff --git a/src/python/doc/index.rst b/src/python/doc/index.rst index c36a578f..3387a64f 100644 --- a/src/python/doc/index.rst +++ b/src/python/doc/index.rst @@ -6,8 +6,8 @@ GUDHI Python modules documentation :alt: Gudhi banner :figclass: align-center -Complexes -********* +Data structures for cell complexes +********************************** Cubical complexes ================= @@ -17,18 +17,26 @@ Cubical complexes Simplicial complexes ==================== +Simplex tree +------------ + +.. include:: simplex_tree_sum.inc + +Filtrations and reconstructions +******************************* + Alpha complex -------------- +============= .. include:: alpha_complex_sum.inc Rips complex ------------- +============ .. include:: rips_complex_sum.inc Witness complex ---------------- +=============== .. include:: witness_complex_sum.inc @@ -37,16 +45,10 @@ Cover complexes .. include:: nerve_gic_complex_sum.inc -Data structures and basic operations -************************************ - -Data structures -=============== - -Simplex tree ------------- +Tangential complex +================== -.. include:: simplex_tree_sum.inc +.. include:: tangential_complex_sum.inc Topological descriptors computation *********************************** @@ -56,15 +58,6 @@ Persistence cohomology .. include:: persistent_cohomology_sum.inc -Manifold reconstruction -*********************** - -Tangential complex -================== - -.. include:: tangential_complex_sum.inc - - Topological descriptors tools ***************************** @@ -88,6 +81,11 @@ Persistence graphical tools .. include:: persistence_graphical_tools_sum.inc +Point cloud utilities +********************* + +.. include:: point_cloud_sum.inc + Bibliography ************ diff --git a/src/python/doc/point_cloud.rst b/src/python/doc/point_cloud.rst new file mode 100644 index 00000000..d668428a --- /dev/null +++ b/src/python/doc/point_cloud.rst @@ -0,0 +1,22 @@ +:orphan: + +.. To get rid of WARNING: document isn't included in any toctree + +============================ +Point cloud utilities manual +============================ + +File Readers +------------ + +.. autofunction:: gudhi.read_points_from_off_file + +.. autofunction:: gudhi.read_lower_triangular_matrix_from_csv_file + +Subsampling +----------- + +.. automodule:: gudhi.subsampling + :members: + :special-members: + :show-inheritance: diff --git a/src/python/doc/point_cloud_sum.inc b/src/python/doc/point_cloud_sum.inc new file mode 100644 index 00000000..85d52de7 --- /dev/null +++ b/src/python/doc/point_cloud_sum.inc @@ -0,0 +1,15 @@ +.. table:: + :widths: 30 50 20 + + +----------------------------------------------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ + | | :math:`(x_1, x_2, \ldots, x_d)` | Utilities to process point clouds: read from file, subsample, etc. | :Author: Vincent Rouvreau | + | | :math:`(y_1, y_2, \ldots, y_d)` | | | + | | | :Introduced in: GUDHI 2.0.0 | + | | | | + | | | :Copyright: MIT (`GPL v3 </licensing/>`_) | + | | Parts of this package require CGAL. | | + | | | :Requires: `Eigen <installation.html#eigen>`__ :math:`\geq` 3.1.0 and `CGAL <installation.html#cgal>`__ :math:`\geq` 4.11.0 | + | | | | + +----------------------------------------------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ + | * :doc:`point_cloud` | + +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/src/python/example/alpha_complex_from_points_example.py b/src/python/example/alpha_complex_from_points_example.py index a746998c..844d7a82 100755 --- a/src/python/example/alpha_complex_from_points_example.py +++ b/src/python/example/alpha_complex_from_points_example.py @@ -52,4 +52,9 @@ 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)) -print("point[5]=", alpha_complex.get_point(5)) +try: + print("point[5]=", alpha_complex.get_point(5)) +except IndexError: + pass +else: + assert False diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index f3ca3dd5..fff3e920 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -24,11 +24,11 @@ __license__ = "GPL v3" cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": cdef cppclass Alpha_complex_interface "Gudhi::alpha_complex::Alpha_complex_interface": - Alpha_complex_interface(vector[vector[double]] points) + Alpha_complex_interface(vector[vector[double]] points) except + # 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) + Alpha_complex_interface(string off_file, bool from_file) except + + vector[double] get_point(int vertex) except + + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except + # AlphaComplex python interface cdef class AlphaComplex: @@ -96,8 +96,7 @@ cdef class AlphaComplex: :rtype: list of float :returns: the point. """ - cdef vector[double] point = self.thisptr.get_point(vertex) - return point + return self.thisptr.get_point(vertex) def create_simplex_tree(self, max_alpha_square = float('inf')): """ diff --git a/src/python/gudhi/euclidean_strong_witness_complex.pyx b/src/python/gudhi/euclidean_strong_witness_complex.pyx index 9889f92c..aca6084e 100644 --- a/src/python/gudhi/euclidean_strong_witness_complex.pyx +++ b/src/python/gudhi/euclidean_strong_witness_complex.pyx @@ -22,9 +22,9 @@ __license__ = "GPL v3" cdef extern from "Euclidean_strong_witness_complex_interface.h" namespace "Gudhi": cdef cppclass Euclidean_strong_witness_complex_interface "Gudhi::witness_complex::Euclidean_strong_witness_complex_interface": Euclidean_strong_witness_complex_interface(vector[vector[double]] landmarks, vector[vector[double]] witnesses) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, - unsigned limit_dimension) + unsigned limit_dimension) except + vector[double] get_point(unsigned vertex) # EuclideanStrongWitnessComplex python interface diff --git a/src/python/gudhi/euclidean_witness_complex.pyx b/src/python/gudhi/euclidean_witness_complex.pyx index e3ce0e82..fb0c2201 100644 --- a/src/python/gudhi/euclidean_witness_complex.pyx +++ b/src/python/gudhi/euclidean_witness_complex.pyx @@ -22,9 +22,9 @@ __license__ = "GPL v3" cdef extern from "Euclidean_witness_complex_interface.h" namespace "Gudhi": cdef cppclass Euclidean_witness_complex_interface "Gudhi::witness_complex::Euclidean_witness_complex_interface": Euclidean_witness_complex_interface(vector[vector[double]] landmarks, vector[vector[double]] witnesses) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, - unsigned limit_dimension) + unsigned limit_dimension) except + vector[double] get_point(unsigned vertex) # EuclideanWitnessComplex python interface diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx index a0d5bf25..7e6d9d80 100644 --- a/src/python/gudhi/off_reader.pyx +++ b/src/python/gudhi/off_reader.pyx @@ -26,7 +26,7 @@ def read_points_from_off_file(off_file=''): :type off_file: string :returns: The point set. - :rtype: vector[vector[double]] + :rtype: List[List[float]] """ if off_file: if os.path.isfile(off_file): diff --git a/src/python/gudhi/reader_utils.pyx b/src/python/gudhi/reader_utils.pyx index d6033b86..fe1c3a2e 100644 --- a/src/python/gudhi/reader_utils.pyx +++ b/src/python/gudhi/reader_utils.pyx @@ -34,7 +34,7 @@ def read_lower_triangular_matrix_from_csv_file(csv_file='', separator=';'): :type separator: char :returns: The lower triangular matrix. - :rtype: vector[vector[double]] + :rtype: List[List[float]] """ if csv_file: if path.isfile(csv_file): @@ -45,15 +45,15 @@ def read_lower_triangular_matrix_from_csv_file(csv_file='', separator=';'): def read_persistence_intervals_grouped_by_dimension(persistence_file=''): """Reads a file containing persistence intervals. Each line might contain 2, 3 or 4 values: [[field] dimension] birth death - The return value is an `map[dim, vector[pair[birth, death]]]` - where `dim` is an `int`, `birth` a `double`, and `death` a `double`. + The return value is a `dict(dim, list(tuple(birth, death)))` + where `dim` is an `int`, `birth` a `float`, and `death` a `float`. Note: the function does not check that birth <= death. :param persistence_file: A persistence file style name. :type persistence_file: string :returns: The persistence pairs grouped by dimension. - :rtype: map[int, vector[pair[double, double]]] + :rtype: Dict[int, List[Tuple[float, float]]] """ if persistence_file: if path.isfile(persistence_file): diff --git a/src/python/gudhi/rips_complex.pyx b/src/python/gudhi/rips_complex.pyx index 722cdcdc..deb8057a 100644 --- a/src/python/gudhi/rips_complex.pyx +++ b/src/python/gudhi/rips_complex.pyx @@ -28,7 +28,7 @@ cdef extern from "Rips_complex_interface.h" namespace "Gudhi": void init_matrix(vector[vector[double]] values, double threshold) void init_points_sparse(vector[vector[double]] values, double threshold, double sparse) void init_matrix_sparse(vector[vector[double]] values, double threshold, double sparse) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, int dim_max) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, int dim_max) except + # RipsComplex python interface cdef class RipsComplex: diff --git a/src/python/gudhi/simplex_tree.pxd b/src/python/gudhi/simplex_tree.pxd index 1066d44b..96d14079 100644 --- a/src/python/gudhi/simplex_tree.pxd +++ b/src/python/gudhi/simplex_tree.pxd @@ -39,7 +39,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": vector[pair[vector[int], double]] get_star(vector[int] simplex) vector[pair[vector[int], double]] get_cofaces(vector[int] simplex, int dimension) - void expansion(int max_dim) + void expansion(int max_dim) except + void remove_maximal_simplex(vector[int] simplex) bool prune_above_filtration(double filtration) bool make_filtration_non_decreasing() diff --git a/src/python/gudhi/strong_witness_complex.pyx b/src/python/gudhi/strong_witness_complex.pyx index 2c33c3f2..9f89d3ae 100644 --- a/src/python/gudhi/strong_witness_complex.pyx +++ b/src/python/gudhi/strong_witness_complex.pyx @@ -22,9 +22,9 @@ __license__ = "MIT" cdef extern from "Strong_witness_complex_interface.h" namespace "Gudhi": cdef cppclass Strong_witness_complex_interface "Gudhi::witness_complex::Strong_witness_complex_interface": Strong_witness_complex_interface(vector[vector[pair[size_t, double]]] nearest_landmark_table) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, - unsigned limit_dimension) + unsigned limit_dimension) except + # StrongWitnessComplex python interface cdef class StrongWitnessComplex: diff --git a/src/python/gudhi/subsampling.pyx b/src/python/gudhi/subsampling.pyx index c501d16b..f77c6f75 100644 --- a/src/python/gudhi/subsampling.pyx +++ b/src/python/gudhi/subsampling.pyx @@ -33,13 +33,15 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi The iteration starts with the landmark `starting point`. :param points: The input point set. - :type points: vector[vector[double]]. + :type points: Iterable[Iterable[float]]. Or :param off_file: An OFF file style name. :type off_file: string + And in both cases + :param nb_points: Number of points of the subsample. :type nb_points: unsigned. :param starting_point: The iteration starts with the landmark `starting \ @@ -47,7 +49,7 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi index is chosen randomly. :type starting_point: unsigned. :returns: The subsample point set. - :rtype: vector[vector[double]] + :rtype: List[List[float]]. """ if off_file: if os.path.isfile(off_file): @@ -74,17 +76,19 @@ def pick_n_random_points(points=None, off_file='', nb_points=0): """Subsample a point set by picking random vertices. :param points: The input point set. - :type points: vector[vector[double]]. + :type points: Iterable[Iterable[float]]. Or :param off_file: An OFF file style name. :type off_file: string + And in both cases + :param nb_points: Number of points of the subsample. :type nb_points: unsigned. :returns: The subsample point set. - :rtype: vector[vector[double]] + :rtype: List[List[float]] """ if off_file: if os.path.isfile(off_file): @@ -103,18 +107,20 @@ def sparsify_point_set(points=None, off_file='', min_squared_dist=0.0): between any two points is greater than or equal to min_squared_dist. :param points: The input point set. - :type points: vector[vector[double]]. + :type points: Iterable[Iterable[float]]. Or :param off_file: An OFF file style name. :type off_file: string + And in both cases + :param min_squared_dist: Minimum squared distance separating the output \ points. :type min_squared_dist: float. :returns: The subsample point set. - :rtype: vector[vector[double]] + :rtype: List[List[float]] """ if off_file: if os.path.isfile(off_file): diff --git a/src/python/gudhi/witness_complex.pyx b/src/python/gudhi/witness_complex.pyx index b032a5a1..e589d006 100644 --- a/src/python/gudhi/witness_complex.pyx +++ b/src/python/gudhi/witness_complex.pyx @@ -22,9 +22,9 @@ __license__ = "MIT" cdef extern from "Witness_complex_interface.h" namespace "Gudhi": cdef cppclass Witness_complex_interface "Gudhi::witness_complex::Witness_complex_interface": Witness_complex_interface(vector[vector[pair[size_t, double]]] nearest_landmark_table) - void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, - unsigned limit_dimension) + unsigned limit_dimension) except + # WitnessComplex python interface cdef class WitnessComplex: diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index e9bbadb0..8614eee3 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -50,13 +50,9 @@ class Alpha_complex_interface { std::vector<double> get_point(int vh) { std::vector<double> vd; - try { - Point_d const& ph = alpha_complex_->get_point(vh); - for (auto coord = ph.cartesian_begin(); coord != ph.cartesian_end(); coord++) - vd.push_back(CGAL::to_double(*coord)); - } catch (std::out_of_range const&) { - // std::out_of_range is thrown in case not found. Other exceptions must be re-thrown - } + Point_d const& ph = alpha_complex_->get_point(vh); + for (auto coord = ph.cartesian_begin(); coord != ph.cartesian_end(); coord++) + vd.push_back(CGAL::to_double(*coord)); return vd; } diff --git a/src/python/setup.py.in b/src/python/setup.py.in index 9c2124f4..bd7fb180 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -8,7 +8,7 @@ - YYYY/MM Author: Description of the modification """ -from setuptools import setup, Extension +from setuptools import setup, Extension, find_packages from Cython.Build import cythonize from numpy import get_include as numpy_get_include import sys @@ -44,7 +44,7 @@ for module in modules: setup( name = 'gudhi', - packages=["gudhi",], + packages=find_packages(), # find_namespace_packages(include=["gudhi*"]) author='GUDHI Editorial Board', author_email='gudhi-contact@lists.gforge.inria.fr', version='@GUDHI_VERSION@', diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py index 0d9e9e45..3761fe16 100755 --- a/src/python/test/test_alpha_complex.py +++ b/src/python/test/test_alpha_complex.py @@ -65,8 +65,18 @@ def test_infinite_alpha(): assert point_list[1] == alpha_complex.get_point(1) assert point_list[2] == alpha_complex.get_point(2) assert point_list[3] == alpha_complex.get_point(3) - assert alpha_complex.get_point(4) == [] - assert alpha_complex.get_point(125) == [] + try: + alpha_complex.get_point(4) == [] + except IndexError: + pass + else: + assert False + try: + alpha_complex.get_point(125) == [] + except IndexError: + pass + else: + assert False def test_filtered_alpha(): @@ -82,8 +92,18 @@ def test_filtered_alpha(): assert point_list[1] == filtered_alpha.get_point(1) assert point_list[2] == filtered_alpha.get_point(2) assert point_list[3] == filtered_alpha.get_point(3) - assert filtered_alpha.get_point(4) == [] - assert filtered_alpha.get_point(125) == [] + try: + filtered_alpha.get_point(4) == [] + except IndexError: + pass + else: + assert False + try: + filtered_alpha.get_point(125) == [] + except IndexError: + pass + else: + assert False assert simplex_tree.get_filtration() == [ ([0], 0.0), |