3
$\begingroup$

I have tried it with decomposing controlled S then conjugating with H gate. But I want to construct it using a minimum number of gates.

$\endgroup$
4
$\begingroup$

To form a RNOT gate , the basic gate operations HAD and PHASE() can be used.

         ┌───┐┌───────────┐┌───┐ 
        ─┤ H ├┤ U1(-pi/2) ├┤ H ├─ 
         └───┘└───────────┘└───┘ 

Qiskit code

qc.h(reg)
qc.u1(math.radians(-90), reg)
qc.h(reg)
| improve this answer | |
$\endgroup$
2
$\begingroup$

Since the NOT gate from the question is the X gate in IBMQ/Qiskit, hereinafter we will call it only the X gate and, accordingly, the square root of the X gate or SqrtX.

How to construct SqrtX using the minimum number of gates, it depends on your purposes.

If the phase is not important for your purposes (e.g. you just looking for how to split the X gate into 2 equal gates assuming that their squares may differ from X by the global phase), then it may be constructed e.g. as:

 ┌──────────┐
 ┤ RX(pi/2) ├
 └──────────┘

in Qiskit:

qc.rx(np.pi/2, reg)

If the phase is important for your purposes (e.g. in cases as adding control to an unitary gate), then it may be constructed from the previous one by phase shift:

 ┌──────────┐┌───┐┌───────────────────┐
 ┤ RX(pi/2) ├┤ X ├┤ U3(pi,pi/4,5pi/4) ├
 └──────────┘└───┘└───────────────────┘

in Qiskit:

qc.rx(np.pi/2, reg)
qc.x(reg)
qc.u3(np.pi, np.pi/4, 5*np.pi/4, reg)

or like this (without RX):

 ┌────────────────┐┌───┐┌────────────────┐
 ┤ U2(-pi/4,pi/2) ├┤ X ├┤ U3(pi,0,5pi/4) ├
 └────────────────┘└───┘└────────────────┘

in Qiskit:

qc.u2(-np.pi / 4, np.pi / 2, reg)
qc.x(reg)
qc.u3(np.pi, 0, 5 * np.pi / 4, reg)

or as in my edition of the answer. As you see, this circuit is almost same as in the original of the answer but in my edition it uses u1 instead of rz.

The fact is that in many cases, but not all, in IBMQ/Qiskit it is assumed that rz is implemented as u1, although actually rz(ϕ) is different to u1(ϕ) by a global phase exp(-iϕ/2) and this can be significant in cases like adding control to an unitary gate (in the answer you can see an example of the controlled version of this circuit, which would be incorrect if the crz gate were not replaced by the cu1 gate).

Also SqrtX may be constucted by using the Qiskit's power method:

qc.append(XGate().power(1/2), reg)

or by using one of unitary matrices corresponding to the square roots of the X gate:

qc.unitary([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], reg)

or by using Operator:

qc.append(Operator([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]]), reg)

or similarly, using UnitaryGate, squ/iso methods, qasm, etc (but be careful, Qiskit does not always accurately process the phase!).

PS. I already mentioned in another answer about my Qiskit program for small investigating of the various cases of the roots of X and Y, look if you are interested.

| improve this answer | |
$\endgroup$
0
$\begingroup$

Use u3 function and rotate by an angle of 90 degrees.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Hello Aman, could you flesh out your answer a little? For a subject such as quantum computation, where the basics are significantly different from normal computation, to provide a little bit of explanation. $\endgroup$ – Niel de Beaudrap Oct 30 '19 at 10:45

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.