From 81b96a50e6f00ffcd9b64f23132fafffd6c2c2fe Mon Sep 17 00:00:00 2001 From: Alexander Ivrii Date: Mon, 13 Apr 2026 11:28:42 +0300 Subject: [PATCH] Fixing python passes and docstrings related to approximation_degree --- qiskit/compiler/transpiler.py | 2 +- .../optimization/commutative_optimization.py | 5 +- .../passes/optimization/consolidate_blocks.py | 27 +++--- .../optimization/substitute_pi4_rotations.py | 6 +- .../passes/synthesis/unitary_synthesis.py | 18 ++-- qiskit/transpiler/passmanager_config.py | 82 ++++++++++-------- .../transpiler/preset_passmanagers/common.py | 77 +++++++++-------- .../generate_preset_pass_manager.py | 85 ++++++++++--------- 8 files changed, 168 insertions(+), 134 deletions(-) diff --git a/qiskit/compiler/transpiler.py b/qiskit/compiler/transpiler.py index 8b154e6cbf1d..5c029cb7b812 100644 --- a/qiskit/compiler/transpiler.py +++ b/qiskit/compiler/transpiler.py @@ -160,7 +160,7 @@ def transpile( argument. dt: Backend sample time (resolution) in seconds. If ``None`` (default), ``backend.dt`` is used. - approximation_degree (float): heuristic dial used for circuit approximation + approximation_degree: heuristic dial used for circuit approximation (1.0=no approximation, 0.0=maximal approximation) seed_transpiler: Sets random seed for the stochastic parts of the transpiler optimization_level: How much optimization to perform on the circuits. diff --git a/qiskit/transpiler/passes/optimization/commutative_optimization.py b/qiskit/transpiler/passes/optimization/commutative_optimization.py index 7f82dbb2fa01..f000504ee9db 100644 --- a/qiskit/transpiler/passes/optimization/commutative_optimization.py +++ b/qiskit/transpiler/passes/optimization/commutative_optimization.py @@ -12,6 +12,7 @@ """Commutative Optimization transpiler pass.""" +from __future__ import annotations from qiskit.transpiler.basepasses import TransformationPass from qiskit.circuit.commutation_library import SessionCommutationChecker as scc @@ -38,7 +39,7 @@ class CommutativeOptimization(TransformationPass): :class:`.CommutativeInverseCancellation`. """ - def __init__(self, approximation_degree: float = 1.0, matrix_max_num_qubits: int = 0): + def __init__(self, approximation_degree: float | None = 1.0, matrix_max_num_qubits: int = 0): """ Args: approximation_degree: the threshold used in the average gate fidelity @@ -49,7 +50,7 @@ def __init__(self, approximation_degree: float = 1.0, matrix_max_num_qubits: int """ super().__init__() self.commutation_checker = scc.cc - self.approximation_degree = approximation_degree + self.approximation_degree = approximation_degree or 1.0 self.matrix_max_num_qubits = matrix_max_num_qubits @trivial_recurse diff --git a/qiskit/transpiler/passes/optimization/consolidate_blocks.py b/qiskit/transpiler/passes/optimization/consolidate_blocks.py index 3d95808312d3..abecdf3ffbd0 100644 --- a/qiskit/transpiler/passes/optimization/consolidate_blocks.py +++ b/qiskit/transpiler/passes/optimization/consolidate_blocks.py @@ -13,6 +13,8 @@ """Replace each block of consecutive gates by a single Unitary node.""" from __future__ import annotations +import typing + from qiskit.synthesis.two_qubit import TwoQubitBasisDecomposer, TwoQubitControlledUDecomposer from qiskit.circuit.library.standard_gates import ( CXGate, @@ -36,6 +38,11 @@ from .collect_1q_runs import Collect1qRuns from .collect_2q_blocks import Collect2qBlocks + +if typing.TYPE_CHECKING: + from qiskit.transpiler.target import Target + from qiskit.circuit.gate import Gate + KAK_GATE_NAMES = { "cx": CXGate(), "cz": CZGate(), @@ -78,11 +85,11 @@ class ConsolidateBlocks(TransformationPass): def __init__( self, - kak_basis_gate=None, - force_consolidate=False, - basis_gates=None, - approximation_degree=1.0, - target=None, + kak_basis_gate: Gate | None = None, + force_consolidate: bool = False, + basis_gates: list[str] | None = None, + approximation_degree: float | None = 1.0, + target: Target | None = None, ): """ConsolidateBlocks initializer. @@ -91,11 +98,11 @@ def __init__( Otherwise, the basis gate will be :class:`.CXGate`. Args: - kak_basis_gate (Gate): Basis gate for KAK decomposition. - force_consolidate (bool): Force block consolidation. - basis_gates (List(str)): Basis gates from which to choose a KAK gate. - approximation_degree (float): a float between :math:`[0.0, 1.0]`. Lower approximates more. - target (Target): The target object for the compilation target backend. + kak_basis_gate: Basis gate for KAK decomposition. + force_consolidate: Force block consolidation. + basis_gates: Basis gates from which to choose a KAK gate. + approximation_degree: a float between :math:`[0.0, 1.0]`. Lower approximates more. + target: The target object for the compilation target backend. """ super().__init__() self.basis_gates = None diff --git a/qiskit/transpiler/passes/optimization/substitute_pi4_rotations.py b/qiskit/transpiler/passes/optimization/substitute_pi4_rotations.py index a3d10857eeb8..99241ef34ec4 100644 --- a/qiskit/transpiler/passes/optimization/substitute_pi4_rotations.py +++ b/qiskit/transpiler/passes/optimization/substitute_pi4_rotations.py @@ -12,6 +12,8 @@ """Convert rotation gates into {Clifford,T,Tdg} when their angles are integer multiples of pi/4""" +from __future__ import annotations + from qiskit.transpiler.basepasses import TransformationPass from qiskit.dagcircuit import DAGCircuit from qiskit.transpiler.passes.utils import control_flow @@ -67,14 +69,14 @@ class SubstitutePi4Rotations(TransformationPass): assert Operator(qc) == Operator(qct) """ - def __init__(self, approximation_degree: float = 1.0): + def __init__(self, approximation_degree: float | None = 1.0): """ Args: approximation_degree: Used in the tolerance computations. This gives the threshold for the average gate fidelity. """ super().__init__() - self.approximation_degree = approximation_degree + self.approximation_degree = approximation_degree or 1.0 @control_flow.trivial_recurse def run(self, dag: DAGCircuit) -> DAGCircuit: diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index 14b3ae7ae467..9b965d6c3944 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -58,14 +58,14 @@ def __init__( self, basis_gates: list[str] | None = None, approximation_degree: float | None = 1.0, - coupling_map: CouplingMap = None, + coupling_map: CouplingMap | None = None, pulse_optimize: bool | None = None, natural_direction: bool | None = None, synth_gates: list[str] | None = None, method: str = "default", min_qubits: int = 0, plugin_config: dict | None = None, - target: Target = None, + target: Target | None = None, fallback_on_default: bool = False, ): """Synthesize unitaries over some basis gates. @@ -76,24 +76,24 @@ def __init__( ``approximation_degree``. Args: - basis_gates (list[str]): List of gate names to target. If this is + basis_gates: List of gate names to target. If this is not specified the ``target`` argument must be used. If both this and the ``target`` are specified the value of ``target`` will be used and this will be ignored. - approximation_degree (float): heuristic dial used for circuit approximation + approximation_degree: heuristic dial used for circuit approximation (1.0=no approximation, 0.0=maximal approximation). Approximation can make the synthesized circuit cheaper at the cost of straying from the original unitary. If None, approximation is done based on gate fidelities. - coupling_map (CouplingMap): the coupling map of the target + coupling_map: the coupling map of the target in case synthesis is done on a physical circuit. The directionality of the coupling_map will be taken into account if ``pulse_optimize`` is ``True``/``None`` and ``natural_direction`` is ``True``/``None``. - pulse_optimize (bool): Whether to optimize pulses during + pulse_optimize: Whether to optimize pulses during synthesis. A value of ``None`` will attempt it but fall back if it does not succeed. A value of ``True`` will raise an error if pulse-optimized synthesis does not succeed. - natural_direction (bool): Whether to apply synthesis considering + natural_direction: Whether to apply synthesis considering directionality of 2-qubit gates. Only applies when ``pulse_optimize`` is ``True`` or ``None``. The natural direction is determined by first checking to see whether the @@ -105,11 +105,11 @@ def __init__( determined, raises :class:`.TranspilerError`. If set to None, no exception will be raised if a natural direction can not be determined. - synth_gates (list[str]): List of gates to synthesize. If None and + synth_gates: List of gates to synthesize. If None and ``pulse_optimize`` is False or None, default to ``['unitary']``. If ``None`` and ``pulse_optimize == True``, default to ``['unitary', 'swap']`` - method (str): The unitary synthesis method plugin to use. + method: The unitary synthesis method plugin to use. min_qubits: The minimum number of qubits in the unitary to synthesize. If this is set and the unitary is less than the specified number of qubits it will not be synthesized. diff --git a/qiskit/transpiler/passmanager_config.py b/qiskit/transpiler/passmanager_config.py index dc0dfc4813a7..3d2654f0487f 100644 --- a/qiskit/transpiler/passmanager_config.py +++ b/qiskit/transpiler/passmanager_config.py @@ -12,72 +12,82 @@ """Pass Manager Configuration class.""" +from __future__ import annotations + +import typing + +if typing.TYPE_CHECKING: + from qiskit.transpiler.passes.synthesis.high_level_synthesis import HLSConfig + from qiskit.transpiler import Target, CouplingMap, Layout + from qiskit.transpiler.timing_constraints import TimingConstraints + from .instruction_durations import InstructionDurations + class PassManagerConfig: """Pass Manager Configuration.""" def __init__( self, - initial_layout=None, - basis_gates=None, - coupling_map=None, - layout_method=None, - routing_method=None, - translation_method=None, - scheduling_method=None, - instruction_durations=None, - approximation_degree=None, - seed_transpiler=None, - timing_constraints=None, - unitary_synthesis_method="default", - unitary_synthesis_plugin_config=None, - target=None, - hls_config=None, - init_method=None, - optimization_method=None, - qubits_initially_zero=True, + initial_layout: Layout | None = None, + basis_gates: list[str] | None = None, + coupling_map: CouplingMap | None = None, + layout_method: str | None = None, + routing_method: str | None = None, + translation_method: str | None = None, + scheduling_method: str | None = None, + instruction_durations: InstructionDurations | None = None, + approximation_degree: float | None = None, + seed_transpiler: int | None = None, + timing_constraints: TimingConstraints | None = None, + unitary_synthesis_method: str = "default", + unitary_synthesis_plugin_config: dict | None = None, + target: Target | None = None, + hls_config: HLSConfig | None = None, + init_method: str | None = None, + optimization_method: str | None = None, + qubits_initially_zero: bool = True, ): """Initialize a PassManagerConfig object Args: - initial_layout (Layout): Initial position of virtual qubits on + initial_layout: Initial position of virtual qubits on physical qubits. - basis_gates (list): List of basis gate names to unroll to. - coupling_map (CouplingMap): Directed graph representing a coupling + basis_gates: List of basis gate names to unroll to. + coupling_map: Directed graph representing a coupling map. - layout_method (str): the pass to use for choosing initial qubit + layout_method: the pass to use for choosing initial qubit placement. This will be the plugin name if an external layout stage plugin is being used. - routing_method (str): the pass to use for routing qubits on the + routing_method: the pass to use for routing qubits on the architecture. This will be a plugin name if an external routing stage plugin is being used. - translation_method (str): the pass to use for translating gates to + translation_method: the pass to use for translating gates to basis_gates. This will be a plugin name if an external translation stage plugin is being used. - scheduling_method (str): the pass to use for scheduling instructions. This will + scheduling_method: the pass to use for scheduling instructions. This will be a plugin name if an external scheduling stage plugin is being used. - instruction_durations (InstructionDurations): Dictionary of duration + instruction_durations: Dictionary of duration (in dt) for each instruction. - approximation_degree (float): heuristic dial used for circuit approximation + approximation_degree: heuristic dial used for circuit approximation (1.0=no approximation, 0.0=maximal approximation) - seed_transpiler (int): Sets random seed for the stochastic parts of + seed_transpiler: Sets random seed for the stochastic parts of the transpiler. - timing_constraints (TimingConstraints): Hardware time alignment restrictions. - unitary_synthesis_method (str): The string method to use for the + timing_constraints: Hardware time alignment restrictions. + unitary_synthesis_method: The string method to use for the :class:`~qiskit.transpiler.passes.UnitarySynthesis` pass. Will search installed plugins for a valid method. You can see a list of installed plugins with :func:`.unitary_synthesis_plugin_names`. - unitary_synthesis_plugin_config (dict): The configuration dictionary that will + unitary_synthesis_plugin_config: The configuration dictionary that will be passed to the specified unitary synthesis plugin. Refer to the plugin documentation for how to use this. - target (Target): The backend target - hls_config (HLSConfig): An optional configuration class to use for + target: The backend target + hls_config: An optional configuration class to use for :class:`~qiskit.transpiler.passes.HighLevelSynthesis` pass. Specifies how to synthesize various high-level objects. - init_method (str): The plugin name for the init stage plugin to use - optimization_method (str): The plugin name for the optimization stage plugin + init_method: The plugin name for the init stage plugin to use + optimization_method: The plugin name for the optimization stage plugin to use. - qubits_initially_zero (bool): Indicates whether the input circuit is + qubits_initially_zero: Indicates whether the input circuit is zero-initialized. """ self.initial_layout = initial_layout diff --git a/qiskit/transpiler/preset_passmanagers/common.py b/qiskit/transpiler/preset_passmanagers/common.py index ae3ff863e07c..afd9fa43342e 100644 --- a/qiskit/transpiler/preset_passmanagers/common.py +++ b/qiskit/transpiler/preset_passmanagers/common.py @@ -13,8 +13,10 @@ """Common preset passmanager generators.""" -import collections +from __future__ import annotations +import collections +import typing from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES @@ -56,6 +58,11 @@ from qiskit.quantum_info.operators.symplectic.clifford_circuits import _CLIFFORD_GATE_NAMES +if typing.TYPE_CHECKING: + from qiskit.transpiler.passes.synthesis.high_level_synthesis import HLSConfig + from qiskit.transpiler.target import Target + from qiskit.transpiler.coupling import CouplingMap + _ControlFlowState = collections.namedtuple("_ControlFlowState", ("working", "not_working")) # Any method neither known good nor known bad (i.e. not a Terra-internal pass) is passed through @@ -185,34 +192,34 @@ def if_has_control_flow_else(if_present, if_absent): def generate_unroll_3q( - target, - basis_gates=None, - approximation_degree=None, - unitary_synthesis_method="default", - unitary_synthesis_plugin_config=None, - hls_config=None, - qubits_initially_zero=True, - optimization_metric=OptimizationMetric.COUNT_2Q, + target: Target | None, + basis_gates: list[str] | None = None, + approximation_degree: float | None = None, + unitary_synthesis_method: str = "default", + unitary_synthesis_plugin_config: dict | None = None, + hls_config: HLSConfig | None = None, + qubits_initially_zero: bool = True, + optimization_metric: OptimizationMetric = OptimizationMetric.COUNT_2Q, ): """Generate an unroll >3q :class:`~qiskit.transpiler.PassManager` Args: - target (Target): the :class:`~.Target` object representing the backend - basis_gates (list): A list of str gate names that represent the basis + target: the :class:`~.Target` object representing the backend + basis_gates: A list of str gate names that represent the basis gates on the backend target - approximation_degree (Optional[float]): The heuristic approximation degree to + approximation_degree: The heuristic approximation degree to use. Can be between 0 and 1. unitary_synthesis_method (str): The unitary synthesis method to use. You can see a list of installed plugins with :func:`.unitary_synthesis_plugin_names`. - unitary_synthesis_plugin_config (dict): The optional dictionary plugin + unitary_synthesis_plugin_config: The optional dictionary plugin configuration, this is plugin specific refer to the specified plugin's documentation for how to use. - hls_config (HLSConfig): An optional configuration class to use for + hls_config: An optional configuration class to use for :class:`~qiskit.transpiler.passes.HighLevelSynthesis` pass. Specifies how to synthesize various high-level objects. - qubits_initially_zero (bool): Indicates whether the input circuit is + qubits_initially_zero: Indicates whether the input circuit is zero-initialized. - optimization_metric (OptimizationMetric): the :class:`~.OptimizationMetric` object + optimization_metric: the :class:`~.OptimizationMetric` object that defines the metric used when optimizing the unrolling. Returns: @@ -423,39 +430,39 @@ def _direction_condition(property_set): def generate_translation_passmanager( - target, - basis_gates=None, - method="translator", - approximation_degree=None, - coupling_map=None, - unitary_synthesis_method="default", - unitary_synthesis_plugin_config=None, - hls_config=None, - qubits_initially_zero=True, + target: Target | None, + basis_gates: list[str] | None = None, + method: str = "translator", + approximation_degree: float | None = None, + coupling_map: CouplingMap | None = None, + unitary_synthesis_method: str = "default", + unitary_synthesis_plugin_config: dict | None = None, + hls_config: HLSConfig | None = None, + qubits_initially_zero: bool = True, ): """Generate a basis translation :class:`~qiskit.transpiler.PassManager` Args: - target (Target): the :class:`~.Target` object representing the backend - basis_gates (list): A list of str gate names that represent the basis + target: the :class:`~.Target` object representing the backend + basis_gates: A list of str gate names that represent the basis gates on the backend target - method (str): The basis translation method to use - approximation_degree (Optional[float]): The heuristic approximation degree to + method: The basis translation method to use + approximation_degree: The heuristic approximation degree to use. Can be between 0 and 1. - coupling_map (CouplingMap): the coupling map of the backend + coupling_map: the coupling map of the backend in case synthesis is done on a physical circuit. The directionality of the coupling_map will be taken into account if pulse_optimize is True/None and natural_direction is True/None. - unitary_synthesis_plugin_config (dict): The optional dictionary plugin + unitary_synthesis_method: The unitary synthesis method to use. You can + see a list of installed plugins with :func:`.unitary_synthesis_plugin_names`. + unitary_synthesis_plugin_config: The optional dictionary plugin configuration, this is plugin specific refer to the specified plugin's documentation for how to use. - unitary_synthesis_method (str): The unitary synthesis method to use. You can - see a list of installed plugins with :func:`.unitary_synthesis_plugin_names`. - hls_config (HLSConfig): An optional configuration class to use for + hls_config: An optional configuration class to use for :class:`~qiskit.transpiler.passes.HighLevelSynthesis` pass. Specifies how to synthesize various high-level objects. - qubits_initially_zero (bool): Indicates whether the input circuit is + qubits_initially_zero: Indicates whether the input circuit is zero-initialized. Returns: diff --git a/qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py b/qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py index e0c4fea9c26b..cbb5dcb44457 100644 --- a/qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +++ b/qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py @@ -13,8 +13,12 @@ """ Preset pass manager generation function """ +from __future__ import annotations + import copy import warnings +import typing + from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES, get_control_flow_name_mapping from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping @@ -36,30 +40,33 @@ from .level2 import level_2_pass_manager from .level3 import level_3_pass_manager +if typing.TYPE_CHECKING: + from qiskit.transpiler.passes.synthesis.high_level_synthesis import HLSConfig + OVER_3Q_GATES = ["ccx", "ccz", "cswap", "rccx", "c3x", "c3sx", "rc3x"] def generate_preset_pass_manager( - optimization_level=2, - backend=None, - target=None, - basis_gates=None, - coupling_map=None, - initial_layout=None, - layout_method=None, - routing_method=None, - translation_method=None, - scheduling_method=None, - approximation_degree=1.0, - seed_transpiler=None, - unitary_synthesis_method="default", - unitary_synthesis_plugin_config=None, - hls_config=None, - init_method=None, - optimization_method=None, - dt=None, - qubits_initially_zero=True, + optimization_level: int = 2, + backend: Backend | None = None, + target: Target | None = None, + basis_gates: list[str] | None = None, + coupling_map: CouplingMap | list | None = None, + initial_layout: Layout | list[int] = None, + layout_method: str | None = None, + routing_method: str | None = None, + translation_method: str | None = None, + scheduling_method: str | None = None, + approximation_degree: float | None = 1.0, + seed_transpiler: int | None = None, + unitary_synthesis_method: str = "default", + unitary_synthesis_plugin_config: dict | None = None, + hls_config: HLSConfig | None = None, + init_method: str | None = None, + optimization_method: str | None = None, + dt: float | None = None, + qubits_initially_zero: bool = True, *, _skip_target=False, ): @@ -99,7 +106,7 @@ def generate_preset_pass_manager( are ignored in this flow. Args: - optimization_level (int): The optimization level to generate a + optimization_level: The optimization level to generate a :class:`~.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 @@ -110,35 +117,33 @@ def generate_preset_pass_manager( * 2: heavy optimization * 3: even heavier optimization - backend (Backend): An optional backend object which can be used as the + backend: An optional backend object which can be used as the source of the default values for the ``basis_gates``, ``coupling_map``, and ``target``. If any of those other arguments are specified in addition to ``backend`` they will take precedence over the value contained in the backend. - target (Target): The :class:`~.Target` representing a backend compilation + target: The :class:`~.Target` representing a backend compilation target. The following attributes will be inferred from this argument if they are not set: ``coupling_map`` and ``basis_gates``. - basis_gates (list): List of basis gate names to unroll to + basis_gates: List of basis gate names to unroll to (e.g: ``['u1', 'u2', 'u3', 'cx']``). - coupling_map (CouplingMap or list): Directed graph represented a coupling + coupling_map: Directed graph represented a coupling map. Multiple formats are supported: #. ``CouplingMap`` instance #. 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): Backend sample time (resolution) in seconds. - If ``None`` (default) and a backend is provided, ``backend.dt`` is used. - initial_layout (Layout | List[int]): Initial position of virtual qubits on + initial_layout: Initial position of virtual qubits on physical qubits. - layout_method (str): The :class:`~.Pass` to use for choosing initial qubit + layout_method: The :class:`~.Pass` to use for choosing initial qubit placement. Valid choices are ``'trivial'``, ``'dense'``, and ``'sabre'``, representing :class:`~.TrivialLayout`, :class:`~.DenseLayout` and :class:`~.SabreLayout` respectively. This can also be the external plugin name to use for the ``layout`` stage of the output :class:`~.StagedPassManager`. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"layout"`` for the ``stage_name`` argument. - routing_method (str): The pass to use for routing qubits on the + routing_method: The pass to use for routing qubits on the architecture. Valid choices are ``'basic'``, ``'lookahead'``, ``'sabre'``, and ``'none'`` representing :class:`~.BasicSwap`, :class:`~.LookaheadSwap`, :class:`~.SabreSwap`, and @@ -146,25 +151,25 @@ def generate_preset_pass_manager( name to use for the ``routing`` stage of the output :class:`~.StagedPassManager`. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"routing"`` for the ``stage_name`` argument. - translation_method (str): The method to use for translating gates to + translation_method: The method to use for translating gates to basis gates. Valid choices ``'translator'``, ``'synthesis'`` representing :class:`~.BasisTranslator`, and :class:`~.UnitarySynthesis` respectively. This can also be the external plugin name to use for the ``translation`` stage of the output :class:`~.StagedPassManager`. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"translation"`` for the ``stage_name`` argument. - scheduling_method (str): The pass to use for scheduling instructions. Valid choices + scheduling_method: The pass to use for scheduling instructions. Valid choices are ``'alap'`` and ``'asap'``. This can also be the external plugin name to use for the ``scheduling`` stage of the output :class:`~.StagedPassManager`. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"scheduling"`` for the ``stage_name`` argument. - approximation_degree (float): Heuristic dial used for circuit approximation + approximation_degree: Heuristic dial used for circuit approximation (1.0=no approximation, 0.0=maximal approximation). - seed_transpiler (int): Sets random seed for the stochastic parts of + seed_transpiler: Sets random seed for the stochastic parts of the transpiler. - unitary_synthesis_method (str): The name of the unitary synthesis + unitary_synthesis_method: The name of the unitary synthesis method to use. By default ``'default'`` is used. You can see a list of installed plugins with :func:`.unitary_synthesis_plugin_names`. - unitary_synthesis_plugin_config (dict): An optional configuration dictionary + unitary_synthesis_plugin_config: 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 @@ -172,22 +177,24 @@ def generate_preset_pass_manager( 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): An optional configuration class :class:`~.HLSConfig` + hls_config: An optional configuration class :class:`~.HLSConfig` that will be passed directly to :class:`~.HighLevelSynthesis` transformation pass. This configuration class allows to specify for various high-level objects the lists of synthesis algorithms and their parameters. - init_method (str): The plugin name to use for the ``init`` stage of + init_method: The plugin name to use for the ``init`` stage of the output :class:`~.StagedPassManager`. By default an external plugin is not used. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"init"`` for the stage name argument. - optimization_method (str): The plugin name to use for the + optimization_method: The plugin name to use for the ``optimization`` stage of the output :class:`~.StagedPassManager`. By default an external plugin is not used. You can see a list of installed plugins by using :func:`~.list_stage_plugins` with ``"optimization"`` for the ``stage_name`` argument. - qubits_initially_zero (bool): Indicates whether the input circuit is + dt: Backend sample time (resolution) in seconds. + If ``None`` (default) and a backend is provided, ``backend.dt`` is used. + qubits_initially_zero: Indicates whether the input circuit is zero-initialized. Returns: