Skip to content
Snippets Groups Projects
Commit 8eaeea23 authored by Radek Hušek's avatar Radek Hušek
Browse files

speed up analyze-cycle

parent 5bb1656f
Branches
No related tags found
No related merge requests found
......@@ -11,21 +11,15 @@ def calc(s):
_bmap = { x: i for i, x in enumerate(b) }
def eval_(g):
ret = set()
for b_ in ( _bmap[x.boundary] for x in g.eval(CircuitDoubleCover) if x.value > 0 ):
if b_ not in m:
x = set()
cg = FakeGadget(s, [ Boundary(b[b_], 1) ])
for r, rb in enumerate(b):
rg = FakeGadget(s, [ Boundary(rb, 1) ])
g_ = FakeGadget(g.size(), g.eval(CircuitDoubleCover))
for c, cb in enumerate(b):
cg = FakeGadget(g.size(), [ Boundary(cb, 1) ])
v = Gadget.join(
[ cg, rg ],
[ cg, g_ ],
[ ((1, i), (2, i)) for i in range(1, s+1) ],
[]
).eval(CircuitDoubleCover)
if v > 0: x.add(r)
m[b_] = x
ret.update(m[b_])
if v > 0: ret.add(c)
return ret
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment