diff --git a/qiskit/circuit/library/standard_gates/ecr.py b/qiskit/circuit/library/standard_gates/ecr.py index f626f85db39e..25a2b86c04ed 100644 --- a/qiskit/circuit/library/standard_gates/ecr.py +++ b/qiskit/circuit/library/standard_gates/ecr.py @@ -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 ( diff --git a/releasenotes/notes/add-inverse-ecr-e03720252a0c9c1e.yaml b/releasenotes/notes/add-inverse-ecr-e03720252a0c9c1e.yaml new file mode 100644 index 000000000000..56a6dfd77f79 --- /dev/null +++ b/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.