# 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.

41 questions
Filter by
Sorted by
Tagged with
72 views

### How can I move a C.NOT over a circuit

I am doing some Quantum Computing Exercises and I am curious on how you go from left to right in this picture... I see not only how the c-not moves but also a new bond between X gates in second and ...
588 views

### Can IBM Quantum hardware handle any CSWAP at all?

I am designing quantum algorithms where the quantum circuit uses CSWAP gates a lot. The result is very noisy on the quantum hardwares. So I designed really simple circuits to test whether it is indeed ...
• 221
61 views

### How to compute the measurement probability in the Hadamard test?

In the Hadamard test (e.g., page 40 of these lecture notes) we have: But if you look at standard textbook reference, like Nielsen and Chuang, there's an example for how to compute the measurement ...
37 views

• 559
74 views

### Comparing two sets of qudits

Suppose we are given two sequences of qudits, in some states unknown to us: $(|\psi_1\rangle, ... |\psi_n\rangle)$ and $(|\phi_1\rangle, ... |\phi_n\rangle)$. The qudits are not entangled to each ...
• 847
43 views

### How to obtain the product of the amplitudes of arbitrary basis vectors in a superposition state without measuring?

Suppose there is a superposition state $|{{\Phi }^{+}}\rangle =\sum\limits_{i=0}^{15}{{{\alpha }_{i}}|i\rangle }$, I want to get ${{\alpha }_{i}}\times {{a}_{j}},i\ne j,i,j\in [0,15]$ without ...
• 536
290 views

### Swap test vs measurement in a specific basis

I have two states $|\psi\rangle$ and $|\phi\rangle$. The swap test allows to estimate $|\langle \psi | \phi \rangle|^2$ by using the controlled SWAP gate and a couple of Hadamard gates. To obtain the ...
441 views

• 14.8k
171 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 = \...
• 23
204 views

### In a Swap Test why is the control qubit influenced and aren't the target qubits altered?

I am in a study group learning about quantum computing using O'Reilly - Programming Quantum Computing. I'm a developer, not a physicist. :) I feel like my question is rudimentary but I can't seem to ...
• 123
1 vote
143 views

### Implementing a SWAP-Test for samples with large numbers of features

I am trying to calculate the distance between sets of vectors. To do this I can create a SwapTest circuit (described here on page 34) and encode a feature vector with a U3 gate, then apply H and CSWAP ...
• 333
1k views

### How to implement the swap test with the help of qiskit?

It's creating a real confusion for me especially the parameterized circuit which I have to create. Can anybody please solve this for me? I want to create this circuit.
• 345
5k 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 ...
• 291
843 views

### Distance calculation 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 ...
• 899
852 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 ...
• 364
I'm using the SWAP test circuit for implementing a qubit registers comparison From the documentation I could find I've understood it can be applied to input qubits |$\alpha\rangle$ and |\$\beta\...