9

How to implement the phase shift gate in qiskit or ibmq? Phase Shift Gate : $$\begin{pmatrix}e^{ia} && 0 \\ 0 && e^{ia}\end{pmatrix} = e^{ia}I$$

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112
Debarghya Kundu
  • 185
  • 1
  • 4

1 Answers1

17

You can implement the phase shift gate $$P_h(\theta) = \begin{pmatrix}e^{i\theta} & 0\\0 & e^{i\theta}\end{pmatrix}$$ with the X and u1 gate from the IBM Q chips: $$ \begin{align} P_h(\theta) &= U_1(\theta)\ X\ U_1(\theta)\ X \\ &= \begin{pmatrix}1 & 0\\0 & e^{i\theta}\end{pmatrix} \begin{pmatrix}0 & 1\\1 & 0\end{pmatrix} \begin{pmatrix}1 & 0\\0 & e^{i\theta}\end{pmatrix} \begin{pmatrix}0 & 1\\1 & 0\end{pmatrix} \\ &= \begin{pmatrix}0 & 1\\e^{i\theta} & 0\end{pmatrix}\begin{pmatrix}0 & 1\\e^{i\theta} & 0\end{pmatrix} \\ &= \begin{pmatrix}e^{i\theta} & 0\\0 & e^{i\theta}\end{pmatrix} \end{align}$$

So:

def Ph(quantum_circuit, theta, qubit):
    quantum_circuit.u1(theta, qubit)
    quantum_circuit.x(qubit)
    quantum_circuit.u1(theta, qubit)
    quantum_circuit.x(qubit)

implements the $P_h$ gate on Qiskit.

Adrien Suau
  • 5,172
  • 22
  • 58