mrzv / dionysus

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

When you construct a filtration from a list of simplices it sets all their data to 0 #21

Closed salotz closed 6 years ago

salotz commented 6 years ago

Like the title says. The "bad" lines are 52 and 53. I am guessing this is a bug and not a feature.

In [48]: simplices_tups = [([2], 4), ([1,2], 5), ([0,2], 6),
    ...:               ([0], 1),   ([1], 2), ([0,1], 3)]

In [49]: simplices = [dion.Simplex(vertices, data) for vertices, data in simplices_tups]

In [50]: simplices[0]
Out[50]: <2> 4

In [51]: filtration_cons_tups = dion.Filtration(simplices_tups)

In [52]: filtration_cons_tups[0]
Out[52]: <2> 4

In [53]: filtration_cons_simplices = dion.Filtration(simplices)

In [54]: filtration_cons_simplices[0]
Out[54]: <2> 0

In [55]: filtration_append_simplex = dion.Filtration()
    ...: for vertices, data in simplices_tups:
    ...:     filtration_append_simplex.append(dion.Simplex(vertices, data))
    ...:     

In [56]: filtration_append_simplex[0]
Out[56]: <2> 4
mrzv commented 6 years ago

Just a quick confirmation: I can reproduce the problem here. It's clearly a bug (and an odd one at that). Hopefully, I can fix it soon.

mrzv commented 6 years ago

Try it now. Hopefully, the latest commit fixes it.

salotz commented 6 years ago

Thanks I'll give it a try when I can.