1 | initial version |
Hello,
The method which fails is delta_complex which is inderectly called with homology. As a quick workaround (I did not completely debug) it seems that simplical complexes do not like vertices other than 0, 1, 2, ...
In particular, the following version of your code does work
def t2i(i,j,k,n=2):
return i+n*(j+n*k)
def grid(n=2):
edges = []
for i in range(n+1):
for j in range(n+1):
for k in range(n+1):
if i < n:
edges.append([t2i(i,j,k,n),t2i(i+1,j,k,n)])
if j < n:
edges.append([t2i(i,j,k,n),t2i(i,j+1,k,n)])
if k < n:
edges.append([t2i(i,j,k,n),t2i(i,j,k+1,n)])
return edges
def add_plaquette(complex, address, n=2):
b = address[1]
a1 = address[2]
a2 = address[3]
if address[0] == 2:
F1 = ((a1,a2,b),(a1+1,a2,b),(a1,a2+1,b))
F2 = ((a1+1,a2+1,b),(a1+1,a2,b),(a1,a2+1,b))
if address[0] == 1:
F1 = ((a1,b,a2),(a1+1,b,a2),(a1,b,a2+1))
F2 = ((a1+1,b,a2+1),(a1+1,b,a2),(a1,b,a2+1))
if address[0] == 0:
F1 = ((b,a1,a2),(b,a1+1,a2),(b,a1,a2+1))
F2 = ((b,a1+1,a2+1),(b,a1+1,a2),(b,a1,a2+1))
complex.add_face([t2i(i,j,k,n) for i,j,k in F1])
complex.add_face([t2i(i,j,k,n) for i,j,k in F2])
I then get the answer
{0: 0, 1: Z^18, 2: 0}