[WIP] Add phase property to Gate class#3472
Conversation
1a050c7 to
450a08f
Compare
|
Why have phase and phase_angle? Seems like more to keep track of and check. |
@ewinston it only has one internal attribute, the rest are getter/setter over that. |
|
@ajavadia What if |
67934aa to
e3f1dd2
Compare
|
As @ewinston suggested (and several others also requested) removed the non-polar form of phase and renamed |
e3f1dd2 to
8b68dd6
Compare
dbc097c to
035b572
Compare
035b572 to
28122be
Compare
9410589 to
07e4634
Compare
|
@ewinston I rebase to fix conflicts with master, but there are still some issues with controlled gates and failing tests |
There was a problem hiding this comment.
I would like to be able to remove this clause and have the phase case handled by the standard control function without converting to a unitary first.
Change simplify atol to simplify_tolerance
* Added phase to base Gate class * Added phase to base ControlledGate class * Added phase to standard gate extensions
07e4634 to
457d60b
Compare
|
Made a new PR #3930 since only way to clean up history with master was huge squash rebase |
Summary
phaseandphase_angleproperties toGateclass for storing global phaseeto_matrixto return the matrix definition times the phaseDetails and comments
When constructing a gate a
phasecan be set usingphase=thetakwarg.thetawill be stored as a float[-2*pi, 2*pi]in the gate object, representing a complex coefficientexp(i theta)on the matrix definition of the gate.After construction a gate object can have its phase modified using
gate.phase = theta.When calling
to_matrixthe returned matrix will beexp(i theta) * U_defwhereU_defis the matrix definition of the gate.When unrolling any set phase parameter will be passed to one of the gates in the definition so that the unrolled circuit has the same global phase as the original gate.
TODO
Fixes #3304