Skip to main content
Functions:

swap_test

swap_test(
state1: QArray[QBit],
state2: QArray[QBit],
test: Output[QBit]
) -> None
[Qmod Classiq-library function] Tests the overlap (in terms of fidelity) of two quantum states. The fidelity of state1 and state2 is calculated from the probability of measuring test qubit in the state 0 as follows: state1state22=2Prob(test=0)1 |\langle state1 | state2 \rangle |^2 = 2*Prob(test=0)-1 Parameters: