mrzv / dionysus

Library for computing persistent homology
http://mrzv.org/software/dionysus2
Other
145 stars 31 forks source link

segmentation fault when the filtration is not valid #7

Closed grjd closed 6 years ago

grjd commented 6 years ago

It may be helpful to print out an error message when calling homology_persistence(f) with a filtration that is not correctly input. For example,

simplices = [([1,2], 1), ([2,3],2)]
f = d.Filtration()
for vertices, time in simplices:
      f.append(d.Simplex(vertices, time))
m = d.homology_persistence(f)

Segmentation fault: 11

mrzv commented 6 years ago

I'm conflicted on the right way to handle this. I'm reluctant to add the error checking during the boundary construction in C++ — that goes against the general spirit of efficiency. On the other hand, I understand the problem for a novice user.

I'll think about it. Maybe the right solution is to add a check to the Python bindings directly.