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