New answers tagged


I have found the solution! The problem is that each time you use the transpile function, it generates a different transpiled circuit and the order of the outcome is not necessary the same as the order of the input, so you have to use swap gates to obtain the correct one. In order to always obtain the same circuit you have to fit the seed_transpiler (as with ...


It seems that such a transformation would not be unitary. Since it drops the information about bit $q_0$ altogether, it would have basis states that differ in that bit transformed into the same state, and that would not be possible to invert.


First you need to undo the QFT applied to $|q_3\rangle$, so you would apply a $H$ gate to $Q(|q_3\rangle)$. $HQ(|q_3\rangle) = |q_3\rangle$ or more generally for an $n$-qbit system $HQ(|q_n\rangle) = |q_n\rangle$ If you then apply the conditional rotation (on $Q(|q_0\rangle)$ conditioned by $|q_3\rangle$) of angle $R_4^{\dagger}$: $ \begin{pmatrix} 1 & ...


There is a known circuit construction Also check this post It uses phase estimation ideas to derive the resulting circuit


The root of the issue here is how do you map between the values $\theta_n$ and $n$. A priori there is no way of doing this because the values $n$ are a completely abstract labelling. It wouldn't make any difference if I rearranged all the labels $n$. So, you have defined the $n$s to be a particular order that you want. Presumably as part of that, you know ...


Existence (as mentioned on Wikipedia, for example), is easy, although not necessarily unique. Any unitary can be written as $$ U=\sum_ie^{i\theta_i}P_i $$ where $P_i$ are projectors such that $\sum_iP_i=1$, and $\theta_i$ is in the range 0 to $2\pi$. Then we have that $$ \sqrt{U}=\sum_ie^{i\theta_i/2}P_i. $$ Giving a circuit construction of the gate is an ...

Top 50 recent answers are included