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 MultiCNOT gate. #120

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

SolidTux
Copy link

@SolidTux SolidTux commented Nov 8, 2021

This adds a NOT gate with multiple controls. I also added the corresponding things to the qasm backend.

A conversion to a circuit is only implemented for 2 (which is of course redundant as CNOT exists) and 3. Maybe a dedicated CCNOT gate would be better, but I was not sure how to make that fit into the trait structure.

In general it would be great to make writing custom gates outside of this crate (at least for Rust code) and have Circuit return Vec<Box<dyn Operate>> or something similar instead of Vec<Operation>. But I don't know how that works on the Python side (and also how interoperation between two Python libraries with Rust backends works).

@nfwvogt
Copy link
Collaborator

nfwvogt commented Nov 9, 2021

Hello and welcome @SolidTux

Thank you very much for your interest in qoqo and for your contribution! Before we can proceed to review the pull request and merge it we want to point out that like qiskit and cirq we only merge contributions covered by a contributor license agreement (CLA). The details of the CLA can be found in the CONTRIBUTE.md and CLA.pdf files in the repository.
If you are happy to contribute your code changes under the CLA, please send a filled out copy of the CLA.pdf to info@quantumsimulations.de and we can proceed to work on your pull request together.

Kind regards
The HQS qoqo team

@SolidTux
Copy link
Author

Did you get the mail?

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2021

Codecov Report

Merging #120 (daaf49b) into main (566bfa8) will decrease coverage by 0.83%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #120      +/-   ##
==========================================
- Coverage   84.87%   84.04%   -0.84%     
==========================================
  Files          33       33              
  Lines        4753     4800      +47     
==========================================
  Hits         4034     4034              
- Misses        719      766      +47     
Flag Coverage Δ
unittests 84.04% <0.00%> (-0.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
qoqo/src/operations/mod.rs 0.00% <0.00%> (ø)
qoqo/src/operations/multi_qubit_gate_operations.rs 0.00% <0.00%> (ø)
...qoqo/src/operations/multi_qubit_gate_operations.rs 44.57% <0.00%> (-52.80%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 566bfa8...daaf49b. Read the comment docs.

@nfwvogt
Copy link
Collaborator

nfwvogt commented Nov 18, 2021

Yes we did get it. Sorry for the delayed response, it's the usual end of the year rush. The changes look good to me, however we aim to keep the unittest coverage of qoqo/roqoqo high so before merging we would want to have additional unittests for the new operation.

If you want to implement them, they should mostly look like the unittests for the MolmerSorensenXX operation in roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs. And if you have any questions about the tests feel free to ask here.

Kind regards
The HQS qoqo team

@SolidTux
Copy link
Author

Sorry for the delayed response, it's the usual end of the year rush.

No worries!

If you want to implement them, they should mostly look like the unittests for the MolmerSorensenXX operation in roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs.

I'll do that and add a commit. I just wanted to have some feedback on the interface first.

@gsilviHQS
Copy link

Hello @SolidTux,
sorry again for the delay. I ll start taking a look at your submission and do the various checks needed to everything implemented works correctly.
Kind regards
The HQS qoqo team

@SolidTux
Copy link
Author

No worries, let me know if you need anything from me!

@gsilviHQS
Copy link

Hello @SolidTux ,
we checked the code submitted and it looks indeed all correct! Both the direct implementation and the tests.
We notice that the tests are only implemented for the roqoqo part; would you be interested in extending them to also the qoqo/python interface?
We can also provide assistance with that.
Let us know if this might interest you.
Kind regards,
The HQS qoqo team

@SolidTux
Copy link
Author

Sorry for the long delay! I will try to add the tests for the Python part. But currently I get linking errors from pyO3, I'll try to debug them first.

@gsilviHQS
Copy link

Hello @SolidTux,
no worries, in case you might need some help feel free to contact us!
Best regards,
The HQS qoqo team

@SolidTux
Copy link
Author

Thanks to Kirsten I can now run the Python part. I added some tests to qoqo, let me know if you need anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants