Skip to content

Commit

Permalink
update U gates (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
albi3ro authored Jan 27, 2021
1 parent 879a85c commit dfbf988
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@
from ._version import __version__


# Auxiliary functions for gates subject to deprecation
def U1Gate(theta):
"""Auxiliary function for the ``U1Gate``."""
return ex.PhaseGate(theta)


def U2Gate(phi, lam):
"""Auxiliary function for the ``U2Gate``.
Uses the equation ``u2(phi, lam) = u(pi/2, phi, lam)``.
"""
return ex.U(np.pi / 2, phi, lam)


def U3Gate(theta, phi, lam):
"""Auxiliary function for the ``U3Gate``."""
return ex.U(theta, phi, lam)


QISKIT_OPERATION_MAP = {
# native PennyLane operations also native to qiskit
"PauliX": ex.XGate,
Expand All @@ -75,12 +56,9 @@ def U3Gate(theta, phi, lam):
"QubitStateVector": ex.Initialize,
"Toffoli": ex.CCXGate,
"QubitUnitary": ex.UnitaryGate,
"U": ex.UGate,
# Qiskit gates subject to deprecation (using custom definitions that depend on
# the latest recommended gates)
"U1": U1Gate,
"U2": U2Gate,
"U3": U3Gate,
"U1": ex.U1Gate,
"U2": ex.U2Gate,
"U3": ex.U3Gate,
}

# Separate dictionary for the inverses as the operations dictionary needs
Expand Down

0 comments on commit dfbf988

Please sign in to comment.