Update Qiskit Transpiler Service docs (#1419)

This commit is contained in:
Eric Arellano 2024-05-22 15:25:25 -04:00 committed by GitHub
parent ec33436710
commit 6362b9913b
15 changed files with 651 additions and 39 deletions

View File

@ -50,8 +50,9 @@
],
"ignorePaths": [
// We cannot easily control these API docs since they live in other repositories.
"../docs/api/qiskit/**/*.md*",
"../docs/api/qiskit-ibm-runtime/**/*.md*",
"../docs/api/qiskit-ibm-provider/**/*.md*"
"../docs/api/qiskit/**/*.mdx",
"../docs/api/qiskit-ibm-runtime/**/*.mdx",
"../docs/api/qiskit-ibm-provider/**/*.mdx",
"../docs/api/qiskit-transpiler-service/**/*.mdx"
]
}

View File

@ -12,9 +12,33 @@
"title": "Module overview",
"url": "/api/qiskit-transpiler-service/ai"
},
{
"title": "AICliffordSynthesis",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.AICliffordSynthesis"
},
{
"title": "AILinearFunctionSynthesis",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.AILinearFunctionSynthesis"
},
{
"title": "AIPermutationSynthesis",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.AIPermutationSynthesis"
},
{
"title": "AIRouting",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.AIRouting"
},
{
"title": "CollectCliffords",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.CollectCliffords"
},
{
"title": "CollectLinearFunctions",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.CollectLinearFunctions"
},
{
"title": "CollectPermutations",
"url": "/api/qiskit-transpiler-service/qiskit_transpiler_service.ai.CollectPermutations"
}
]
},

View File

@ -18,7 +18,13 @@ python_api_name: qiskit_transpiler_service.ai
## Classes
| | |
| ------------------------------------------------------------------------------------------------------------------ | - |
| [`AIRouting`](qiskit_transpiler_service.ai.AIRouting "qiskit_transpiler_service.ai.AIRouting")(\*args, \*\*kwargs) | |
| | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [`AIRouting`](qiskit_transpiler_service.ai.AIRouting "qiskit_transpiler_service.ai.AIRouting")(\[backend\_name, coupling\_map, ...]) | The AIRouting pass acts both as a layout stage and a routing stage. |
| [`AICliffordSynthesis`](qiskit_transpiler_service.ai.AICliffordSynthesis "qiskit_transpiler_service.ai.AICliffordSynthesis")(backend\_name\[, ...]) | Synthesis for Clifford circuits (blocks of H, S and CX gates). |
| [`AILinearFunctionSynthesis`](qiskit_transpiler_service.ai.AILinearFunctionSynthesis "qiskit_transpiler_service.ai.AILinearFunctionSynthesis")(backend\_name\[, ...]) | Synthesis for Linear Function circuits (blocks of CX and SWAP gates). |
| [`AIPermutationSynthesis`](qiskit_transpiler_service.ai.AIPermutationSynthesis "qiskit_transpiler_service.ai.AIPermutationSynthesis")(backend\_name\[, ...]) | Synthesis for Permutation circuits (blocks of SWAP gates). |
| [`CollectCliffords`](qiskit_transpiler_service.ai.CollectCliffords "qiskit_transpiler_service.ai.CollectCliffords")(\[do\_commutative\_analysis, ...]) | Collects Clifford blocks as Instruction objects and stores the original sub-circuit to compare against it after synthesis. |
| [`CollectLinearFunctions`](qiskit_transpiler_service.ai.CollectLinearFunctions "qiskit_transpiler_service.ai.CollectLinearFunctions")(\[...]) | Collects blocks of SWAP and CX as LinearFunction objects and stores the original sub-circuit to compare against it after synthesis. |
| [`CollectPermutations`](qiskit_transpiler_service.ai.CollectPermutations "qiskit_transpiler_service.ai.CollectPermutations")(\[...]) | Collects blocks of SWAP circuits as Permutations. |

View File

