mqt.qmap.plugins.qiskit.sc.compile

Compile a circuit.

Functions

compile(→ tuple[qiskit.circuit.QuantumCircuit, ...)

Interface to the MQT QMAP tool for mapping quantum circuits.

Module Contents

compile(circ: mqt.qmap.types.CircuitInputType, arch: str | mqt.qmap.sc.Arch | Architecture | Backend | None, calibration: str | qiskit.providers.models.BackendProperties | Target | None = None, method: str | mqt.qmap.sc.Method = 'heuristic', heuristic: str | mqt.qmap.sc.Heuristic = 'gate_count_max_distance', initial_layout: str | mqt.qmap.sc.InitialLayout = 'dynamic', iterative_bidirectional_routing_passes: int | None = None, layering: str | mqt.qmap.sc.Layering = 'individual_gates', automatic_layer_splits_node_limit: int | None = 5000, early_termination: str | mqt.qmap.sc.EarlyTermination = 'none', early_termination_limit: int = 0, lookahead_heuristic: str | mqt.qmap.sc.LookaheadHeuristic | None = 'gate_count_max_distance', lookaheads: int = 15, lookahead_factor: float = 0.5, encoding: str | mqt.qmap.sc.Encoding = 'commander', commander_grouping: str | mqt.qmap.sc.CommanderGrouping = 'fixed3', swap_reduction: str | mqt.qmap.sc.SwapReduction = 'coupling_limit', swap_limit: int = 0, include_WCNF: bool = False, use_subsets: bool = True, subgraph: set[int] | None = None, pre_mapping_optimizations: bool = True, post_mapping_optimizations: bool = True, add_measurements_to_mapped_circuit: bool = True, add_barriers_between_layers: bool = False, verbose: bool = False, debug: bool = False, visualizer: mqt.qmap.visualization.SearchVisualizer | None = None) tuple[QuantumCircuit, MappingResults][source]

Interface to the MQT QMAP tool for mapping quantum circuits.

Parameters:
  • circ – The circuit to map.

  • arch – The architecture to map to.

  • calibration – The calibration to use.

  • method – The mapping method to use. Either “heuristic” or “exact”. Defaults to “heuristic”.

  • heuristic – The heuristic function to use for the routing search. Defaults to “gate_count_max_distance”.

  • initial_layout – The initial layout to use. Defaults to “dynamic”.

  • iterative_bidirectional_routing_passes – Number of iterative bidirectional routing passes to perform or None to disable. Defaults to None.

  • layering – The layering strategy to use. Defaults to “individual_gates”.

  • automatic_layer_splits_node_limit – The number of expanded nodes after which to split a layer or None to disable automatic layer splitting. Defaults to 5000.

  • early_termination – The early termination strategy to use, i.e. terminating the search after a goal node has been found, but before it is guarantueed to be optimal. Defaults to “none”.

  • early_termination_limit – The number of nodes (counted according to the early termination strategy) after which to terminate the search early. Defaults to 0.

  • lookahead_heuristic – The heuristic function to use as a lookahead penalty during search or None to disable lookahead. Defaults to “gate_count_max_distance”.

  • lookaheads – The number of lookaheads to be used or None if no lookahead should be used. Defaults to 15.

  • lookahead_factor – The rate at which the contribution of future layers to the lookahead decreases. Defaults to 0.5.

  • encoding – The encoding to use for the AMO and exactly one constraints. Defaults to “naive”.

  • commander_grouping – The grouping strategy to use for the commander and bimander encoding. Defaults to “halves”.

  • swap_reduction – The swap reduction strategy to use. Defaults to “coupling_limit”.

  • swap_limit – Set a custom limit for max swaps per layer, for the increasing reduction strategy it sets the max swaps per layer. Defaults to 0.

  • include_WCNF – Include WCNF file in the results. Defaults to False.

  • use_subsets – Use qubit subsets, or consider all available physical qubits at once. Defaults to True.

  • subgraph – List of qubits to consider for mapping (in exact mapper), if None all qubits are considered. Defaults to None.

  • pre_mapping_optimizations – Run pre-mapping optimizations. Defaults to True.

  • post_mapping_optimizations – Run post-mapping optimizations. Defaults to True.

  • add_measurements_to_mapped_circuit – Whether to add measurements at the end of the mapped circuit. Defaults to True.

  • add_barriers_between_layers – Whether to add barriers between layers to make them apparent after mapping. Defaults to False.

  • verbose – Print more detailed information during the mapping process. Defaults to False.

  • debug – Gather additional information during the mapping process (e.g. number of generated nodes, branching factors, …). Defaults to False.

  • visualizer – A SearchVisualizer object to log the search process to. Defaults to None.

Returns:

The mapped circuit and the mapping results.