8

What that cSWAP test does (and doesn't) do The important thing about the controlled-SWAP test is that what it does isn't just to SWAP, or to not SWAP, the two inputs. The controlled-SWAP test involves a control qubit which is in a superposition of $\def\ket#1{\lvert#1\rangle}\def\bra#1{\langle#1\rvert}\ket{0}$ and $\ket{1}$: that is, we measure the first ...


7

You are not swapping the first register (one qubit) with the entire second register ($k$ qubits), but just with the first qubit of the second register. What you need to know is what is meant by $\langle x | y \rangle$ when $x$ is one qubit and $y$ is $k$ qubits. The resulting state is the $k-1$ qubit state you get when you project one qubit (generally the ...


7

The key to understanding many quantum protocols and circuits is in the following circuit: This is especially true in the case where $U^2=I$, such that $U$ has eigenvalues $\pm1$. You can readily calculate that if the input, $|\psi\rangle$, of the second qubit has an amplitude $\alpha_+$ for being supported on the $+1$ eigenspace, then at the end of the ...


6

Yes they should be the same size. Otherwise, if you use it for getting the inner product between them, it would not make sense they aren't.


5

Thanks for the answers from @forky40. I accept it as the right answer, but do want to provide a complete derivation as follows. (Same as in the original question) First, initialize per DistCalc: $$ |\psi\rangle = \frac{1}{\sqrt{2}} (|0,a\rangle + |1,b\rangle) $$ $$ |\phi\rangle = \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$ Also let: $$ |\psi'\...


3

The problem is that you applied a Swap gate when you should have applied a CSWAP, and so you never entangled the readout qubit with your query states (as a result the readout qubit will always return a "0", which makes sense because the net effect of $HH|0\rangle$ is $I|0\rangle$). Continuing your derivation starting from just after the first Hadamard, we ...


3

The paper you refer is incomplete and not very right on this part. First a minus sign should be present in : $$ |\phi\rangle = \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$ Secondly, if you look at the original reference of this procedure on a special case of algorithm but it can be generalized, what you swap is actually the ancilla qubit of $ |\psi\...


3

Qubits can be only with a size of 2, which means a dimensionality of 2. For $|\alpha \rangle,|\beta\rangle$ here, for the SWAP gate to make sense, they must be of the same dimensionality (in the operating Hilbert space), then only there is a meaningful correspondence for the SWAP to work. In case if it happens that they are not (suppose one qubit and ...


3

I doubt that this is possible. Given a state $|\phi\rangle$, we have no method for distinguishing it from $e^{i\varphi}|\phi\rangle$ for any phase $\varphi$. This means that we have no way of distinguishing between $$\langle\psi|\phi\rangle\qquad \mathrm{vs.}\qquad e^{i\varphi}\langle\psi|\phi\rangle.$$ Specifically, we can choose $\varphi$ such that $$e^{i\...


3

Note that \begin{align}|\psi \rangle &= \frac {1}{2}(| 0 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 1 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 0 \rangle_1|\phi \rangle_2|\psi \rangle_3 - | 1 \rangle_1|\phi \rangle_2|\psi \rangle_3) \\ &= \dfrac{1}{2} |0\rangle \bigg( |\psi\rangle_2 |\phi \rangle_3 + |\phi\rangle_2 |\psi\rangle_3 \bigg) + \dfrac{...


1

As you've noticed, global phase is a problem here. One option that you could pursue (I'm not claiming it's a good option) is to use a two-qubit encoding. Let's say you want to encode a vector $u\in\mathbb{C}^2$ (you asked about real, which is obviously a simplifying case) $$ u=\left[\begin{array}{c} ae^{i\theta_1} \\ be^{i\theta_2} \end{array}\right] $$ ...


1

It is not possible for a measurement to deterministically give one outcome or the other depending on whether two states are equal or orthogonal. Such a measurement would be some two-outcome POVM $\mu$ such that $$\langle\mu(\text{yes}),\rho\otimes\rho\rangle=1, \qquad \langle\mu(\text{no}),\rho\otimes\sigma\rangle=1,$$ for all states $\rho$ and $\sigma$ with ...


1

Deciding which qubit is a source and which is a target and changes depends on a basis. In a basis-independent sense, the qubits get entangled, and it affects both sides. In a swap test you apply Hadamard gate to the control qubit which can be interpreted as a change of basis, and subsequent CSWAP gate changes the control qubit


Only top voted, non community-wiki answers of a minimum length are eligible