@ -0,0 +1,91 @@
---
title: AICliffordSynthesis
description: API reference for qiskit_transpiler_service.ai.AICliffordSynthesis
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.AICliffordSynthesis
---
# AICliffordSynthesis
<Class id="qiskit_transpiler_service.ai.AICliffordSynthesis" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.AICliffordSynthesis(backend_name: str, replace_only_if_better: bool = True, max_threads: int | None = None)" modifiers="class">
Bases: `AISynthesis`
Synthesis for Clifford circuits (blocks of H, S and CX gates). Currently up to 9 qubit blocks.
**Parameters**
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) Name of the backend used for doing the AI Clifford synthesis.
* **replace\_only\_if\_better** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Determine if replace the original circuit with the synthesized one if its better, defaults to True.
* **max\_threads** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the number of requests to send in parallel.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.AICliffordSynthesis.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.AICliffordSynthesis.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.AICliffordSynthesis.run" signature="run(dag)">
Run a pass on the DAGCircuit. This is implemented by the pass developer.
**Parameters**
**dag** ([*DAGCircuit*](/api/qiskit/qiskit.dagcircuit.DAGCircuit "(in Qiskit v1.1)")) the dag on which the pass is run.
**Raises**
[**NotImplementedError**](https://docs.python.org/3/library/exceptions.html#NotImplementedError "(in Python v3.12)") when this is left unimplemented for a pass.
</Function>
### synth\_node
<Function id="qiskit_transpiler_service.ai.AICliffordSynthesis.synth_node" signature="synth_node(node)" />
### update\_status
<Function id="qiskit_transpiler_service.ai.AICliffordSynthesis.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -0,0 +1,91 @@
---
title: AILinearFunctionSynthesis
description: API reference for qiskit_transpiler_service.ai.AILinearFunctionSynthesis
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.AILinearFunctionSynthesis
---
# AILinearFunctionSynthesis
<Class id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.AILinearFunctionSynthesis(backend_name: str, replace_only_if_better: bool = True, max_threads: int | None = None)" modifiers="class">
Bases: `AISynthesis`
Synthesis for Linear Function circuits (blocks of CX and SWAP gates). Currently up to 9 qubit blocks.
**Parameters**
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) Name of the backend used for doing the AI Linear Function synthesis.
* **replace\_only\_if\_better** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Determine if replace the original circuit with the synthesized one if its better, defaults to True.
* **max\_threads** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the number of requests to send in parallel.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis.run" signature="run(dag)">
Run a pass on the DAGCircuit. This is implemented by the pass developer.
**Parameters**
**dag** ([*DAGCircuit*](/api/qiskit/qiskit.dagcircuit.DAGCircuit "(in Qiskit v1.1)")) the dag on which the pass is run.
**Raises**
[**NotImplementedError**](https://docs.python.org/3/library/exceptions.html#NotImplementedError "(in Python v3.12)") when this is left unimplemented for a pass.
</Function>
### synth\_node
<Function id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis.synth_node" signature="synth_node(node)" />
### update\_status
<Function id="qiskit_transpiler_service.ai.AILinearFunctionSynthesis.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -0,0 +1,91 @@
---
title: AIPermutationSynthesis
description: API reference for qiskit_transpiler_service.ai.AIPermutationSynthesis
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.AIPermutationSynthesis
---
# AIPermutationSynthesis
<Class id="qiskit_transpiler_service.ai.AIPermutationSynthesis" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.AIPermutationSynthesis(backend_name: str, replace_only_if_better: bool = True, max_threads: int | None = None)" modifiers="class">
Bases: `AISynthesis`
Synthesis for Permutation circuits (blocks of SWAP gates). Currently available for 65, 33, and 27 qubit blocks.
**Parameters**
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) Name of the backend used for doing the AI Linear Function synthesis.
* **replace\_only\_if\_better** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Determine if replace the original circuit with the synthesized one if its better, defaults to True.
* **max\_threads** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the number of requests to send in parallel.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.AIPermutationSynthesis.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.AIPermutationSynthesis.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.AIPermutationSynthesis.run" signature="run(dag)">
Run a pass on the DAGCircuit. This is implemented by the pass developer.
**Parameters**
**dag** ([*DAGCircuit*](/api/qiskit/qiskit.dagcircuit.DAGCircuit "(in Qiskit v1.1)")) the dag on which the pass is run.
**Raises**
[**NotImplementedError**](https://docs.python.org/3/library/exceptions.html#NotImplementedError "(in Python v3.12)") when this is left unimplemented for a pass.
</Function>
### synth\_node
<Function id="qiskit_transpiler_service.ai.AIPermutationSynthesis.synth_node" signature="synth_node(node)" />
### update\_status
<Function id="qiskit_transpiler_service.ai.AIPermutationSynthesis.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -8,49 +8,48 @@ python_api_name: qiskit_transpiler_service.ai.AIRouting
# AIRouting
<Class id="qiskit_transpiler_service.ai.AIRouting" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.AIRouting(*args, **kwargs)" modifiers="class">
Bases: [`TransformationPass`](/api/qiskit/qiskit.transpiler.TransformationPass "(in Qiskit v1.0)")
<Class id="qiskit_transpiler_service.ai.AIRouting" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.AIRouting(backend_name: str | None = None, coupling_map: list[list[int]] | None = None, optimization_level: int = 2, layout_mode: str = 'OPTIMIZE')" modifiers="class">
Bases: [`TransformationPass`](/api/qiskit/qiskit.transpiler.TransformationPass "(in Qiskit v1.1)")
## Attributes
The AIRouting pass acts both as a layout stage and a routing stage.
### is\_analysis\_pass
**Parameters**
<Attribute id="qiskit_transpiler_service.ai.AIRouting.is_analysis_pass">
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
</Attribute>
### is\_transformation\_pass
<Attribute id="qiskit_transpiler_service.ai.AIRouting.is_transformation_pass">
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
</Attribute>
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Name of the backend used for doing the transpilation.
* **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*]], optional*) A list of pairs that represents physical links between qubits.
* **optimization\_level** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) With a range from 1 to 3, determines the computational effort to spend in the process (higher usually gives better results but takes longer), defaults to 2.
* **layout\_mode** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) Specifies how to handle the layout selection. There are 3 layout modes: keep (respects the layout set by the previous transpiler passes), improve (uses the layout set by the previous transpiler passes as a starting point) and optimize (ignores previous layout selections), defaults to OPTIMIZE.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.AIRouting.execute" signature="execute(passmanager_ir: Any, state: PassManagerState, callback: Callable | None = None) → tuple[Any, PassManagerState]">
<Function id="qiskit_transpiler_service.ai.AIRouting.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** Qiskit IR to optimize.
* **state** State associated with workflow execution by the pass manager itself.
* **callback** A callback function which is caller per execution of optimization task.
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.AIRouting.name" signature="name() → str">
<Function id="qiskit_transpiler_service.ai.AIRouting.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
@ -78,17 +77,21 @@ python_api_name: qiskit_transpiler_service.ai.AIRouting
### update\_status
<Function id="qiskit_transpiler_service.ai.AIRouting.update_status" signature="update_status(state: PassManagerState, run_state: RunState) → PassManagerState">
<Function id="qiskit_transpiler_service.ai.AIRouting.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** Pass manager state to update.
* **run\_state** Completion status of current task.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -0,0 +1,89 @@
---
title: CollectCliffords
description: API reference for qiskit_transpiler_service.ai.CollectCliffords
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.CollectCliffords
---
# CollectCliffords
<Class id="qiskit_transpiler_service.ai.CollectCliffords" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.CollectCliffords(do_commutative_analysis: bool = True, min_block_size: int = 2, max_block_size: int = CLIFFORD_MAX_BLOCK_SIZE, collect_from_back: bool = False, num_reps: int = 10)" modifiers="class">
Bases: `RepeatedCollectAndCollapse`
Collects Clifford blocks as Instruction objects and stores the original sub-circuit to compare against it after synthesis.
**Parameters**
* **do\_commutative\_analysis** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Enable or disable commutative analysis, defaults to True
* **min\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the minimum size for blocks generated during the collect Cliffords pass, defaults to 2.
* **max\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the maximum size for blocks generated during the collect Cliffords pass, defaults to 9.
* **collect\_from\_back** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Specify if collect blocks in reverse order or not, defaults to False.
* **num\_reps** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Specify how many times to repeat the optimization process, defaults to 10.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.CollectCliffords.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.CollectCliffords.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.CollectCliffords.run" signature="run(dag)">
Run the CollectLinearFunctions pass on dag. :param dag: the DAG to be optimized. :type dag: DAGCircuit
**Returns**
the optimized DAG.
**Return type**
DAGCircuit
</Function>
### update\_status
<Function id="qiskit_transpiler_service.ai.CollectCliffords.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -0,0 +1,89 @@
---
title: CollectLinearFunctions
description: API reference for qiskit_transpiler_service.ai.CollectLinearFunctions
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.CollectLinearFunctions
---
# CollectLinearFunctions
<Class id="qiskit_transpiler_service.ai.CollectLinearFunctions" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.CollectLinearFunctions(do_commutative_analysis: bool = True, min_block_size: int = 4, max_block_size: int = LINEAR_MAX_BLOCK_SIZE, collect_from_back: bool = False, num_reps: int = 10)" modifiers="class">
Bases: `RepeatedCollectAndCollapse`
Collects blocks of SWAP and CX as LinearFunction objects and stores the original sub-circuit to compare against it after synthesis.
**Parameters**
* **do\_commutative\_analysis** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Enable or disable commutative analysis, defaults to True
* **min\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the minimum size for blocks generated during the collect linear functions pass, defaults to 4.
* **max\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the maximum size for blocks generated during the collect linear functions pass, defaults to 9.
* **collect\_from\_back** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Specify if collect blocks in reverse order or not, defaults to False.
* **num\_reps** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Specify how many times to repeat the optimization process, defaults to 10.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.CollectLinearFunctions.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.CollectLinearFunctions.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.CollectLinearFunctions.run" signature="run(dag)">
Run the CollectLinearFunctions pass on dag. :param dag: the DAG to be optimized. :type dag: DAGCircuit
**Returns**
the optimized DAG.
**Return type**
DAGCircuit
</Function>
### update\_status
<Function id="qiskit_transpiler_service.ai.CollectLinearFunctions.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -0,0 +1,89 @@
---
title: CollectPermutations
description: API reference for qiskit_transpiler_service.ai.CollectPermutations
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.ai.CollectPermutations
---
# CollectPermutations
<Class id="qiskit_transpiler_service.ai.CollectPermutations" isDedicatedPage={true} signature="qiskit_transpiler_service.ai.CollectPermutations(do_commutative_analysis: bool = True, min_block_size: int = 4, max_block_size: int = PERMUTATION_MAX_BLOCK_SIZE, collect_from_back: bool = False, num_reps: int = 10)" modifiers="class">
Bases: `RepeatedCollectAndCollapse`
Collects blocks of SWAP circuits as Permutations.
**Parameters**
* **do\_commutative\_analysis** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Enable or disable commutative analysis, defaults to True
* **min\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the minimum size for blocks generated during the collect permutations pass, defaults to 4.
* **max\_block\_size** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Set the maximum size for blocks generated during the collect permutations pass, defaults to 12.
* **collect\_from\_back** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Specify if collect blocks in reverse order or not, defaults to False.
* **num\_reps** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*, optional*) Specify how many times to repeat the optimization process, defaults to 10.
## Methods
### execute
<Function id="qiskit_transpiler_service.ai.CollectPermutations.execute" signature="execute(passmanager_ir, state, callback=None)">
Execute optimization task for input Qiskit IR.
**Parameters**
* **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")) Qiskit IR to optimize.
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) State associated with workflow execution by the pass manager itself.
* **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.12)") *| None*) A callback function which is caller per execution of optimization task.
**Returns**
Optimized Qiskit IR and state of the workflow.
**Return type**
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.12)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)"), [*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")]
</Function>
### name
<Function id="qiskit_transpiler_service.ai.CollectPermutations.name" signature="name()">
Name of the pass.
**Return type**
[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")
</Function>
### run
<Function id="qiskit_transpiler_service.ai.CollectPermutations.run" signature="run(dag)">
Run the CollectLinearFunctions pass on dag. :param dag: the DAG to be optimized. :type dag: DAGCircuit
**Returns**
the optimized DAG.
**Return type**
DAGCircuit
</Function>
### update\_status
<Function id="qiskit_transpiler_service.ai.CollectPermutations.update_status" signature="update_status(state, run_state)">
Update workflow status.
**Parameters**
* **state** ([*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")) Pass manager state to update.
* **run\_state** (*RunState*) Completion status of current task.
**Returns**
Updated pass manager state.
**Return type**
[*PassManagerState*](/api/qiskit/qiskit.passmanager.PassManagerState "(in Qiskit v1.1)")
</Function>
</Class>

View File

@ -8,13 +8,34 @@ python_api_name: qiskit_transpiler_service.transpiler_service.TranspilerService
# TranspilerService
<Class id="qiskit_transpiler_service.transpiler_service.TranspilerService" isDedicatedPage={true} signature="qiskit_transpiler_service.transpiler_service.TranspilerService(optimization_level: int, ai: bool = True, coupling_map: List[List[int]] | None = None, backend_name: str | None = None, qiskit_transpile_options: dict | None = None, ai_layout_mode: str | None = None)" modifiers="class">
<Class id="qiskit_transpiler_service.transpiler_service.TranspilerService" isDedicatedPage={true} signature="qiskit_transpiler_service.transpiler_service.TranspilerService(optimization_level, ai=True, coupling_map=None, backend_name=None, qiskit_transpile_options=None, ai_layout_mode=None)" modifiers="class">
Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.12)")
Class for using the transpiler service.
**Parameters**
* **optimization\_level** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) The optimization level to use during the transpilation. There are 4 optimization levels ranging from 0 to 3, where 0 is intended for not performing any optimizations and 3 spends the most effort to optimize the circuit.
* **ai** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Specifyies if the transpilation should use AI or not, defaults to True.
* **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*]], optional*) A list of pairs that represents physical links between qubits.
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Name of the backend used for doing the transpilation.
* **qiskit\_transpile\_options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")*, optional*) Other options to transpile with qiskit.
* **ai\_layout\_mode** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Specifies how to handle the layout selection. There are 3 layout modes: keep (respects the layout set by the previous transpiler passes), improve (uses the layout set by the previous transpiler passes as a starting point) and optimize (ignores previous layout selections).
## Methods
### run
<Function id="qiskit_transpiler_service.transpiler_service.TranspilerService.run" signature="run(circuits: List[str | QuantumCircuit] | str | QuantumCircuit)" />
<Function id="qiskit_transpiler_service.transpiler_service.TranspilerService.run" signature="run(circuits)">
Transpile the circuit(s) by calling the service /transpile endpoint.
**Parameters**
**circuits** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.12)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.1)")*] |* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.1)")) circuit(s) to transpile.
**Returns**
The transpiled circuit(s)
</Function>
</Class>

