pytket.mapping¶
- class pytket._tket.mapping.AASLabellingMethod¶
Defines a Labeling Method for aas for labelling all unplaced qubits in a circuit
- __init__(self: pytket._tket.mapping.AASLabellingMethod) None ¶
AASLabellingMethod constructor.
- class pytket._tket.mapping.AASRouteRoutingMethod¶
Defines a RoutingMethod object for mapping circuits that uses the architecture aware synthesis method implemented in tket.
- __init__(self: pytket._tket.mapping.AASRouteRoutingMethod, aaslookahead: int) None ¶
AASRouteRoutingMethod constructor.
- Parameters:
aaslookahead – recursive interation depth of the architecture aware synthesis.method.
- class pytket._tket.mapping.BoxDecompositionRoutingMethod¶
Defines a RoutingMethod object for decomposing boxes.
- __init__(self: pytket._tket.mapping.BoxDecompositionRoutingMethod) None ¶
BoxDecompositionRoutingMethod constructor.
- class pytket._tket.mapping.LexiLabellingMethod¶
Defines a RoutingMethod for labelling Qubits that uses the Lexicographical Comparison approach outlined in arXiv:1902.08091.
- __init__(self: pytket._tket.mapping.LexiLabellingMethod) None ¶
LexiLabellingMethod constructor.
- class pytket._tket.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.
- __init__(self: pytket._tket.mapping.LexiRouteRoutingMethod, lookahead: int = 10) None ¶
LexiRoute constructor.
- Parameters:
lookahead – Maximum depth of lookahead employed when picking SWAP for purpose of logical to physical mapping.
- class pytket._tket.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: pytket._tket.mapping.MappingManager, architecture: pytket._tket.architecture.Architecture) None ¶
MappingManager constructor.
- Parameters:
architecture – pytket Architecture object.
- route_circuit(self: pytket._tket.mapping.MappingManager, circuit: pytket._tket.circuit.Circuit, routing_methods: Sequence[pytket._tket.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._tket.mapping.MultiGateReorderRoutingMethod¶
Defines a RoutingMethod object for commuting physically permitted multi-qubit gates to the front of the subcircuit.
- __init__(self: pytket._tket.mapping.MultiGateReorderRoutingMethod, max_depth: int = 10, max_size: int = 10) None ¶
MultiGateReorderRoutingMethod constructor.
- Parameters:
max_depth – Maximum number of layers of gates checked for simultaneous commutation.
max_size – Maximum number of gates checked for simultaneous commutation.
- class pytket._tket.mapping.RoutingMethod¶
Parent class for RoutingMethod, for inheritance purposes only, not for usage.
- __init__(self: pytket._tket.mapping.RoutingMethod) None ¶
- class pytket._tket.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: pytket._tket.mapping.RoutingMethodCircuit, route_subcircuit: Callable[[pytket._tket.circuit.Circuit, pytket._tket.architecture.Architecture], tuple[bool, pytket._tket.circuit.Circuit, dict[pytket._tket.unit_id.UnitID, pytket._tket.unit_id.UnitID], dict[pytket._tket.unit_id.UnitID, pytket._tket.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.