fix bug
This commit is contained in:
@@ -30,13 +30,14 @@ def cogirthip(bases, integral=true):
|
|||||||
|
|
||||||
cnt=0 # actual number of instances tested
|
cnt=0 # actual number of instances tested
|
||||||
f = lambda g: g.is_connected()
|
f = lambda g: g.is_connected()
|
||||||
for n in range(4,20):
|
for N in range(8,20):
|
||||||
for g in filter(f, graphs(n)):
|
for g in filter(f, graphs(N)):
|
||||||
A=g.incidence_matrix()
|
A=g.incidence_matrix()
|
||||||
n,m = A.dimensions()
|
n,m = A.dimensions()
|
||||||
# enumerate all vectors in F_2^n with even number of 1s
|
# enumerate all vectors in F_2^n with even number of 1s
|
||||||
V = VectorSpace(GF(2), n)
|
V = VectorSpace(GF(2), N)
|
||||||
for v in filter(lambda v: v.hamming_weight() % 2 == 0 and v!=0, V):
|
for v in filter(lambda v: v.hamming_weight() % 2 == 0 and v!=0, V):
|
||||||
|
cnt=cnt+1
|
||||||
v_col=matrix(v).transpose()
|
v_col=matrix(v).transpose()
|
||||||
A_t=A.augment(v_col)
|
A_t=A.augment(v_col)
|
||||||
# print(A_t)
|
# print(A_t)
|
||||||
@@ -46,9 +47,9 @@ for n in range(4,20):
|
|||||||
strength=cogirthip(bases,integral=false)
|
strength=cogirthip(bases,integral=false)
|
||||||
cogirth =cogirthip(bases,integral=true)
|
cogirth =cogirthip(bases,integral=true)
|
||||||
gap = cogirth/strength
|
gap = cogirth/strength
|
||||||
if gap > 2.01:
|
if gap > 3.01:
|
||||||
print(f"bad example! gap={gap}")
|
print(f"bad example! gap={gap}")
|
||||||
with open("projection.out", "a") as f:
|
with open("projection.out", "a") as file:
|
||||||
f.write(str(gap)+"\n"+str(A_t)+"\n")
|
file.write(str(gap)+"\n"+str(A_t)+"\n")
|
||||||
else:
|
if cnt%100==0:
|
||||||
print(f"n={n},m={m},gap={gap}")
|
print(f"#{cnt},n={n},m={m}")
|
||||||
Reference in New Issue
Block a user