View on GitHub
Open this notebook in GitHub to run it yourself
Output:
Output:
Swap Test Qmod Implementations
The swap test is defined as a library function in the Qmod language. Verify the results:Comparing Measured with Exact Overlap
Using the expected probability of measuring the state as defined above, we extract the overlap . The exact overlap is computed with the dot product of the two state vectors. Note that for the sake of this demonstration we execute this circuit times to improve the precision of the probability estimate. This is usually not required in actual programs.Output: