In PennyLane, CNOTs can be applied using qml.CNOT
and the following syntax:
def circuit(): qml.CNOT(wires=[control, target])
where control
and target
are the wire labels (e.g., qml.CNOT(wires=[0, 1])
).
Write a circuit that implements a
|
|
---|---|
|
|
|
|
|
|
|
|
As an explicit example, the truth table of
|
|
---|---|
|
|
|
|
To interact with codercises, please switch to a larger screen size.
Learning Objectives: