qiskit-documentation/docs/api/qiskit/0.37/qiskit.transpiler.passes.In...

71 lines
2.6 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: InverseCancellation
description: API reference for qiskit.transpiler.passes.InverseCancellation
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.transpiler.passes.InverseCancellation
---
# InverseCancellation
<Class id="qiskit.transpiler.passes.InverseCancellation" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.21/qiskit/transpiler/passes/optimization/inverse_cancellation.py" signature="InverseCancellation(gates_to_cancel)" modifiers="class">
Bases: [`qiskit.transpiler.basepasses.TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass")
Cancel specific Gates which are inverses of each other when they occur back-to- back.
Initialize InverseCancellation pass.
**Parameters**
**gates\_to\_cancel** (`List`\[`Union`\[[`Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate"), `Tuple`\[[`Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate"), [`Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate")]]]) list of gates to cancel
**Raises**
[**TranspilerError**](qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") Initalization raises an error when the input is not a self-inverse gate or a two-tuple of inverse gates.
## Methods
### name
<Function id="qiskit.transpiler.passes.InverseCancellation.name" signature="InverseCancellation.name()">
Return the name of the pass.
</Function>
### run
<Function id="qiskit.transpiler.passes.InverseCancellation.run" signature="InverseCancellation.run(dag)">
Run the InverseCancellation pass on dag.
**Parameters**
**dag** ([`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.dagcircuit.DAGCircuit")) the directed acyclic graph to run on.
**Returns**
Transformed DAG.
**Return type**
[DAGCircuit](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit")
</Function>
## Attributes
### is\_analysis\_pass
<Attribute id="qiskit.transpiler.passes.InverseCancellation.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.InverseCancellation.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>