6
$\begingroup$

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$$

$\endgroup$
  • 3
    $\begingroup$ Why would you want to? Such a phase is a global phase, and therefore irrelevant to further computation. $\endgroup$ – DaftWullie Jun 26 '18 at 17:21
9
$\begingroup$

You can implement the phase shift gate $$R_{zz}(\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} R_{zz}(\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 Rzz(quantum_circuit, theta, qubit):
    quantum_circuit.u1(theta, qubit)
    quantum_circuit.x(qubit)
    quantum_circuit.u1(theta, qubit)
    quantum_circuit.x(qubit)

implements the $R_{zz}$ gate on QISKit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.