So far, we've learned that the different outcome probabilities are related to the amplitudes of a qubit's state vector. If no measurement basis is specified, you can generally assume that measurement is done in the computational basis; this is the default in PennyLane.
Outcome probabilities of the basis states can be returned directly in PennyLane. Rather than putting
return qml.state()
at the end of our QNodes, we can swap it out for
return qml.probs(wires=...)
Note that we must explicitly specify the wire labels of the qubits we would like to measure.
For this codercise, you will be asked to write a simple circuit that applies a Hadamard gate to either
To interact with codercises, please switch to a larger screen size.
Learning Objectives: