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

CNOT gate decomposition should be implemented #1421

Open
1 of 3 tasks
csookim opened this issue Aug 19, 2024 · 3 comments
Open
1 of 3 tasks

CNOT gate decomposition should be implemented #1421

csookim opened this issue Aug 19, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@csookim
Copy link
Member

csookim commented Aug 19, 2024

@sorewachigauyo Paul mentioned that an unroller is needed to decompose the circuit using CNOT, GPI2, RZ, Z, and M. To achieve this, CNOT should be included as a native gate.

Here are the tasks to consider:

  • Add CNOT as an attribute of NativeGates.
  • Implement cnot_dec in decompositions.py.
  • Modify the logic of _translate_two_qubit_gates() in unroller.py.

I believe cnot_dec can be implemented based on the existing cz_dec.

@csookim csookim added the enhancement New feature or request label Aug 19, 2024
@alecandido
Copy link
Member

alecandido commented Aug 19, 2024

Pay attention: often CZ, iSWAP, and CNOT are alternative to each other.

_translate_two_qubit_gates() is now hard-coding that the interactions are only carried on by CZ and iSWAP

if (
native_gates & (NativeGates.CZ | NativeGates.iSWAP)
) is NativeGates.CZ | NativeGates.iSWAP:

and this is for sure not sufficient.

But it is not even that modular: it would be better to label interacting gates where they are defined (i.e. in the NativeGates class, by using non-trivial values), and then associate different actions (so, functions) to the specified set of interacting gates.
If you can make such that a single unroller can work for all the possible native two-qubit gates combinations, so much the better (the amount of combinations explodes as a power set, though it's unlikely to have much more than these three gates in the short term - but that was also the reasoning behind hard-coding the previous two).

@csookim
Copy link
Member Author

csookim commented Aug 19, 2024

@alecandido Thank you for your reply. Since CNOT is needed for the upcoming chip test at CQT, I made minimal updates to enable using CNOT as a native gate for a simple circuit consisting of CZ, CNOT, SWAP, and 1q gates. Is this ok for the new PR?

@alecandido
Copy link
Member

@alecandido Thank you for your reply. Since CNOT is needed for the upcoming chip test at CQT, I made minimal updates to enable using CNOT as a native gate for a simple circuit consisting of CZ, CNOT, SWAP, and 1q gates. Is this ok for the new PR?

If you need that urgently, for sure :)

However, we should schedule some time also for taking proper care of the unroller. If not immediately, whenever we can.

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

No branches or pull requests

2 participants