mqt.qecc.cococo.layouts¶
Construct Example Layouts for Numerical Evaluation.
Functions¶
|
Translates a pairs circuit (with int labels) into the lattice's labels for a given layout. |
|
Generates layouts automatically, similar to those manual layouts in gen_layouts. |
|
Filter ancillas from factory_ring which should be kept in the graph considering the included factories. |
Module Contents¶
- translate_layout_circuit(pairs: list[int | translate_layout_circuit.pos], layout: mqt.qecc.cococo.types.Layout) Sequence[translate_layout_circuit.pos | tuple[translate_layout_circuit.pos, translate_layout_circuit.pos]][source]¶
Translates a pairs circuit (with int labels) into the lattice’s labels for a given layout.
However, pairs does not only include tuple[int,int] but can include int as well for T gates. Layout will also include a list of factory positions in the key=”factory_positions”. For this key, there can be the list[tuple[int,int]]. This key is never called here, so we do not need a case for the value being a list. One should note that the type annotation is not fully unambiguous here.
- gen_layout_scalable(layout_type: str, m: int, n: int, factories: list[mqt.qecc.cococo.types.pos], remove_edges: bool = True) tuple[networkx.Graph, list[mqt.qecc.cococo.types.pos], list[mqt.qecc.cococo.types.pos]][source]¶
Generates layouts automatically, similar to those manual layouts in gen_layouts.
remove_edges: bool = whether or not to remove edges of adjacent data qubit locs
the method builds up the lattice from small units defining the layout type. Then, it connects the units with edges such that a hexagonal lattice emerges. afterwards, vertices and edges are added such that we have one corridor around the whole thing
we consider the hex layout as a brickwall lattice on cartesian coordinates
m = number of row units n = number of col units
Be aware that the number of data qubits depens on m,n and the unit of the lattice type!
smallest unit for pair layout:
x--x--x | | | o--o--x--x | x x = ancilla, o = data
smallest unit for row layout:
x | o
but the edge is not necessary here
smallest unit for hex layout:
o--o--o | | x--o--o--o--x | | | x--x--x--x--x | x
smallest unit for triple layout:
o--o--o--x--x--o--o--o--x--x | | | | | x--x--x--x--x--x--x--x--x--x
smallest unit for single layout:
x--x--o--x | | x--x--x--x
ATTENTION: It’s the user’s responsibility to place factories in a reasonable way on the factory_ring!
- filter_factory_nodes(g: networkx.Graph, factory_ring: list[mqt.qecc.cococo.types.pos], factories: list[mqt.qecc.cococo.types.pos]) tuple[networkx.Graph, set[mqt.qecc.cococo.types.pos], set[mqt.qecc.cococo.types.pos]][source]¶
Filter ancillas from factory_ring which should be kept in the graph considering the included factories.
Note that one should place the factories in a suitable way such that they are not weirdly connected.