pytket.mapping

class pytket.mapping.AASLabellingMethod

Defines a Labeling Method for aas for labelling all unplaced qubits in a circuit

__init__(self: pytket.mapping.AASLabellingMethod) None

AASLabellingMethod constructor.

class pytket.mapping.AASRouteRoutingMethod

Defines a RoutingMethod object for mapping circuits that uses the architecture aware synthesis method implemented in tket.

__init__(self: pytket.mapping.AASRouteRoutingMethod, aaslookahead: int) None

AASRouteRoutingMethod constructor.

Parameters

aaslookahead – recursive interation depth of the architecture aware synthesis.method.

class pytket.mapping.BoxDecompositionRoutingMethod

Defines a RoutingMethod object for decomposing boxes.

__init__(self: pytket.mapping.BoxDecompositionRoutingMethod) None

BoxDecompositionRoutingMethod constructor.

class pytket.mapping.LexiLabellingMethod

Defines a RoutingMethod for labelling Qubits that uses the Lexicographical Comparison approach outlined in arXiv:1902.08091.

__init__(self: pytket.mapping.LexiLabellingMethod) None

LexiLabellingMethod constructor.

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.

__init__(self: pytket.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.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.mapping.MappingManager, architecture: pytket.architecture.Architecture) None

MappingManager constructor.

Parameters

architecture – pytket Architecture object.

route_circuit(self: pytket.mapping.MappingManager, circuit: pytket.circuit.Circuit, routing_methods: List[pytket.mapping.RoutingMethod], label_isolated_qubits: bool = True) 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.

  • label_isolated_qubits – will not label qubits without gates or only single qubit gates on them if this is set false

class pytket.mapping.MultiGateReorderRoutingMethod

Defines a RoutingMethod object for commuting physically permitted multi-qubit gates to the front of the subcircuit.

__init__(self: pytket.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.mapping.RoutingMethod

Parent class for RoutingMethod, for inheritance purposes only, not for usage.

__init__(self: pytket.mapping.RoutingMethod) None
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: pytket.mapping.RoutingMethodCircuit, route_subcircuit: Callable[[pytket.circuit.Circuit, pytket.architecture.Architecture], Tuple[bool, pytket.circuit.Circuit, Dict[pytket.circuit.UnitID, pytket.circuit.UnitID], Dict[pytket.circuit.UnitID, pytket.circuit.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.