Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdc-counting
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radek Hušek
cdc-counting
Commits
994bc084
Commit
994bc084
authored
Mar 12, 2021
by
Radek Hušek
Browse files
Options
Downloads
Patches
Plain Diff
misc: add vertex-model related functions and diamond matchings
parent
1270e50c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
graph_tools/misc.py
+45
-2
45 additions, 2 deletions
graph_tools/misc.py
with
45 additions
and
2 deletions
graph_tools/misc.py
+
45
−
2
View file @
994bc084
def
_init_
():
global
sun
,
count_cdc_naive
,
graph_to_gadget
global
sun
,
count_cdc_naive
,
graph_to_gadget
,
\
edge_model_join
,
edge_model_join_matrix
,
parameter_matrix
,
\
enumerate_diamond_matchings
from
.base
import
Gadget
,
CUBIC_VERTEX
from
.base
import
Gadget
,
CUBIC_VERTEX
,
Boundary
,
FakeGadget
from
.parameters
import
CircuitDoubleCover
from
.sequences
import
Necklace
def
sun
(
k
):
...
...
@@ -113,5 +116,45 @@ def _init_():
return
b
def
edge_model_join
(
g1
:
Gadget
,
g2
:
Gadget
):
assert
g1
.
size
()
==
g2
.
size
()
joins
=
[
((
1
,
i
+
1
),
(
2
,
i
+
1
))
for
i
in
range
(
g1
.
size
())
]
return
Gadget
.
join
([
g1
,
g2
],
joins
,
[])
def
parameter_matrix
(
P
,
gadgets
):
from
sage.all
import
matrix
,
QQ
m
=
matrix
(
QQ
,
len
(
gadgets
),
len
(
gadgets
))
for
r
,
gr
in
enumerate
(
gadgets
):
for
c
,
gc
in
enumerate
(
gadgets
):
m
[
r
,
c
]
=
edge_model_join
(
gr
,
gc
).
eval
(
P
)
return
m
def
edge_model_join_matrix
(
P
,
k
):
BG
=
[
FakeGadget
(
k
,
[
Boundary
(
b
,
1
)
])
for
b
in
P
.
enumerate_boundaries
(
k
)
]
return
parameter_matrix
(
P
,
BG
)
def
enumerate_diamond_matchings
(
k
):
assert
k
%
2
==
0
and
k
>=
2
b
=
Necklace
.
gadget
(
1
)
if
k
==
2
:
yield
b
return
for
m
in
enumerate_diamond_matchings
(
k
-
2
):
for
i
in
range
(
k
-
1
):
o
=
[
(
1
,
i
+
1
)
for
i
in
range
(
k
-
2
)
]
o
.
insert
(
i
,
(
2
,
1
))
o
.
append
((
2
,
2
))
yield
Gadget
.
join
([
m
,
b
],
[],
o
)
_init_
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment