To implement the behaviour of an oracle, the
This method is called the phase kickback trick, since the phase is "kicked back" to the query register. Here is a picture of the implementation of
(Recall that white dots indicate the control bit is "0" and black dots "1". The combination here is simply meant to illustrate an arbitrary control string.)
Define the oracle operator MultiControlledX
gate from PennyLane.
Tip. MultiControlledX(control_wires, wires, control_values)
has a specified set of control_wires
, a single target wire given by wires
, and a string of control values, e.g., control_values = "1011"
rather than a list of bits [1,0,1,1]
.
To interact with codercises, please switch to a larger screen size.
Learning Objectives: