New answers tagged

1

@Durd3nT answered the question nicely. But here is another way to see it, and hopefully it will be useful for future purposes... All you need to know is the identity $X = HZH$. Then now you can see that $CNOT (CX)$ can be rewritten as $$ CX = \big( I \otimes H \big) CZ \big( I \otimes H \big) $$ This is because when the controlled-qubit is in the state $|0\...


3

You can check that the following is equal to a CNOT gate The first Hadamard gate rotates $q_1$ to the $X$-basis. In that basis, the $Z$-gate acts like a bit flip (the same way the $X$-gate acts in the $Z$-basis). The second Hadamard rotates $q_1$ back to $Z$-basis.


6

You can use a single step of amplitude amplification, with a less-than-N oracle, to get to a uniform distribution. Example Quirk Circuit Source: https://arxiv.org/abs/1805.03662


5

Suppose $\langle\phi|\psi\rangle = re^{i\theta}$. As you have noticed, if we have access to multiple copies of the state, then we can measure $r$ using the SWAP test. Now, consider the state $|\psi'\rangle = e^{-i\theta}|\psi\rangle$ and note that $$ \langle\phi|\psi'\rangle = e^{-i\theta}\langle\phi|\psi\rangle = e^{-i\theta}re^{i\theta} = r. $$ Since $|\...


1

Have a look at this article https://qibo.readthedocs.io/en/stable/tutorials/hash-grover/README.html - seems like it's exactly what you are looking for.


5

You can specify the target basis for instance using transpile: from qiskit import transpile target_basis = ['rx', 'ry', 'rz', 'h', 'cx'] decomposed = transpile(circuit, basis_gates=target_basis, optimization_level=0) # 0 for no optimization, 3 is max Note that the target basis should be complete (e.g. rz h ...


Top 50 recent answers are included