In PennyLane, unitary operations specified by a matrix can be implemented in a
quantum circuit using the QubitUnitary operation. QubitUnitary
is a parametrized
gate, and can be called like so:
qml.QubitUnitary(U, wires=wire)
Complete the quantum function below to create a circuit
that applies U
to the qubit and returns its state. (Compare this to the
earlier function apply_u
that you wrote before - isn't it nice to not have to
worry about the matrix arithmetic?)
To interact with codercises, please switch to a larger screen size.
Learning Objectives: