diff options
author | Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> | 2022-12-12 09:15:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-12 09:15:15 +0100 |
commit | 521d3aea630f0f4860d4d0a4ca0e70d1717ad994 (patch) | |
tree | 764cfda06f6c7a032ba32d63ea63704eaaae046b | |
parent | 069abeb8bcc9f3a846654c6c2bdfe82bcf3e85ce (diff) | |
parent | 6b8da55930c5a76aefc6725d3cffb17bab5438d0 (diff) |
Merge pull request #762 from VincentRouvreau/quadratic_tangential
Insert sorted vertices in batch for tangential complex
-rw-r--r-- | src/Tangential_complex/include/gudhi/Tangential_complex.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h index b448db2d..ab203ca5 100644 --- a/src/Tangential_complex/include/gudhi/Tangential_complex.h +++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h @@ -56,6 +56,7 @@ #include <string> #include <cstddef> // for std::size_t #include <optional> +#include <numeric> // for std::iota #ifdef GUDHI_USE_TBB #include <tbb/parallel_for.h> @@ -624,6 +625,11 @@ class Tangential_complex { int max_dim = -1; + // Ordered vertices to be inserted first by the create_complex method to avoid quadratic complexity. + std::vector<typename Simplex_tree_::Vertex_handle> vertices(m_points.size()); + std::iota(vertices.begin(), vertices.end(), 0); + tree.insert_batch_vertices(vertices); + // For each triangulation for (std::size_t idx = 0; idx < m_points.size(); ++idx) { // For each cell of the star |