feynman_path icon indicating copy to clipboard operation
feynman_path copied to clipboard

Support for complex gates?

Open gsilviHQS opened this issue 2 years ago • 2 comments

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.

gsilviHQS avatar Jul 04 '22 11:07 gsilviHQS

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

cduck avatar Jul 04 '22 21:07 cduck

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.

gsilviHQS avatar Jul 05 '22 07:07 gsilviHQS