feynman_path
feynman_path copied to clipboard
Support for complex gates?
Hi, this code is really a great idea, but I was just wondering why there are not R_y gate for example? Is it to avoid having to deal with complex phases? If there is no intrinsic limit to add those gates I might give it a try and them as well.
There is no Ry gate yet because I didn't need it. Please do give a try implementing it though.
I would make the gate format ry<qubit>,<half_turns>
e.g. ry2,0.25
is a pi/4 rotation on q2.
You'll need to implement perform_ry
, similar to perform_h
: https://github.com/cduck/feynman_path/blob/bb144e610f0d182dc9909a5eae432bc410660329/feynman_path/diagram.py#L198
def perform_ry(self, q_i, half_turns, *, pre_latex=f'', name='Ry'):
Also, this line will need to be changed to detect decimal numbers, not just integers: https://github.com/cduck/feynman_path/blob/bb144e610f0d182dc9909a5eae432bc410660329/feynman_path/command.py#L10
Alright, I ll give it a try. I notice that actually also the simple perform_y is missing. I ll start from that one. If you have suggestions let me know.