View File

@ -18,7 +18,7 @@ python_api_name: qiskit_transpiler_service.transpiler_service
## Classes
| | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| [`TranspilerService`](qiskit_transpiler_service.transpiler_service.TranspilerService "qiskit_transpiler_service.transpiler_service.TranspilerService")(optimization\_level\[, ai, ...]) | |
| | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| [`TranspilerService`](qiskit_transpiler_service.transpiler_service.TranspilerService "qiskit_transpiler_service.transpiler_service.TranspilerService")(optimization\_level\[, ai, ...]) | Class for using the transpiler service. |

View File

@ -20,11 +20,28 @@ python_api_name: qiskit_transpiler_service.utils
### create\_random\_linear\_function
<Function id="qiskit_transpiler_service.utils.create_random_linear_function" signature="qiskit_transpiler_service.utils.create_random_linear_function(n_qubits: int, seed: int = 123) → LinearFunction" />
<Function id="qiskit_transpiler_service.utils.create_random_linear_function" signature="qiskit_transpiler_service.utils.create_random_linear_function(n_qubits, seed=123)">
**Parameters**
* **n\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)"))
* **seed** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)"))
**Return type**
[*LinearFunction*](/api/qiskit/qiskit.circuit.library.LinearFunction "(in Qiskit v1.1)")
</Function>
### get\_metrics
<Function id="qiskit_transpiler_service.utils.get_metrics" signature="qiskit_transpiler_service.utils.get_metrics(qc: QuantumCircuit) → dict[str, int]">
<Function id="qiskit_transpiler_service.utils.get_metrics" signature="qiskit_transpiler_service.utils.get_metrics(qc)">
Returns a dict with metrics from a QuantumCircuit
**Parameters**
**qc** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.1)"))
**Return type**
[dict](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")\[[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)"), [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")]
</Function>

View File

@ -5,7 +5,7 @@
"author": "Qiskit Development Team",
"license": "Apache-2.0",
"scripts": {
"check": "npm run check:qiskit-bot && check:metadata && npm run check:spelling && npm run check:internal-links && npm run check:orphan-pages && npm run check:fmt",
"check": "npm run check:qiskit-bot && npm run check:metadata && npm run check:spelling && npm run check:internal-links && npm run check:orphan-pages && npm run check:fmt",
"check:metadata": "node -r esbuild-register scripts/commands/checkMetadata.ts",
"check:spelling": "cspell --relative --no-progress docs/**/*.md* docs/api/**/*.md* --config cspell/cSpell.json",
"check:fmt": "prettier --check .",