Skip to content

Commit

Permalink
Add inverse method to ECRGate (Qiskit#9733)
Browse files Browse the repository at this point in the history
* add inverse method to ECRGate

* add release notes

* Fix sphinx tags

* Recategorise as bugfix

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
  • Loading branch information
4 people committed Mar 6, 2023
1 parent 126c9ba commit 80ca1f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qiskit/circuit/library/standard_gates/ecr.py
Expand Up @@ -103,6 +103,10 @@ def _define(self):

self.definition = qc

def inverse(self):
"""Return inverse ECR gate (itself)."""
return ECRGate() # self-inverse

def to_matrix(self):
"""Return a numpy.array for the ECR gate."""
return (
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/add-inverse-ecr-e03720252a0c9c1e.yaml
@@ -0,0 +1,5 @@
---
fixes:
- |
The method :meth:`.ECRGate.inverse` now returns another :class:`.ECRGate` instance
rather than a custom gate, since it is self inverse.

0 comments on commit 80ca1f3

Please sign in to comment.