Quantum Circuit Synthesis#

The main functionality for synthesizing quantum circuits is provided by the synthesize_clifford() and the optimize_clifford() methods.

synthesize_clifford(target_tableau, initial_tableau=None, include_destabilizers=False, **kwargs)[source]#

Synthesize a Clifford circuit from a given tableau starting from an (optional) initial tableau.

Parameters:
  • target_tableau (str | Clifford | PauliList | Tableau) – The target tableau to synthesize. If a string is given, it is interpreted as a semicolon separated binary matrix or a list of Pauli strings. The Pauli strings follow the same format as in Stim. If a Clifford or a PauliList is given, it is converted to a Tableau. If a Tableau is given, it is used directly.

  • initial_tableau (str | Clifford | PauliList | Tableau | None) – The initial tableau to start from. If a string is given, it is interpreted as a semicolon separated binary matrix or a list of Pauli strings. If a Clifford or a PauliList is given, it is converted to a Tableau. If a Tableau is given, it is used directly. If no initial tableau is given, the synthesis starts from the identity tableau.

  • include_destabilizers (bool) – Flag to set whether destabilizers should be considered in the synthesis

  • **kwargs (Any) – Additional keyword arguments to configure the synthesis. See SynthesisConfiguration for a list of available options.

Returns:

tuple[QuantumCircuit, SynthesisResults] – A tuple containing the synthesized circuit and the synthesis results.

optimize_clifford(circuit, initial_tableau=None, include_destabilizers=False, **kwargs)[source]#

Optimize a Clifford circuit starting from an (optional) initial tableau.

Parameters:
  • circuit (str | QuantumCircuit | QuantumComputation) – The circuit to optimize. If a string is given, it is interpreted as a QASM string or a filename. If a QuantumCircuit is given, it is converted to a QuantumComputation. If a QuantumComputation is given, it is used as is.

  • initial_tableau (str | Clifford | PauliList | Tableau | None) – The initial tableau to start from. If a string is given, it is interpreted as a semicolon separated binary matrix or a list of Pauli strings. If a Clifford is given or a PauliList is given, it is converted to a Tableau. If a Tableau is given, it is used directly. If no initial tableau is given, the synthesis starts from the identity tableau.

  • include_destabilizers (bool) – Flag to set whether destabilizers should be considered in the synthesis

  • **kwargs (Any) – Additional keyword arguments to configure the synthesis. See SynthesisConfiguration for a list of available options.

Returns:

tuple[QuantumCircuit, SynthesisResults] – A tuple containing the optimized circuit and the synthesis results.

Synthesis Configuration#

The following classes provide a more explicit way of initializing the respective parameters of the synthesize_clifford and the optimize_clifford method. Instead of setting parameters via str members, they can be set with Enumeration.member where Enumeration is the enumeration class.

class TargetMetric#

Members:

gates : Optimize gate count.

two_qubit_gates : Optimize two-qubit gate count.

depth : Optimize circuit depth.

class Verbosity#

Members:

none : No output.

fatal : Only show fatal errors.

error : Show errors.

warning : Show warnings.

info : Show general information.

debug : Show additional debug information.

verbose : Show all information.

The SynthesisConfiguration class is used to provide several parameters to the synthesize_clifford and the optimize_clifford method. The following table lists the parameters and their default values.

class SynthesisConfiguration#

Configuration options for the MQT QMAP Clifford synthesis tool.

property dump_intermediate_results#

Dump intermediate results of the synthesis process. Defaults to false.

property gate_limit_factor#

Factor by which the gate limit is increased when trying to find a better solution for the two-qubit gate optimization. Defaults to 1.1.

property heuristic#

Use heuristic to synthesize the circuit. This method synthesizes shallow intermediate circuits and combines them. Defaults to false.

property initial_timestep_limit#

Initial timestep limit for the Clifford synthesis. Defaults to 0, which implies that the initial timestep limit is determined automatically.

property intermediate_results_path#

Path to the directory where intermediate results should be dumped. Defaults to ./. The path needs to include a path separator at the end.

json(self: mqt.qmap.pyqmap.SynthesisConfiguration) json#

Returns a JSON-style dictionary of all the information present in the Configuration

Use liner search instead of binary search scheme for finding the optimum. Defaults to false.

property minimal_timesteps#

Minimal timestep considered for the Clifford synthesis. This option limits the lower bound of the interval in which the binary search method looks for solutions. Set this if you know a lower bound for the circuit depth. Defaults to 0, which implies that no lower bound for depth is known.

property minimize_gates_after_depth_optimization#

Depth optimization might produce a circuit with more gates than necessary. This option enables an additional run of the synthesizer to minimize the overall number of gates. Defaults to false.

property minimize_gates_after_two_qubit_gate_optimization#

Two-qubit gate optimization might produce a circuit with more gates than necessary. This option enables an additional run of the synthesizer to minimize the overall number of gates. Defaults to false.

property n_threads_heuristic#

Maximum number of threads used for the heuristic optimizer. Defaults to the number of available threads on the system.

property solver_parameters#

Parameters to be passed to Z3 as dict[str, bool | int | float | str]

property split_size#

Size of subcircuits used in heuristic. Defaults to 5.

property target_metric#

Target metric for the Clifford synthesis. Defaults to gates.

property try_higher_gate_limit_for_two_qubit_gate_optimization#

When optimizing two-qubit gates, the synthesizer might fail to find an optimal solution for a certain timestep limit, but there might be a better solution for some higher timestep limit. This option enables an additional run of the synthesizer with a higher gate limit. Defaults to false.

property use_maxsat#

Use MaxSAT to solve the synthesis problem or to really on the binary search scheme for finding the optimum. Defaults to false.

property use_symmetry_breaking#

Use symmetry breaking clauses to speed up the synthesis process. Defaults to true.

property verbosity#

Verbosity level for the synthesis process. Defaults to ‘warning’.