pytket.mapping¶
The mapping module provides an API to interact with the
MappingManager
class, with methods for
mapping logical circuits to physical circuits and for
defining custom routing solutions.
- class pytket.mapping.AASLabellingMethod¶
Defines a Labeling Method for aas for labelling all unplaced qubits in a circuit
- class pytket.mapping.AASRouteRoutingMethod¶
Defines a RoutingMethod object for mapping circuits that uses the architecture aware synthesis method implemented in tket.
- class pytket.mapping.BoxDecompositionRoutingMethod¶
Defines a RoutingMethod object for decomposing boxes.
- class pytket.mapping.LexiLabellingMethod¶
Defines a RoutingMethod for labelling Qubits that uses the Lexicographical Comparison approach outlined in arXiv:1902.08091.
- class pytket.mapping.LexiRouteRoutingMethod¶
Defines a RoutingMethod object for mapping circuits that uses the Lexicographical Comparison approach outlined in arXiv:1902.08091.Only supports 1-qubit, 2-qubit and barrier gates.
- class pytket.mapping.MappingManager¶
Defined by a pytket Architecture object, maps Circuit logical qubits to physically permitted Architecture qubits. Mapping is completed by sequential routing (full or partial) of subcircuits. A custom method for routing (full or partial) of subcircuits can be defined in Python.
- __init__(self, architecture: pytket.architecture.Architecture) None ¶
MappingManager constructor.
- Parameters:
architecture – pytket Architecture object.
- route_circuit(self, circuit: pytket.circuit.Circuit, routing_methods: collections.abc.Sequence[pytket.mapping.RoutingMethod]) bool ¶
Maps from given logical circuit to physical circuit. Modification defined by route_subcircuit, but typically this proceeds by insertion of SWAP gates that permute logical qubits on physical qubits.
- Parameters:
circuit – pytket circuit to be mapped
routing_methods – Ranked methods to use for routing subcircuits. In given order, each method is sequentially checked for viability, with the first viable method being used.
- class pytket.mapping.MultiGateReorderRoutingMethod¶
Defines a RoutingMethod object for commuting physically permitted multi-qubit gates to the front of the subcircuit.
- class pytket.mapping.RoutingMethod¶
Parent class for RoutingMethod, for inheritance purposes only, not for usage.
- class pytket.mapping.RoutingMethodCircuit¶
The RoutingMethod class captures a method for partially mapping logical subcircuits to physical operations as permitted by some architecture. Ranked RoutingMethod objects are used by the MappingManager to route whole circuits.
- __init__(self, route_subcircuit: collections.abc.Callable[[pytket.circuit.Circuit, pytket.architecture.Architecture], tuple[bool, pytket.circuit.Circuit, collections.abc.Mapping[pytket.unit_id.UnitID, pytket.unit_id.UnitID], collections.abc.Mapping[pytket.unit_id.UnitID, pytket.unit_id.UnitID]]], max_size: int, max_depth: int) None ¶
Constructor for a routing method defined by partially routing subcircuits.
- Parameters:
route_subcircuit – A function declaration that given a Circuit and Architecture object, returns a tuple containing a bool informing MappingManager whether to substitute the returned circuit into the circuit being routed, a new modified circuit, the initial logical to physical qubit mapping of the modified circuit and the permutation of logical to physical qubit mapping given operations in the modified circuit
max_size – The maximum number of gates permitted in a subcircuit
max_depth – The maximum permitted depth of a subcircuit.