diff options
-rw-r--r-- | biblio/how_to_cite_gudhi.bib.in | 362 | ||||
m--------- | ext/hera | 0 | ||||
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 32 | ||||
-rw-r--r-- | src/Simplex_tree/test/simplex_tree_unit_test.cpp | 14 | ||||
-rw-r--r-- | src/Tangential_complex/include/gudhi/Tangential_complex.h | 5 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_submodules.cmake | 6 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_user_version_target.cmake | 5 | ||||
-rw-r--r-- | src/python/gudhi/hera/bottleneck.cc | 2 | ||||
-rw-r--r-- | src/python/gudhi/hera/wasserstein.cc | 10 | ||||
-rw-r--r-- | src/python/gudhi/representations/vector_methods.py | 7 | ||||
-rw-r--r-- | src/python/gudhi/simplex_tree.pyx | 8 | ||||
-rw-r--r-- | src/python/include/Alpha_complex_factory.h | 4 | ||||
-rw-r--r-- | src/python/setup.py.in | 6 | ||||
-rwxr-xr-x | src/python/test/test_wasserstein_distance.py | 9 |
14 files changed, 252 insertions, 218 deletions
diff --git a/biblio/how_to_cite_gudhi.bib.in b/biblio/how_to_cite_gudhi.bib.in index a1a971fc..02c09dea 100644 --- a/biblio/how_to_cite_gudhi.bib.in +++ b/biblio/how_to_cite_gudhi.bib.in @@ -1,190 +1,190 @@ @book{gudhi:urm -, title = "{GUDHI} User and Reference Manual" -, author = "{The GUDHI Project}" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, year = @GUDHI_VERSION_YEAR@ -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/" +, title = {GUDHI User and Reference Manual} +, author = {The GUDHI Project} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, year = {@GUDHI_VERSION_YEAR@} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/} } @incollection{gudhi:CubicalComplex -, author = "Pawel Dlotko" -, title = "Cubical complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cubical__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Pawel Dlotko} +, title = {Cubical complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cubical__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:FilteredComplexes -, author = "Cl\'ement Maria" -, title = "Filtered Complexes" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__simplex__tree.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Maria} +, title = {Filtered Complexes} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__simplex__tree.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:ToplexMap -, author = "Fran{{\c{c}}ois Godi" -, title = "Toplex map" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__toplex__map.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Fran{\c{c}}ois Godi} +, title = {Toplex map} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__toplex__map.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:SkeletonBlocker -, author = "David Salinas" -, title = "Skeleton-Blocker" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__skbl.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {David Salinas} +, title = {Skeleton-Blocker} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__skbl.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:Contraction -, author = "David Salinas" -, title = "Contraction" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__contr.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {David Salinas} +, title = {Contraction} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__contr.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:AlphaComplex -, author = "Vincent Rouvreau" -, title = "Alpha complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__alpha__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Vincent Rouvreau} +, title = {Alpha complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__alpha__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:CechComplex -, author = "Vincent Rouvreau, Hind Montassif" -, title = "\v{C}ech complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cech__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Vincent Rouvreau and Hind Montassif} +, title = {{\v{C}}ech complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cech__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:RipsComplex -, author = "Cl\'ement Maria, Pawel Dlotko, Vincent Rouvreau, Marc Glisse" -, title = "Rips complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__rips__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Maria and Pawel Dlotko and Vincent Rouvreau and Marc Glisse} +, title = {Rips complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__rips__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:Collapse -, author = "Siddharth Pritam, Marc Glisse" -, title = "Edge collapse" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__edge__collapse.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Siddharth Pritam and Marc Glisse} +, title = {Edge collapse} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__edge__collapse.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:WitnessComplex -, author = "Siargey Kachanovich" -, title = "Witness complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__witness__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Siargey Kachanovich} +, title = {Witness complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__witness__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:CoverComplex -, author = "Mathieu Carri\`ere" -, title = "Cover complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cover__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Mathieu Carri{\`{e}}re} +, title = {Cover complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cover__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:CoxeterTriangulation -, author = "Siargey Kachanovich" -, title = "Coxeter triangulation" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cover__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Siargey Kachanovich} +, title = {Coxeter triangulation} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__cover__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:TangentialComplex -, author = "Cl\'ement Jamin" -, title = "Tangential complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__tangential__complex.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Jamin} +, title = {Tangential complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__tangential__complex.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:PersistentCohomology -, author = "Cl\'ement Maria" -, title = "Persistent Cohomology" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__persistent__cohomology.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Maria} +, title = {Persistent Cohomology} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__persistent__cohomology.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:BottleneckDistance -, author = "Fran{{\c{c}}ois Godi" -, title = "Bottleneck distance" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__bottleneck__distance.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Fran{\c{c}}ois Godi} +, title = {Bottleneck distance} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__bottleneck__distance.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:PersistenceRepresentations -, author = "Pawel Dlotko" -, title = "Persistence representations" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group___persistence__representations.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Pawel Dlotko} +, title = {Persistence representations} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group___persistence__representations.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:SubSampling -, author = "Cl\'ement Jamin, Siargey Kachanovich" -, title = "Subsampling" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__subsampling.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Jamin and Siargey Kachanovich} +, title = {Subsampling} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__subsampling.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:SpatialSearching -, author = "Cl\'ement Jamin" -, title = "Spatial searching" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__spatial__searching.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Cl{\'{e}}ment Jamin} +, title = {Spatial searching} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/doc/@GUDHI_VERSION@/group__spatial__searching.html} +, year = {@GUDHI_VERSION_YEAR@} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -192,71 +192,71 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @incollection{gudhi:WeightedRipsComplex -, author = "Rapha\"el Tinarrage, Yuichi Ike, Masatoshi Takenouchi" -, title = "Weighted Rips Complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/rips_complex_user.html#weighted-rips-complex" -, year = @GUDHI_VERSION_YEAR@ +, author = {Rapha{\"{e}}l Tinarrage and Yuichi Ike and Masatoshi Takenouchi} +, title = {Weighted Rips Complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/rips_complex_user.html#weighted-rips-complex} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:DTMRipsComplex -, author = "Yuichi Ike" -, title = "DTM Rips Complex" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/rips_complex_user.html#dtm-rips-complex" -, year = @GUDHI_VERSION_YEAR@ +, author = {Yuichi Ike} +, title = {DTM Rips Complex} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/rips_complex_user.html#dtm-rips-complex} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:WassersteinDistance -, author = "Theo Lacombe, Marc Glisse" -, title = "Wasserstein distance" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/wasserstein_distance_user.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Th{\'{e}}o Lacombe and Marc Glisse} +, title = {Wasserstein distance} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/wasserstein_distance_user.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:PersistenceRepresentationsScikitlearnInterface -, author = "Mathieu Carri\`ere, Gard Spreemann, Wojciech Reise" -, title = "Persistence representations scikit-learn like interface" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/representations.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Mathieu Carri{\`{e}}re and Gard Spreemann and Wojciech Reise} +, title = {Persistence representations scikit-learn like interface} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/representations.html} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:Atol -, author = "Martin Royer" -, title = "Measure Vectorization for Automatic Topologically-Oriented Learning" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/representations.html#gudhi.representations.vector_methods.Atol" -, year = @GUDHI_VERSION_YEAR@ +, author = {Martin Royer} +, title = {Measure Vectorization for Automatic Topologically-Oriented Learning} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/representations.html#gudhi.representations.vector_methods.Atol} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:DistanceToMeasure -, author = "Marc Glisse" -, title = "Distance to measure" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/point_cloud.html#module-gudhi.point_cloud.knn" -, year = @GUDHI_VERSION_YEAR@ +, author = {Marc Glisse} +, title = {Distance to measure} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/point_cloud.html#module-gudhi.point_cloud.knn} +, year = {@GUDHI_VERSION_YEAR@} } @incollection{gudhi:PersistenceBasedClustering -, author = "Marc Glisse" -, title = "persistence-based clustering" -, publisher = "{GUDHI Editorial Board}" -, edition = "{@GUDHI_VERSION@}" -, booktitle = "{GUDHI} User and Reference Manual" -, url = "https://gudhi.inria.fr/python/@GUDHI_VERSION@/clustering.html" -, year = @GUDHI_VERSION_YEAR@ +, author = {Marc Glisse} +, title = {persistence-based clustering} +, publisher = {GUDHI Editorial Board} +, edition = {@GUDHI_VERSION@} +, booktitle = {GUDHI User and Reference Manual} +, url = {https://gudhi.inria.fr/python/@GUDHI_VERSION@/clustering.html} +, year = {@GUDHI_VERSION_YEAR@} } diff --git a/ext/hera b/ext/hera -Subproject b528c4067a8aac346eb307d3c23b82d5953cfe2 +Subproject 8bfdd4bd32f005c18b5c75c502b987de552d6e4 diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index ef9f8428..4177a0b8 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -24,6 +24,7 @@ #include <boost/iterator/transform_iterator.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/range/adaptor/reversed.hpp> +#include <boost/range/adaptor/transformed.hpp> #include <boost/range/size.hpp> #include <boost/container/static_vector.hpp> @@ -1122,16 +1123,12 @@ class Simplex_tree { dimension_ = 1; } - root_.members_.reserve(num_vertices(skel_graph)); + root_.members_.reserve(num_vertices(skel_graph)); // probably useless in most cases + auto verts = vertices(skel_graph) | boost::adaptors::transformed([&](auto v){ + return Dit_value_t(v, Node(&root_, get(vertex_filtration_t(), skel_graph, v))); }); + root_.members_.insert(boost::begin(verts), boost::end(verts)); + // This automatically sorts the vertices, the graph concept doesn't guarantee the order in which we iterate. - typename boost::graph_traits<OneSkeletonGraph>::vertex_iterator v_it, - v_it_end; - for (std::tie(v_it, v_it_end) = vertices(skel_graph); v_it != v_it_end; - ++v_it) { - root_.members_.emplace_hint( - root_.members_.end(), *v_it, - Node(&root_, get(vertex_filtration_t(), skel_graph, *v_it))); - } std::pair<typename boost::graph_traits<OneSkeletonGraph>::edge_iterator, typename boost::graph_traits<OneSkeletonGraph>::edge_iterator> boost_edges = edges(skel_graph); // boost_edges.first is the equivalent to boost_edges.begin() @@ -1140,7 +1137,7 @@ class Simplex_tree { auto edge = *(boost_edges.first); auto u = source(edge, skel_graph); auto v = target(edge, skel_graph); - if (u == v) throw "Self-loops are not simplicial"; + if (u == v) throw std::invalid_argument("Self-loops are not simplicial"); // We cannot skip edges with the wrong orientation and expect them to // come a second time with the right orientation, that does not always // happen in practice. emplace() should be a NOP when an element with the @@ -1159,6 +1156,21 @@ class Simplex_tree { } } + /** \brief Inserts several vertices. + * @param[in] vertices A range of Vertex_handle + * @param[in] filt filtration value of the new vertices (the same for all) + * + * This may be faster than inserting the vertices one by one, especially in a random order. + * The complex does not need to be empty before calling this function. However, if a vertex is + * already present, its filtration value is not modified, unlike with other insertion functions. */ + template <class VertexRange> + void insert_batch_vertices(VertexRange const& vertices, Filtration_value filt = 0) { + auto verts = vertices | boost::adaptors::transformed([&](auto v){ + return Dit_value_t(v, Node(&root_, filt)); }); + root_.members_.insert(boost::begin(verts), boost::end(verts)); + if (dimension_ < 0 && !root_.members_.empty()) dimension_ = 0; + } + /** \brief Expands the Simplex_tree containing only its one skeleton * until dimension max_dim. * diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index 79bb5a93..ebcc406c 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -1038,3 +1038,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_boundaries_and_opposite_vertex_iterat BOOST_CHECK(opposite_vertices.size() == 0); } } + +BOOST_AUTO_TEST_CASE(batch_vertices) { + typedef Simplex_tree<> typeST; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST BATCH VERTEX INSERTION" << std::endl; + typeST st; + st.insert_simplex_and_subfaces({3}, 1.5); + std::vector verts { 2, 3, 5, 6 }; + st.insert_batch_vertices(verts); + BOOST_CHECK(st.num_vertices() == 4); + BOOST_CHECK(st.num_simplices() == 4); + BOOST_CHECK(st.filtration(st.find({2})) == 0.); + BOOST_CHECK(st.filtration(st.find({3})) == 1.5); +} diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h index 56a24af0..b448db2d 100644 --- a/src/Tangential_complex/include/gudhi/Tangential_complex.h +++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h @@ -345,10 +345,11 @@ class Tangential_complex { m_stars.resize(m_points.size()); m_squared_star_spheres_radii_incl_margin.resize(m_points.size(), FT(-1)); #ifdef GUDHI_TC_PERTURB_POSITION - if (m_points.empty()) + if (m_points.empty()) { m_translations.clear(); - else + } else { m_translations.resize(m_points.size(), m_k.construct_vector_d_object()(m_ambient_dim)); + } #if defined(GUDHI_USE_TBB) delete[] m_p_perturb_mutexes; m_p_perturb_mutexes = new Mutex_for_perturb[m_points.size()]; diff --git a/src/cmake/modules/GUDHI_submodules.cmake b/src/cmake/modules/GUDHI_submodules.cmake index 78b045bd..c844386d 100644 --- a/src/cmake/modules/GUDHI_submodules.cmake +++ b/src/cmake/modules/GUDHI_submodules.cmake @@ -1,5 +1,3 @@ # For those who dislike bundled dependencies, this indicates where to find a preinstalled Hera. -set(HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/wasserstein/include) -set(HERA_WASSERSTEIN_INCLUDE_DIR ${HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find Hera's wasserstein.h") -set(HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/bottleneck/include) -set(HERA_BOTTLENECK_INCLUDE_DIR ${HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find Hera's bottleneck.h")
\ No newline at end of file +set(HERA_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/include) +set(HERA_INCLUDE_DIR ${HERA_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find hera/{wasserstein.h,bottleneck.h}") diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake index 4487ad86..2144ff6f 100644 --- a/src/cmake/modules/GUDHI_user_version_target.cmake +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -60,10 +60,9 @@ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) -if(HERA_WASSERSTEIN_INCLUDE_DIR STREQUAL HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR OR - HERA_BOTTLENECK_INCLUDE_DIR STREQUAL HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR) +if(HERA_INCLUDE_DIR STREQUAL HERA_INTERNAL_INCLUDE_DIR) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/ext/hera ${GUDHI_USER_VERSION_DIR}/ext/hera) + copy_directory ${CMAKE_SOURCE_DIR}/ext/hera/include ${GUDHI_USER_VERSION_DIR}/ext/hera/include) endif() set(GUDHI_DIRECTORIES "doc;example;concept;utilities") diff --git a/src/python/gudhi/hera/bottleneck.cc b/src/python/gudhi/hera/bottleneck.cc index 0cb562ce..ec461f7c 100644 --- a/src/python/gudhi/hera/bottleneck.cc +++ b/src/python/gudhi/hera/bottleneck.cc @@ -16,7 +16,7 @@ using py::ssize_t; #endif -#include <bottleneck.h> // Hera +#include <hera/bottleneck.h> // Hera double bottleneck_distance(Dgm d1, Dgm d2, double delta) { diff --git a/src/python/gudhi/hera/wasserstein.cc b/src/python/gudhi/hera/wasserstein.cc index fa0cf8aa..3516352e 100644 --- a/src/python/gudhi/hera/wasserstein.cc +++ b/src/python/gudhi/hera/wasserstein.cc @@ -8,10 +8,16 @@ * - YYYY/MM Author: Description of the modification */ -#include <wasserstein.h> // Hera - #include <pybind11_diagram_utils.h> +#ifdef _MSC_VER +// https://github.com/grey-narn/hera/issues/3 +// ssize_t is a non-standard type (well, posix) +using py::ssize_t; +#endif + +#include <hera/wasserstein.h> // Hera + double wasserstein_distance( Dgm d1, Dgm d2, double wasserstein_power, double internal_p, diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py index a169aee8..d52185ef 100644 --- a/src/python/gudhi/representations/vector_methods.py +++ b/src/python/gudhi/representations/vector_methods.py @@ -13,8 +13,13 @@ import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.exceptions import NotFittedError from sklearn.preprocessing import MinMaxScaler, MaxAbsScaler -from sklearn.neighbors import DistanceMetric from sklearn.metrics import pairwise +try: + # New location since 1.0 + from sklearn.metrics import DistanceMetric +except ImportError: + # Will be removed in 1.3 + from sklearn.neighbors import DistanceMetric from .preprocessing import DiagramScaler, BirthPersistenceTransform diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx index 24b970c4..18215d2f 100644 --- a/src/python/gudhi/simplex_tree.pyx +++ b/src/python/gudhi/simplex_tree.pyx @@ -466,7 +466,7 @@ cdef class SimplexTree: """ return self.get_ptr().prune_above_filtration(filtration) - def expansion(self, max_dim): + def expansion(self, max_dimension): """Expands the simplex tree containing only its one skeleton until dimension max_dim. @@ -480,10 +480,10 @@ cdef class SimplexTree: The simplex tree must contain no simplex of dimension bigger than 1 when calling the method. - :param max_dim: The maximal dimension. - :type max_dim: int + :param max_dimension: The maximal dimension. + :type max_dimension: int """ - cdef int maxdim = max_dim + cdef int maxdim = max_dimension with nogil: self.get_ptr().expansion(maxdim) diff --git a/src/python/include/Alpha_complex_factory.h b/src/python/include/Alpha_complex_factory.h index 3d20aa8f..41eb72c1 100644 --- a/src/python/include/Alpha_complex_factory.h +++ b/src/python/include/Alpha_complex_factory.h @@ -106,7 +106,7 @@ class Exact_alpha_complex_dD final : public Abstract_alpha_complex { return alpha_complex_.create_complex(*simplex_tree, max_alpha_square, exact_version_, default_filtration_value); } - virtual std::size_t num_vertices() const { + virtual std::size_t num_vertices() const override { return alpha_complex_.num_vertices(); } @@ -141,7 +141,7 @@ class Inexact_alpha_complex_dD final : public Abstract_alpha_complex { return alpha_complex_.create_complex(*simplex_tree, max_alpha_square, false, default_filtration_value); } - virtual std::size_t num_vertices() const { + virtual std::size_t num_vertices() const override { return alpha_complex_.num_vertices(); } diff --git a/src/python/setup.py.in b/src/python/setup.py.in index 2c67c2c5..1ecbe985 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -48,10 +48,8 @@ ext_modules = cythonize(ext_modules, compiler_directives={'language_level': '3'} for module in pybind11_modules: my_include_dirs = include_dirs + [pybind11.get_include(False), pybind11.get_include(True)] - if module == 'hera/wasserstein': - my_include_dirs = ['@HERA_WASSERSTEIN_INCLUDE_DIR@'] + my_include_dirs - elif module == 'hera/bottleneck': - my_include_dirs = ['@HERA_BOTTLENECK_INCLUDE_DIR@'] + my_include_dirs + if module.startswith('hera/'): + my_include_dirs = ['@HERA_INCLUDE_DIR@'] + my_include_dirs ext_modules.append(Extension( 'gudhi.' + module.replace('/', '.'), sources = [source_dir + module + '.cc'], diff --git a/src/python/test/test_wasserstein_distance.py b/src/python/test/test_wasserstein_distance.py index 3a004d77..a76b6ce7 100755 --- a/src/python/test/test_wasserstein_distance.py +++ b/src/python/test/test_wasserstein_distance.py @@ -90,10 +90,11 @@ def test_get_essential_parts(): def test_warn_infty(): - assert _warn_infty(matching=False)==np.inf - c, m = _warn_infty(matching=True) - assert (c == np.inf) - assert (m is None) + with pytest.warns(UserWarning): + assert _warn_infty(matching=False)==np.inf + c, m = _warn_infty(matching=True) + assert (c == np.inf) + assert (m is None) def _basic_wasserstein(wasserstein_distance, delta, test_infinity=True, test_matching=True): |