Skip to content

Commit

Permalink
SingleQubitUnitary subclass UnitaryGate instead of Gate Qiskit#4447
Browse files Browse the repository at this point in the history
  • Loading branch information
scottwn committed May 15, 2020
1 parent a87fe61 commit 186016a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qiskit/extensions/quantum_initializer/squ.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from qiskit.circuit import QuantumRegister, Qubit, QuantumCircuit
from qiskit.circuit.gate import Gate
from qiskit.extensions.unitary import UnitaryGate
from qiskit.quantum_info.operators.predicates import is_unitary_matrix
from qiskit.exceptions import QiskitError
from qiskit.circuit.library.standard_gates.ry import RYGate
Expand All @@ -35,7 +36,7 @@
_EPS = 1e-10 # global variable used to chop very small numbers to zero


class SingleQubitUnitary(Gate):
class SingleQubitUnitary(UnitaryGate):
"""
u = 2*2 unitary (given as a (complex) numpy.ndarray)
Expand Down Expand Up @@ -63,7 +64,7 @@ def __init__(self, unitary_matrix, mode='ZYZ', up_to_diagonal=False, u=None):
self._diag = None

# Create new gate
super().__init__("unitary", 1, [unitary_matrix])
super().__init__(unitary_matrix)

@property
def diag(self):
Expand Down

0 comments on commit 186016a

Please sign in to comment.