You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DefaultQubit uses a custom implementation for certain gates. These gates are contained in the _apply_ops dictionary of the device. As an example, to perform a PauliX bit flip, default.qubit calls the np.roll function on the state vector.
We would like to add a custom gate definition for the Toffoli gate. This will be similar to how the custom application of PauliX and CNOT is being done.
Sketch for the steps of the addition:
In the pennylane/devices/default_qubit.py file, extending the _apply_ops dictionary to contain the "Toffoli": self._apply_toffoli entry,
Defining the _apply_toffoli method for DefaultQubit in the same file (the example of CNOT can help, good point of reference is the _apply_cnot function),
Adding a test case for applying the Toffoli gate in devices/test_default_qubit.py.
The text was updated successfully, but these errors were encountered:
co9olguy
changed the title
Add a custom gate application for Toffoli in default.qubit
[unitaryhack] Add a custom gate application for Toffoli in default.qubit
May 12, 2021
co9olguy
changed the title
[unitaryhack] Add a custom gate application for Toffoli in default.qubit
Add a custom gate application for Toffoli in default.qubit
May 12, 2021
DefaultQubit
uses a custom implementation for certain gates. These gates are contained in the_apply_ops
dictionary of the device. As an example, to perform a PauliX bit flip,default.qubit
calls thenp.roll
function on the state vector.We would like to add a custom gate definition for the Toffoli gate. This will be similar to how the custom application of
PauliX
andCNOT
is being done.Sketch for the steps of the addition:
pennylane/devices/default_qubit.py
file, extending the_apply_ops
dictionary to contain the"Toffoli": self._apply_toffoli
entry,_apply_toffoli
method forDefaultQubit
in the same file (the example ofCNOT
can help, good point of reference is the_apply_cnot
function),devices/test_default_qubit.py
.The text was updated successfully, but these errors were encountered: