Skip to content

Commit 3d91d02

Browse files
Add inverse method to ECRGate (#9733) (#9738)
* add inverse method to ECRGate * add release notes * Fix sphinx tags * Recategorise as bugfix --------- Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Jake Lishman <[email protected]> (cherry picked from commit 80ca1f3) Co-authored-by: Shelly Garion <[email protected]>
1 parent bf13dd9 commit 3d91d02

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

qiskit/circuit/library/standard_gates/ecr.py

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ def _define(self):
103103

104104
self.definition = qc
105105

106+
def inverse(self):
107+
"""Return inverse ECR gate (itself)."""
108+
return ECRGate() # self-inverse
109+
106110
def to_matrix(self):
107111
"""Return a numpy.array for the ECR gate."""
108112
return (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
The method :meth:`.ECRGate.inverse` now returns another :class:`.ECRGate` instance
5+
rather than a custom gate, since it is self inverse.

0 commit comments

Comments
 (0)