# Questions tagged [swap-test]

For questions related to the "Swap test": a quantum algorithm whose purpose is to quantify the distance between two given quantum states.

10 questions
Filter by
Sorted by
Tagged with
2k views

### How and why does swap test works?

I am having some trouble understanding why a SWAP test would work. I meant I read that and understood the concepts as follows: If the two input states are equal, the output register always results in ...
322 views

### Distance calcluation between two vectors

In Quantum Machine Learning for data scientists, Page 34 gives an algorithm to calculate the distance between two classifical vectors. As mentioned in this question, it is not clear how the SwapTest ...
489 views

512 views

### Swap Test for vector difference - how are different sized inputs combined?

I'm working on a similar problem of that raised by Aman in Inner product of quantum states Concerning the use of Swap Test for calculating the difference of two vectors. An example of the original ...
66 views

### In the swap test, how is the final probability $P(0)$ calculated?

Does anyone know much about quantum dot product: Lets say: $$|\psi \rangle = \frac{|0\rangle_1|\overrightarrow{x_i}\rangle_2 + |1\rangle_1|\overrightarrow{x_j}\rangle_2}{\sqrt 2}$$ |\phi \rangle = \...
36 views

### Amplitude encoding: distinction between negative and positive real values

I want to encode two vectors into qubits and compute a distance between them that corresponds/is proportional to the euclidian distance of the real vectors. The encoding I use is A) qiskit ...
70 views

### How do you test a pair of unknown qubits for orthogonality with certainty?

If you want to check if a pair of unknown qubits are the same, a standard test is the controlled SWAP test. This gives a result of 0 with certainty if the states are the same and 1 with a 50% chance ...