We can measure the similarity between two quantum states using the fidelity. Given two states
This expression becomes much simpler if we have pure states involved. Consider two pure states
In other words, the fidelity between two pure states is equivalent to their inner product, which is super easy to compute!
Fill in the code to calculate the fidelity between two pure states.
You may find the functions np.inner
and np.abs
quite useful!
To interact with codercises, please switch to a larger screen size.
Learning Objectives: