Skip to main content
IBM Quantum Platform

qiskit.transpiler.generate_preset_clifford_t_pass_manager

qiskit.transpiler.generate_preset_clifford_t_pass_manager(optimization_level=2, target=None, basis_gates=None, coupling_map=None, initial_layout=None, approximation_degree=1.0, seed_transpiler=None, unitary_synthesis_method='default', unitary_synthesis_plugin_config=None, hls_config=None, dt=None, qubits_initially_zero=True, rz_synthesis_config=None)

GitHub

Generate a preset Clifford+T StagedPassManager.

This function provides a convenient way to construct a preset pass manager for Clifford+T compilation. We recommend using this function instead of transpile() or generate_preset_pass_manager() with a Clifford+T basis, as it exposes arguments specifically tailored for Clifford+T compilations.

The target constraints for the pass manager construction can be specified through a Target instance, or via loose constraints (basis_gates, coupling_map, or dt).

If basis gates are not specified (neither via target nor via basis_gates), then basis gates default to all of the Clifford+T gates in Qiskit. Note, however, that if basis gates are specified but do not represent a Clifford+T basis, then an error will be raised.

Examples

Generate and use a simple Clifford+T pass manager:

from qiskit.circuit import QuantumCircuit
from qiskit.transpiler import generate_preset_clifford_t_pass_manager

qc = QuantumCircuit(1)
qc.rz(2.3579, 0)

pm = generate_preset_clifford_t_pass_manager()
qct = pm.run(qc)

Various options are configurable; see the arguments documentation for more detail:

rz_synthesis_config = {
    "rz_synthesis_error": 1e-4,
    "rz_cache_error": 1e-5,
}

basis_gates = ["cx", "s", "sdg", "h", "t", "tdg"]
pm = generate_preset_clifford_t_pass_manager(
    rz_synthesis_config=rz_synthesis_config,
    basis_gates=basis_gates,
    optimization_level=3,
)

Parameters

  • optimization_level (int) – The optimization level to generate a StagedPassManager for. By default optimization level 2 is used if this is not specified. This can be 0, 1, 2, or 3. Higher levels generate potentially more optimized circuits, at the expense of potentially longer transpilation time.

  • target (Target | None) – The Target representing a compilation target. The following attributes will be inferred from this argument if they are not set: coupling_map and basis_gates.

  • basis_gates (list[str] | None) – List of basis gate names to unroll to (e.g: ['cx', 's', 'sx', 't', 'tdg']). If both target and basis_gates are None, basis_gates will be set to all of the standard Clifford gates together with 't' and 'tdg'.

  • coupling_map (CouplingMap |list | None) –

    Directed graph represented a coupling map. Multiple formats are supported:

    1. CouplingMap instance
    2. List, must be given as an adjacency matrix, where each entry specifies all directed two-qubit interactions supported by backend, e.g: [[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]
  • dt (float | None) – Target sample time (resolution) in seconds. If None (default) and a target is provided, target.dt is used.

  • initial_layout (Layout |list[int]) – Initial position of virtual qubits on physical qubits.

  • approximation_degree (float | None) – Heuristic dial used for circuit approximation, where 1.0 means no approximation (up to numerical tolerance) and 0.0 means the maximum approximation. If target is available, a value of None indicates that approximation is allowed up to the reported error rate for an operation in the target.

  • seed_transpiler (int | None) – Sets random seed for the stochastic parts of the transpiler. If it is not specified here it can also be specified via an environment variable: QISKIT_TRANSPILER_SEED or in a user configuration file. The priority order is: this argument, then the environment variable, and finally the user configuration option. So setting this argument will take precedence over the other methods of setting a seed.

  • unitary_synthesis_method (str) – The name of the unitary synthesis method to use. By default 'default' is used. You can see a list of installed plugins with unitary_synthesis_plugin_names().

  • unitary_synthesis_plugin_config (dict | None) – An optional configuration dictionary that will be passed directly to the unitary synthesis plugin. By default this setting will have no effect as the default unitary synthesis method does not take custom configuration. This should only be necessary when a unitary synthesis plugin is specified with the unitary_synthesis_method argument. As this is custom for each unitary synthesis plugin refer to the plugin documentation for how to use this option.

  • hls_config (HLSConfig | None) – An optional configuration class HLSConfig that will be passed directly to HighLevelSynthesis transformation pass. This configuration class allows to specify for various high-level objects the lists of synthesis algorithms and their parameters.

  • qubits_initially_zero (bool) – Indicates whether the input circuit is zero-initialized.

  • rz_synthesis_config (dict | None) – An optional configuration class to use for SynthesizeRZRotations pass. Specifies how to synthesize RZ rotations in the circuit.

Returns

The preset pass manager for the given options.

Return type

StagedPassManager

Raises

  • TranspilerError – if a basis other than Clifford+T is specified.
  • ValueError – if an invalid value for optimization_level is passed in.
Was this page helpful?
Report a bug, typo, or request content on GitHub.