7
$\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
10
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I'm wondering if $Ph(\theta)$ would be a better name for this based on "Elementary gates for quantum computation" 1995 paper from Barenco et al. $R_{zz}$ seems to be used for a two-qubit ZZ rotation. $\endgroup$ – Balint Pato Jun 28 at 17:10
  • $\begingroup$ For me, $Ph(\theta)$ stands for $\begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$. Moreover, I named this gate $R_{zz}$ because I have already seen this notation somewhere. I don't have references right now though, and you might be right. I'll check when possible. $\endgroup$ – Nelimee Jun 28 at 17:57
  • $\begingroup$ I see, please link the paper that uses it. $\begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$ in my knowledge is $R_z(\theta)$ $\endgroup$ – Balint Pato Jun 29 at 20:27
  • $\begingroup$ My sources are from a closed-source library, which is clearly not the best source I agree. I didn't search extensively in papers yet. After thinking about it, I think you are right, $Ph$ is probably a better name even though it is not the one I am used to. Let me edit, and thank you for the remark! $\endgroup$ – Nelimee Jul 2 at 12:21

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.