GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
245 stars 65 forks source link

Use the new Simplex_tree.clear function #1018

Closed mglisse closed 5 months ago

mglisse commented 6 months ago

https://github.com/GUDHI/gudhi-devel/blob/b85365770cc98c54b72f98f0af2d30efbd35e12c/src/python/gudhi/simplex_tree.pyx#L843-L846

Would using ptr->clear() work, now that we have that function? It isn't 100% equivalent, and the vector of vertices keeps its capacity, but I don't think we care about the difference. I didn't check if there are other places where we delete&recreate a Simplex_tree to clear it.

VincentRouvreau commented 6 months ago

After verifying, it seems interesting to use clear method in collapse_edges SimplexTree method. I will propose another PR

VincentRouvreau commented 5 months ago

I do not see any other places where we delete and recreate a Simplex tree to clear it. I close it, but do not hesitate to open a new issue if any other places are found.