-
Notifications
You must be signed in to change notification settings - Fork 14
implemented perform_y #8
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
base: master
Are you sure you want to change the base?
Conversation
added 2 new colors to handle the complex phase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only come minor comments.
I will be out until the end of July so unfortunately I won't be able to review more of your code until August. Feel free to make more PRs for when I'm back.
@@ -4,7 +4,7 @@ | |||
from sympy.printing.latex import latex | |||
import drawSvg as draw | |||
import latextools | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do this. Just use pi from import math
.
feynman_path/diagram.py
Outdated
self.straight_arrow(g, color, xx1, yy1, xx2, yy2, width=w) | ||
|
||
def wheel_color(self,amp): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this is enough colors for when you do Ry? Alternatively, use some continuous color map like HSV where hue is controlled by the phase (i.e. drawSvg.color.Hsv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I was planning to update to a more continuous map later on when implementing the R* gates. I ll check the HSV
new_state[new_key] = 0 | ||
new_state[new_key] += new_amp | ||
self.transition_text(self.d, t, f'{pre_latex}{name}_{{{q_i}}}') | ||
self.add_states(new_state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. If you intend to add many more gates, can you refactor the perform_* methods to avoid the code copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. Shall I make a perform_gate class? Or do you have something better in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be as simple as a dictionary with symbolic gate unitaries (at least for single-qubit gates: {'X': [[0,1],[1,0]], ...}
). A perform-gate class may just add more boilerplate code.
Co-authored-by: Casey Duckering <[email protected]>
also command accept floats and add simplify to amplitudes. In case the amplitude is too complicated return the value in digits
…an_path into support_Ry_gates
I made the following changes:
|
where you can follow the sign through the color of the lines
This is the first step in solving #7 implementing Ry gates (and possibly Rx,Rz)
Also added 2 new colors to handle the complex phase.