Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom gate application for Toffoli in default.qubit #1215

Closed
antalszava opened this issue Apr 14, 2021 · 0 comments
Closed

Add a custom gate application for Toffoli in default.qubit #1215

antalszava opened this issue Apr 14, 2021 · 0 comments
Labels
good first issue Good for newcomers

Comments

@antalszava
Copy link
Contributor

antalszava commented Apr 14, 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 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:

  1. In the pennylane/devices/default_qubit.py file, extending the _apply_ops dictionary to contain the "Toffoli": self._apply_toffoli entry,
  2. 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),
  3. Adding a test case for applying the Toffoli gate in devices/test_default_qubit.py.
@antalszava antalszava added the good first issue Good for newcomers label Apr 14, 2021
@co9olguy co9olguy added the unitaryhack Dedicated issue for Unitary Fund open-source hackathon label May 12, 2021
@co9olguy 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
@josh146 josh146 closed this as completed May 12, 2021
@co9olguy 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
@co9olguy co9olguy removed the unitaryhack Dedicated issue for Unitary Fund open-source hackathon label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants