-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Simplify controlled gate for SumOfProducts #5873
Simplify controlled gate for SumOfProducts #5873
Conversation
most optimization and inferences were implemented for the vanilla ways (as ints, lists ..etc) of defining control values, those were ported to ProductOfSums, but for SumOfProduct they didn't make sense in most cases, however in this case what you do in the constructor effectivelly transforms SumOfProducts to ProductOfSums representation, looks good to me |
Automerge cancelled: A required status check is not present. Missing statuses: ['Misc check', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage'] |
Co-authored-by: Cirq Bot <craiggidney+github+cirqbot@google.com>
Co-authored-by: Cirq Bot <craiggidney+github+cirqbot@google.com>
Simplify the
SumOfProducts
control value when possible (if there's only a single product in it) when constructing aControlledGate
. This allows theX.controlled() -> CX
optimization when using aSumOfProducts
control value.Add a two-step test to check
X.controlled(num_qubits=2) -> CCX
optimization, and include SumOfProducts check there too.Make use of this simplification where we were hacking it in previously.
Fixes #5883