Simulating Measurement in Python
In this lesson, we look at measuring qubits and reading the results of our quantum computations.
We'll cover the following
In this chapter, we started by creating quantum states and gates in NumPy. We then put those together and saw how one could apply gates to single and multi-qubit systems. Finally, in this lesson, we shall complete this computation puzzle and measure the state of our quantum system.
Measurement under the hood
Recall that measurement takes qubits to the computational basis states and . Intuitively, this meant that we were transferring information of the qubit state in a classical register whose value we could read. Mathematically, this process is defined as taking the inner product of an arbitrary state with the conjugate transpose of the , which is the state we want to measure in:
This operation is easily implemented in NumPy. The code below shows the probability of measuring state in the state .
Get hands-on with 1400+ tech skills courses.