Skip to content
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

Add complex Givens rotation #245

Closed
kevinsung opened this issue Jul 10, 2024 · 3 comments · Fixed by #253
Closed

Add complex Givens rotation #245

kevinsung opened this issue Jul 10, 2024 · 3 comments · Fixed by #253

Comments

@kevinsung
Copy link
Contributor

kevinsung commented Jul 10, 2024

Is your feature request related to a problem?

From looking at the documentation, the Givens rotation has only one parameter, theta. I couldn't find the documentation of the gate matrix, but I believe it is

[ c   s ]
[ -s  c ]

where c = cos(theta) and s = sin(theta). In general however, a Givens rotation can be complex with the form

[ c    s ]
[ -s*  c ]

For example, see https://www.cs.cornell.edu/~bindel/papers/2002-toms.pdf.

Describe the solution you'd like

The complex Givens rotation can be accommodated by adding a parameter phi and replacing s with s * e^{i phi}. I don't know if the current gate should be modified, or a new gate added.

Describe alternatives you've considered

A workaround is to use the Givens gate together with two Rz gates. But it's more convenient to have a single gate to represent the concept, and it might enable better performance optimizations (I'm not sure).

Additional context

No response

@jcmgray
Copy link
Owner

jcmgray commented Jul 10, 2024

hi @kevinsung, yes the source is here: https://github.com/jcmgray/quimb/blob/main/quimb/tensor/circuit.py#L787-L806, its a two qubit gate with that first matrix you give on the number conserving subspace - some other info here: https://pennylane.ai/qml/demos/tutorial_givens_rotations/.

Would be very happy to add that phi parameter - would you want to open an PR ?

@kevinsung
Copy link
Contributor Author

Sure, I can open a PR. Should I add it to the existing gate? That would break some APIs, like Circuit.givens, right?

@jcmgray
Copy link
Owner

jcmgray commented Jul 10, 2024

That's true, maybe a new gate method called 'givens2' for the two parameter version is necessary (or some other more appropriate name?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants