For learning purposes I would like to hand-craft my own circuit for the fourth-root of $X$, using $S$, $T$, and $\sqrt X$ gates.
Note that $\sqrt[4]X$ is of order four, and will need two ancillas to temporarily store the eigenspace. The recipe that I have been following is to:
- Hit both ancilla with an $H$,
- Have the lower-order ancilla perform a controlled $\sqrt X$ on the target with the higher-order ancilla perform a controlled $X$ on the target,
- Perform a QFT on the ancillas,
- Phase the ancillas,
- Perform an IQFT on the ancillas,
- Have the higher-order ancilla perform another controlled $X$ while the lower-order ancilla performs a controlled $X^{-1/2}$, and
- Hit both ancillas with an $H$ to revert:
I try the above circuit in Quirk; although the ancillas properly revert $|0\rangle$, it gives me a different answer on the target than Quirk's native $\sqrt[4] X$. On the Bloch sphere my recipe says the target's $\theta$ is $135^\circ$ while the native $\sqrt[4] X$ should be at $45^\circ$.
Did I get my endian-convention wrong on the QFT (red)? Or did I do the uncomputing wrong? Did I not phase properly (purple)?
Here's a Quirk snapshot to compare. The hand-crafted circuit is on the first three qubits with the ancilla the first two qubits and the target the third qubit, while the native $\sqrt[4] X$ for comparison is the fourth qubit. The Bloch spheres/amplitudes are different between the third qubit (my circuit) and Quirk's native circuit: