Closed crvs closed 3 years ago
Comparing to d.Chain([])
is the correct approach. I just checked, and it works here. Can you show me an example, where it's failing, so we can figure it out?
homology_persistence()
uses Z mod 2 by default.
Maybe I'm doing something wrong, or maybe I just didn't give it enough time, I'll try to run it for longer, and if it still doesn't halt I will try to generate a toy example tomorrow.
Hi! I am having a similar issue. Seems like the order of simplices in a chain matters -- is this correct? When I am trying to run the following code, I am getting a segmentation fault:
import dionysus as d
simplices = [([0], 5), ([1], 1), ([2], 3), ([0, 1], 5), ([0, 2], 6), ([1, 2], 3)]
f = d.Filtration()
for s, t in simplices: f.append(d.Simplex(s,t))
f.sort()
m = d.homology_persistence(f)
cycle = [ [0, 2], [1, 2],[0, 1]]
indices = [f.index(d.Simplex(list(s))) for s in cycle]
#indices.sort()
chain = d.Chain([(1,i) for i in indices])
z = d.Chain([])
print(m.homologous(chain, z))
If I sort the indices (ascending order), everything works well. Am I doing something wrong?
Thanks!
Ah, that's a very good catch. The cycles you give to homologous()
were indeed expected to be sorted. I just pushed a fix that sorts them within homologous()
. If you install from this repo, you should get it. Can you test and see if it works for you? (Otherwise, the fix you give — sorting indices by hand — also works.)
Hi, I was wondering if there is a simple way of checking if a cycle is trivial or not. I have been trying to use
m.homologous(c,z)
wherec
is a chain that contains the cycle I want to check (a simple closed curve) is trivial andz
is simplyd.Chain([])
. For some reason the process seems to hang there indefinitely when I try to do this.Another thing that I was wondering is what coefficient field is being used by default, because I need to know if I need to take orientation into account when creating a chain.