Fixing time parameter support for some gates #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a result of finding a bug in #19 where some gates would disregard the
time
argument during theb.add_gate
, I made some changes to the code:In
qsoverlay/gate_functions.py
, the functionsX_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 tocircuit_builder.__lt__
.In
qsoverlay/circuit_builder.py
, inBuilder.__lt__
, I modified the conditions which verified thelen(gate_desc)
, in order to make them support the usage of thetime
AND/ORreturn_flag
. It however assumes that, if both flags are used,time
should precedereturn_flags
.These changes should fix the bugs during the construction of
circuit_builder
circuits via theadd_gate
method. It is still necessary to add time support to other places whereBuilder.__lt__
is called. In the meantime, the changes I made shouldn't cause any conflict with those, however.Regards,
Diogo Valada