Skip to content

Simplified implementation of gate modifiers #64

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

Merged
merged 27 commits into from
Sep 25, 2023

Conversation

jcjaskula-aws
Copy link
Collaborator

@jcjaskula-aws jcjaskula-aws commented Aug 21, 2023

OQPyGateModifier (#61) is problably unnecessary complex. This PR keeps only the argument method.

Adds 4 keyword arguments to gate:

  • controls
  • neg_controls
  • inv
  • exp

@jcjaskula-aws jcjaskula-aws marked this pull request as ready for review August 21, 2023 15:18
@jcjaskula-aws jcjaskula-aws changed the base branch from jcjaskula-aws/add_gate_modifiers to main August 21, 2023 18:54
Copy link
Collaborator

@PhilReinhold PhilReinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question and one suggestion, but otherwise looks good.

qreg[6],
"rz1",
control=[qreg[2], qreg[4], qreg[5]],
neg_control=[qreg[0], qreg[1], qreg[0]],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to allow repetition here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a byproduct of using sets. I just want to test here that controlling twice on the same qubit outputs an OQ code with a single ctrl modifier. I prefer this behavior, which allows users to pass overlapping qubit lists like
prog.gate(0, control=[*[i for i in qubits if i %2], *[i for i in qubits if i % 3]]) and still get a nice-looking output.

@PhilReinhold PhilReinhold merged commit 4bb47dd into main Sep 25, 2023
@jcjaskula-aws jcjaskula-aws deleted the jcjaskula-aws/add_gate_modifiers_second_method branch September 27, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants