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

BettiCurve: `not X` is not a safe way to test for emptiness #1023

Closed mglisse closed 2 weeks ago

mglisse commented 5 months ago

https://github.com/GUDHI/gudhi-devel/blob/e7b6d08f25e35891196ce104a014330da442cf12/src/python/gudhi/representations/vector_methods.py#L382 (there is another one a few lines below) I think this was meant as a short version of len(X)==0, but if X is a numpy array (which is perfectly valid), not does not have the intended behavior.

(replacing an empty list with a list that contains a single empty diagram also looks suspicious, but I did not look at the details)