quantumsim / qsoverlay

An overlay for the quantumsim package developed by Brian Tarasinski (https://github.com/brianzi/quantumsim)
GNU General Public License v3.0
2 stars 4 forks source link

Fixing time parameter support for some gates #20

Open Astlaan opened 4 years ago

Astlaan commented 4 years ago

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