69 lines
2.6 KiB
Plaintext
69 lines
2.6 KiB
Plaintext
---
|
||
title: ConsolidateBlocks (v0.31)
|
||
description: API reference for qiskit.transpiler.passes.ConsolidateBlocks in qiskit v0.31
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.transpiler.passes.ConsolidateBlocks
|
||
---
|
||
|
||
# ConsolidateBlocks
|
||
|
||
<Class id="qiskit.transpiler.passes.ConsolidateBlocks" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/transpiler/passes/optimization/consolidate_blocks.py" signature="ConsolidateBlocks(*args, **kwargs)" modifiers="class">
|
||
Bases: `qiskit.transpiler.basepasses.TransformationPass`
|
||
|
||
Replace each block of consecutive gates by a single Unitary node.
|
||
|
||
Pass to consolidate sequences of uninterrupted gates acting on the same qubits into a Unitary node, to be resynthesized later, to a potentially more optimal subcircuit.
|
||
|
||
**Notes**
|
||
|
||
This pass assumes that the ‘blocks\_list’ property that it reads is given such that blocks are in topological order. The blocks are collected by a previous pass, such as Collect2qBlocks.
|
||
|
||
ConsolidateBlocks initializer.
|
||
|
||
**Parameters**
|
||
|
||
* **kak\_basis\_gate** ([*Gate*](qiskit.circuit.Gate "qiskit.circuit.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.
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-transpiler-passes-consolidateblocks-name" />
|
||
|
||
### name
|
||
|
||
<Function id="qiskit.transpiler.passes.ConsolidateBlocks.name" signature="ConsolidateBlocks.name()">
|
||
Return the name of the pass.
|
||
</Function>
|
||
|
||
<span id="qiskit-transpiler-passes-consolidateblocks-run" />
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.transpiler.passes.ConsolidateBlocks.run" signature="ConsolidateBlocks.run(dag)">
|
||
Run the ConsolidateBlocks pass on dag.
|
||
|
||
Iterate over each block and replace it with an equivalent Unitary on the same wires.
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### is\_analysis\_pass
|
||
|
||
<Attribute id="qiskit.transpiler.passes.ConsolidateBlocks.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.passes.ConsolidateBlocks.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>
|
||
</Class>
|
||
|