summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-27 10:40:34 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-27 10:40:34 +0100
commitc7b70317b643b2eb9c603602da9c979388829821 (patch)
treeb6902eb51b29d0033f086f80ba3cb5d82c11c9d8
parent6e9211cccad31145a5675a33689b167008ac1ffa (diff)
parent5d5f40493ce60f2a606793645bf713c60fb5284d (diff)
Merge branch 'master' into print_warnings_to_stderr
-rw-r--r--CMakeGUDHIVersion.txt2
-rw-r--r--Conventions.txt1
-rw-r--r--code_conventions.md26
-rw-r--r--next_release.md28
-rw-r--r--src/cmake/modules/GUDHI_user_version_target.cmake2
-rw-r--r--src/common/doc/main_page.md276
-rw-r--r--src/python/doc/diagram_readers_ref.rst (renamed from src/python/doc/reader_utils_ref.rst)10
-rw-r--r--src/python/doc/index.rst44
-rw-r--r--src/python/doc/point_cloud.rst22
-rw-r--r--src/python/doc/point_cloud_sum.inc15
-rwxr-xr-xsrc/python/example/alpha_complex_from_points_example.py7
-rw-r--r--src/python/gudhi/alpha_complex.pyx13
-rw-r--r--src/python/gudhi/cubical_complex.pyx2
-rw-r--r--src/python/gudhi/euclidean_strong_witness_complex.pyx4
-rw-r--r--src/python/gudhi/euclidean_witness_complex.pyx4
-rw-r--r--src/python/gudhi/nerve_gic.pyx12
-rw-r--r--src/python/gudhi/off_reader.pyx4
-rw-r--r--src/python/gudhi/periodic_cubical_complex.pyx2
-rw-r--r--src/python/gudhi/reader_utils.pyx16
-rw-r--r--src/python/gudhi/rips_complex.pyx2
-rw-r--r--src/python/gudhi/simplex_tree.pxd2
-rw-r--r--src/python/gudhi/simplex_tree.pyx2
-rw-r--r--src/python/gudhi/strong_witness_complex.pyx4
-rw-r--r--src/python/gudhi/subsampling.pyx26
-rw-r--r--src/python/gudhi/tangential_complex.pyx2
-rw-r--r--src/python/gudhi/witness_complex.pyx4
-rw-r--r--src/python/include/Alpha_complex_interface.h10
-rw-r--r--src/python/setup.py.in4
-rwxr-xr-xsrc/python/test/test_alpha_complex.py37
29 files changed, 357 insertions, 226 deletions
diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt
index eb2a0666..ed19ecfb 100644
--- a/CMakeGUDHIVersion.txt
+++ b/CMakeGUDHIVersion.txt
@@ -1,5 +1,5 @@
set (GUDHI_MAJOR_VERSION 3)
-set (GUDHI_MINOR_VERSION 0)
+set (GUDHI_MINOR_VERSION 1)
set (GUDHI_PATCH_VERSION 0)
set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION})
diff --git a/Conventions.txt b/Conventions.txt
deleted file mode 100644
index e4ae7925..00000000
--- a/Conventions.txt
+++ /dev/null
@@ -1 +0,0 @@
-Please refer to the Wiki: https://gforge.inria.fr/plugins/mediawiki/wiki/gudhi/index.php/Conventions \ No newline at end of file
diff --git a/code_conventions.md b/code_conventions.md
new file mode 100644
index 00000000..5882f78e
--- /dev/null
+++ b/code_conventions.md
@@ -0,0 +1,26 @@
+# Naming conventions
+
+## C++
+
+### In the code:
+* The classes and functions of a package should be in a sub-namespace of the `Gudhi` namespace. The sub-namespace names are in lowercase and use underscore separators. E.g. `Gudhi::package_name::`
+* Concepts are named with camel case starting with uppercase. E.g. `PersistentHomology` for the concept of Persitence homology.
+* Classes start with an uppercase letter and use underscore separators. E.g. `Skeleton_blocker_contractor`.
+* Member functions and free functions are in lowercase and use underscore separators. E.g. `int num_vertices()`.
+* Constants and macros are in uppercase.
+* Macros should begin with the prefix `GUDHI_`.
+
+### File names:
+* All headers are named *.h and all sources are named *.cpp.
+* If a single class or function is provided in a file, its name (with the same letter case) should be used for the file name.
+* If a file does not contain a single class, its name should not begin with a capital letter.
+* Test files should be called `test_[what_is_tested].cpp`. E.g. `test_sparsify_point_set.cpp`
+* Example files should be called `example_[what_it_is].cpp`. E.g. `example_sparsify_point_set.cpp`
+
+### In CMakeLists.txt files:
+* The name of the "project" should be in this form: `Package_[tests|examples|…]`. E.g. `project(Simplex_tree_examples)`.
+* The name if each "target" (first parameter of add_executable) should be in this form: `Package_{name of the cpp file without extension}`. E.g `add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp)`.
+
+## Python
+
+In progress... \ No newline at end of file
diff --git a/next_release.md b/next_release.md
new file mode 100644
index 00000000..26d4fca5
--- /dev/null
+++ b/next_release.md
@@ -0,0 +1,28 @@
+We are pleased to announce the release 3.X.X of the GUDHI library.
+
+As a major new feature, the GUDHI library now offers ...
+
+We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz).
+
+Below is a list of changes made since Gudhi 3.1.0:
+
+- [Module](link)
+ - ...
+
+- [Module](link)
+ - ...
+
+- Miscellaneous
+ - See the list of [bug fixes](https://github.com/GUDHI/gudhi-devel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A3.X.X+).
+
+
+All modules are distributed under the terms of the MIT license.
+However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details.
+
+We kindly ask users to cite the GUDHI library as appropriately as possible in their papers, and to mention the use of the GUDHI library on the web pages of their projects using GUDHI and provide us with links to these web pages.
+
+We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) for the modules of the User and Reference Manual, as well as for publications directly related to the GUDHI library.
+
+Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks.
+
+For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/3.1.0.rc1/installation.html) or [Python](https://gudhi.inria.fr/python/3.1.0.rc1/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/).
diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake
index 4fa74330..0b361a0f 100644
--- a/src/cmake/modules/GUDHI_user_version_target.cmake
+++ b/src/cmake/modules/GUDHI_user_version_target.cmake
@@ -33,8 +33,6 @@ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_CURRENT_BINARY_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio)
add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
- copy ${CMAKE_SOURCE_DIR}/Conventions.txt ${GUDHI_USER_VERSION_DIR}/Conventions.txt)
-add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_SOURCE_DIR}/README.md ${GUDHI_USER_VERSION_DIR}/README.md)
add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_SOURCE_DIR}/LICENSE ${GUDHI_USER_VERSION_DIR}/LICENSE)
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 &ge; 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 &ge; 3.1.0 and \ref cgal &ge; 4.11.0
+ <b>Author:</b> Cl&eacute;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&ccedil;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&eacute;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 &ge; 3.1.0 and \ref cgal &ge; 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 &ge; 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 &ge; 5.0.0.
</td>
<td width="15%">
- <b>Author:</b> Mathieu Carri&egrave;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 &ge; 4.11.0
+ <b>Requires:</b> \ref eigen &ge; 3.1.0 and \ref cgal &ge; 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&eacute;ment Maria<br>
- <b>Introduced in:</b> GUDHI 1.0.0<br>
+ <b>Author:</b> Cl&eacute;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 &ge; 3.1.0 and \ref cgal &ge; 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&ccedil;ois Godi<br>
+ <b>Author:</b> Mathieu Carri&egrave;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 &ge; 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 &ge; 4.11.0
+ <b>Author:</b> Cl&eacute;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 &ge; 3.1.0 and \ref cgal &ge; 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&eacute;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 &ge; 3.1.0 and \ref cgal &ge; 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/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 4ff37437..dab4b56f 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -26,11 +26,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:
@@ -71,7 +71,7 @@ cdef class AlphaComplex:
def __cinit__(self, points = None, off_file = ''):
if off_file:
if os.path.isfile(off_file):
- self.thisptr = new Alpha_complex_interface(str.encode(off_file), True)
+ self.thisptr = new Alpha_complex_interface(off_file.encode('utf-8'), True)
else:
print("file " + off_file + " not found.")
else:
@@ -98,8 +98,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/cubical_complex.pyx b/src/python/gudhi/cubical_complex.pyx
index 28913a32..1dd30b4e 100644
--- a/src/python/gudhi/cubical_complex.pyx
+++ b/src/python/gudhi/cubical_complex.pyx
@@ -87,7 +87,7 @@ cdef class CubicalComplex:
elif ((dimensions is None) and (top_dimensional_cells is None)
and (perseus_file != '')):
if os.path.isfile(perseus_file):
- self.thisptr = new Bitmap_cubical_complex_base_interface(str.encode(perseus_file))
+ self.thisptr = new Bitmap_cubical_complex_base_interface(perseus_file.encode('utf-8'))
else:
print("file " + perseus_file + " not found.", file=sys.stderr)
else:
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/nerve_gic.pyx b/src/python/gudhi/nerve_gic.pyx
index 5eb9be0d..022466c5 100644
--- a/src/python/gudhi/nerve_gic.pyx
+++ b/src/python/gudhi/nerve_gic.pyx
@@ -182,7 +182,7 @@ cdef class CoverComplex:
:returns: Read file status.
"""
if os.path.isfile(off_file):
- return self.thisptr.read_point_cloud(str.encode(off_file))
+ return self.thisptr.read_point_cloud(off_file.encode('utf-8'))
else:
print("file " + off_file + " not found.", file=sys.stderr)
return False
@@ -214,7 +214,7 @@ cdef class CoverComplex:
:type color_file_name: string
"""
if os.path.isfile(color_file_name):
- self.thisptr.set_color_from_file(str.encode(color_file_name))
+ self.thisptr.set_color_from_file(color_file_name.encode('utf-8'))
else:
print("file " + color_file_name + " not found.", file=sys.stderr)
@@ -235,7 +235,7 @@ cdef class CoverComplex:
:type cover_file_name: string
"""
if os.path.isfile(cover_file_name):
- self.thisptr.set_cover_from_file(str.encode(cover_file_name))
+ self.thisptr.set_cover_from_file(cover_file_name.encode('utf-8'))
else:
print("file " + cover_file_name + " not found.", file=sys.stderr)
@@ -268,7 +268,7 @@ cdef class CoverComplex:
:type func_file_name: string
"""
if os.path.isfile(func_file_name):
- self.thisptr.set_function_from_file(str.encode(func_file_name))
+ self.thisptr.set_function_from_file(func_file_name.encode('utf-8'))
else:
print("file " + func_file_name + " not found.", file=sys.stderr)
@@ -309,7 +309,7 @@ cdef class CoverComplex:
:type graph_file_name: string
"""
if os.path.isfile(graph_file_name):
- self.thisptr.set_graph_from_file(str.encode(graph_file_name))
+ self.thisptr.set_graph_from_file(graph_file_name.encode('utf-8'))
else:
print("file " + graph_file_name + " not found.", file=sys.stderr)
@@ -370,7 +370,7 @@ cdef class CoverComplex:
:param type: either "GIC" or "Nerve".
:type type: string
"""
- self.thisptr.set_type(str.encode(type))
+ self.thisptr.set_type(type.encode('utf-8'))
def set_verbose(self, verbose):
"""Specifies whether the program should display information or not.
diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx
index ef8f420a..0a828b83 100644
--- a/src/python/gudhi/off_reader.pyx
+++ b/src/python/gudhi/off_reader.pyx
@@ -28,11 +28,11 @@ 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):
- return read_points_from_OFF_file(str.encode(off_file))
+ return read_points_from_OFF_file(off_file.encode('utf-8'))
else:
print("file " + off_file + " not found.", file=sys.stderr)
return []
diff --git a/src/python/gudhi/periodic_cubical_complex.pyx b/src/python/gudhi/periodic_cubical_complex.pyx
index 4ec06524..fd08b976 100644
--- a/src/python/gudhi/periodic_cubical_complex.pyx
+++ b/src/python/gudhi/periodic_cubical_complex.pyx
@@ -95,7 +95,7 @@ cdef class PeriodicCubicalComplex:
elif ((dimensions is None) and (top_dimensional_cells is None)
and (periodic_dimensions is None) and (perseus_file != '')):
if os.path.isfile(perseus_file):
- self.thisptr = new Periodic_cubical_complex_base_interface(str.encode(perseus_file))
+ self.thisptr = new Periodic_cubical_complex_base_interface(perseus_file.encode('utf-8'))
else:
print("file " + perseus_file + " not found.", file=sys.stderr)
else:
diff --git a/src/python/gudhi/reader_utils.pyx b/src/python/gudhi/reader_utils.pyx
index 345c92f8..fe1c3a2e 100644
--- a/src/python/gudhi/reader_utils.pyx
+++ b/src/python/gudhi/reader_utils.pyx
@@ -34,30 +34,30 @@ 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):
- return read_matrix_from_csv_file(str.encode(csv_file), ord(separator[0]))
+ return read_matrix_from_csv_file(csv_file.encode('utf-8'), ord(separator[0]))
print("file " + csv_file + " not set or not found.")
return []
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):
- return read_pers_intervals_grouped_by_dimension(str.encode(persistence_file))
+ return read_pers_intervals_grouped_by_dimension(persistence_file.encode('utf-8'))
print("file " + persistence_file + " not set or not found.")
return []
@@ -80,7 +80,7 @@ def read_persistence_intervals_in_dimension(persistence_file='', only_this_dim=-
"""
if persistence_file:
if path.isfile(persistence_file):
- return np_array(read_pers_intervals_in_dimension(str.encode(
- persistence_file), only_this_dim))
+ return np_array(read_pers_intervals_in_dimension(persistence_file.encode(
+ 'utf-8'), only_this_dim))
print("file " + persistence_file + " not set or not found.")
return []
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/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index 85d25492..b18627c4 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -508,7 +508,7 @@ cdef class SimplexTree:
"""
if self.pcohptr != NULL:
if persistence_file != '':
- self.pcohptr.write_output_diagram(str.encode(persistence_file))
+ self.pcohptr.write_output_diagram(persistence_file.encode('utf-8'))
else:
print("persistence_file must be specified")
else:
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 b1812087..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,15 +49,15 @@ 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):
if starting_point == '':
- return subsampling_n_farthest_points_from_file(str.encode(off_file),
+ return subsampling_n_farthest_points_from_file(off_file.encode('utf-8'),
nb_points)
else:
- return subsampling_n_farthest_points_from_file(str.encode(off_file),
+ return subsampling_n_farthest_points_from_file(off_file.encode('utf-8'),
nb_points,
starting_point)
else:
@@ -74,21 +76,23 @@ 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):
- return subsampling_n_random_points_from_file(str.encode(off_file),
+ return subsampling_n_random_points_from_file(off_file.encode('utf-8'),
nb_points)
else:
print("file " + off_file + " not found.")
@@ -103,22 +107,24 @@ 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):
- return subsampling_sparsify_points_from_file(str.encode(off_file),
+ return subsampling_sparsify_points_from_file(off_file.encode('utf-8'),
min_squared_dist)
else:
print("file " + off_file + " not found.")
diff --git a/src/python/gudhi/tangential_complex.pyx b/src/python/gudhi/tangential_complex.pyx
index 0083033c..6391488c 100644
--- a/src/python/gudhi/tangential_complex.pyx
+++ b/src/python/gudhi/tangential_complex.pyx
@@ -66,7 +66,7 @@ cdef class TangentialComplex:
def __cinit__(self, intrisic_dim, points=None, off_file=''):
if off_file:
if os.path.isfile(off_file):
- self.thisptr = new Tangential_complex_interface(intrisic_dim, str.encode(off_file), True)
+ self.thisptr = new Tangential_complex_interface(intrisic_dim, off_file.encode('utf-8'), True)
else:
print("file " + off_file + " not found.")
else:
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 24d05025..9c2124f4 100644
--- a/src/python/setup.py.in
+++ b/src/python/setup.py.in
@@ -11,6 +11,7 @@
from setuptools import setup, Extension
from Cython.Build import cythonize
from numpy import get_include as numpy_get_include
+import sys
__author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016 Inria"
@@ -38,7 +39,8 @@ for module in modules:
libraries=libraries,
library_dirs=library_dirs,
include_dirs=include_dirs,
- runtime_library_dirs=runtime_library_dirs,))
+ runtime_library_dirs=runtime_library_dirs,
+ cython_directives = {'language_level': str(sys.version_info[0])},))
setup(
name = 'gudhi',
diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py
index 712a50b6..3761fe16 100755
--- a/src/python/test/test_alpha_complex.py
+++ b/src/python/test/test_alpha_complex.py
@@ -11,8 +11,13 @@
from gudhi import AlphaComplex, SimplexTree
import math
import numpy as np
-import itertools
import pytest
+try:
+ # python3
+ from itertools import zip_longest
+except ImportError:
+ # python2
+ from itertools import izip_longest as zip_longest
__author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016 Inria"
@@ -60,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():
@@ -77,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),
@@ -114,6 +139,6 @@ def test_safe_alpha_persistence_comparison():
diag1 = simplex_tree1.persistence()
diag2 = simplex_tree2.persistence()
- for (first_p, second_p) in itertools.zip_longest(diag1, diag2):
+ for (first_p, second_p) in zip_longest(diag1, diag2):
assert first_p[0] == pytest.approx(second_p[0])
assert first_p[1] == pytest.approx(second_p[1])