I'm using the SWAP test circuit for implementing a qubit registers comparison enter image description here

From the documentation I could find I've understood it can be applied to input qubits |$\alpha\rangle$ and |$\beta\rangle$ of the same size.

Is that really a constraint? Or it can be also applied to general cases of qubits of different size?


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 other qtrit), then the extra degrees of freedom of the qtrit would not take part in the algorithm governed by the Hamiltonian which mimics the SWAP gate.


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.

  • 4
    $\begingroup$ or even more simply, the SWAP operation does not make sense if they have different sizes $\endgroup$ – glS Feb 8 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.