I already know how to do that for Z, Y, and H gates. How can I make a controlled sqrt-of-NOT gate? I mean the controlled version of the gate described here.
-
1$\begingroup$ Hi @Fernando! I flagged your question as a duplicate of quantumcomputing.stackexchange.com/questions/5058/… where you will be able to find the $\sqrt{X}$ gate as $G$. The question I linked is hard to find by searching for the implementation of a "square root of not" gate, I will change the question to make it clearer. $\endgroup$– Adrien SuauSep 20, 2019 at 13:01
-
$\begingroup$ Hi Nelimee, what I need is the controlled version of G. $\endgroup$– FernandoSep 20, 2019 at 18:12
-
$\begingroup$ Oops you are right, I am sorry! $\endgroup$– Adrien SuauSep 21, 2019 at 9:29
3 Answers
Here's one decomposition:
It was made by decomposing a controlled S (which is easier to think about because it only phases; it's diagonal) and then converting the basis of the target by conjugating with Hadamards.
It generalizes in-place to any $\text{CNOT}^{2t}$:
I cannot add a comment, but I have a little question to the answer, sorry.
Why exactly $-\pi/2$ (with minus) is a parameter of the cU1 gate in your circuit? Isn't e.g. $\pi/2$ (without minus) appropriate?
-
2$\begingroup$ Yes, π/2 (without minus) is appropriate. With this parameter it get another square root of NOT (or X). These roots are the inverse of each other. For hermitian gates such as X, both inverse roots are fine (actually 4 roots, but the remaining 2 differ slightly from these by a common factor of -1). All this also applies to controlled versions of such roots, see e.g. the question in which this is generalized. $\endgroup$ Aug 5, 2020 at 15:05
-
2$\begingroup$ In new version of qelib1.inc there is a new function (subroutine) like the decomposition of the Controlled-SqrtX gate given in my answer but with your π/2 (without minus):
// controlled-sqrt(X) gate csx a,b { h b; cu1(pi/2) a,b; h b; }
$\endgroup$ Aug 20, 2020 at 4:08
If take e.g. this decomposition of the square root of NOT then it's so simple in the IBM Q composer:
And although it is unlikely that this circuit form actually consists of 3 elementary gates (I think the cu1 gate is implemented using 5 elementary ones), in my opinion, it looks just easier than others e.g. from here:
You can also use functions (subroutines) in the composer (like as csx
from qelib1.inc), but unfortunately they do not work well any time or work with restrictions.