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

Fixing time parameter support for some gates #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Astlaan
Copy link

@Astlaan Astlaan commented Nov 24, 2019

As a result of finding a bug in #19 where some gates would disregard the time argument during the b.add_gate, I made some changes to the code:

In qsoverlay/gate_functions.py, the functions X_gate, Y_gate, Z_gate, had_from_rot, CNOT_from_CZ, CRX_from_CZ failed to use the time parameter in a meaningful manner. I added the parameter to the tuple passed to circuit_builder.__lt__.

In qsoverlay/circuit_builder.py , in Builder.__lt__, I modified the conditions which verified the len(gate_desc), in order to make them support the usage of the time AND/OR return_flag. It however assumes that, if both flags are used, time should precede return_flags.

These changes should fix the bugs during the construction of circuit_builder circuits via the add_gate method. It is still necessary to add time support to other places where Builder.__lt__ is called. In the meantime, the changes I made shouldn't cause any conflict with those, however.

Regards,
Diogo Valada

Modified the conditions which check len(gate_desc) in order to support gate_desc with 'time' and or 'return_flag'
Added the extra time parameter in the (X_gate, Y_gate, Z_gate, had_from_rot, CNOT_from_CZ, CRX_from_CZ) functions during the 'builder < ' call, so that the these gates are created with the correct time tag. (circuit_builder.__lt__ was modified in the previous commit to allow for this.
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.

1 participant