qiskit-documentation/docs/api/qiskit/0.44/qiskit.transpiler.Condition...

88 lines
3.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: ConditionalController
description: API reference for qiskit.transpiler.ConditionalController
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.transpiler.ConditionalController
---
# ConditionalController
<Class id="qiskit.transpiler.ConditionalController" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.25/qiskit/transpiler/runningpassmanager.py" signature="qiskit.transpiler.ConditionalController(passes, options=None, condition=None, **partial_controller)" modifiers="class">
Bases: [`FlowController`](qiskit.transpiler.FlowController "qiskit.transpiler.runningpassmanager.FlowController")
Implements a set of passes under a certain condition.
## Attributes
### registered\_controllers
<Attribute id="qiskit.transpiler.ConditionalController.registered_controllers" attributeValue="{'condition': <class 'qiskit.transpiler.runningpassmanager.ConditionalController'>, 'do_while': <class 'qiskit.transpiler.runningpassmanager.DoWhileController'>}" />
## Methods
### add\_flow\_controller
<Function id="qiskit.transpiler.ConditionalController.add_flow_controller" signature="add_flow_controller(name, controller)" modifiers="classmethod">
Adds a flow controller.
**Parameters**
* **name** (*string*) Name of the controller to add.
* **controller** ([*type*](https://docs.python.org/3/library/functions.html#type "(in Python v3.12)")*(*[*FlowController*](qiskit.transpiler.FlowController "qiskit.transpiler.FlowController")*)*) The class implementing a flow controller.
</Function>
### controller\_factory
<Function id="qiskit.transpiler.ConditionalController.controller_factory" signature="controller_factory(passes, options, **partial_controller)" modifiers="classmethod">
Constructs a flow controller based on the partially evaluated controller arguments.
**Parameters**
* **passes** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[TBasePass]*) passes to add to the flow controller.
* **options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) PassManager options.
* **\*\*partial\_controller** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) Partially evaluated controller arguments in the form \{name:partial}
**Raises**
[**TranspilerError**](transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") When partial\_controller is not well-formed.
**Returns**
A FlowController instance.
**Return type**
[FlowController](qiskit.transpiler.FlowController "qiskit.transpiler.FlowController")
</Function>
### dump\_passes
<Function id="qiskit.transpiler.ConditionalController.dump_passes" signature="dump_passes()">
Fetches the passes added to this flow controller.
**Returns**
\{options: self.options, passes: \[passes], type: type(self)}
**Return type**
[dict](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")
</Function>
### remove\_flow\_controller
<Function id="qiskit.transpiler.ConditionalController.remove_flow_controller" signature="remove_flow_controller(name)" modifiers="classmethod">
Removes a flow controller.
**Parameters**
**name** (*string*) Name of the controller to remove.
**Raises**
[**KeyError**](https://docs.python.org/3/library/exceptions.html#KeyError "(in Python v3.12)") If the controller to remove was not registered.
</Function>
</Class>