-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 ControlledGate class #2862
add ControlledGate class #2862
Conversation
b30ea21
to
cfaff92
Compare
I am working on an optimization pass which makes use of this new controlled gate class and I noticed the following feature is missing which would be quite useful for the optimizer (and maybe in general too):
Two other things I noticed:
|
updated standard gates to return controlled version if it is also in the standard set.
minor commit added "controlled_ops" parameter gate rules of gate before applying controls. pass controlled gate tests changing to recursive control broken point
passing mu1 and mu3 tests working...confusing num_ctrl_qubits linting fix indentation error fix circular import for python 3.5 and 3.6. more import fixes put aqua q_if back in, linting minor commit minor commit linting another attempt to fix circular import across all pltforms. disable cyclic-import pylint check another attempt to remove cyclic import This also eliminates defining q_if in standard extension gates. forgot to add module add_control.py fix style method from qi
todo: convert the gates to ControlledGates linting style simplify some tests minor fix
todo: convert the gates to ControlledGates linting style simplify some tests minor fix Co-authored-by: Shaohan Hu <shaohan.hu@ibm.com> Co-authored-by: Manoel Marques <manoel@us.ibm.com> Co-authored-by: Albert Frisch <alfr@de.ibm.com>
Hi @dime10, |
This adds "base_gate" as class attribute of ControlledGate which is a class reference.
Also remove some unused imports in test_controlled_gate.py.
* added ControlledGate class updated standard gates to return controlled version if it is also in the standard set. * added assertions to some tests. minor commit added "controlled_ops" parameter gate rules of gate before applying controls. pass controlled gate tests changing to recursive control broken point * added dmitri based decomposition from aqua passing mu1 and mu3 tests working...confusing num_ctrl_qubits linting fix indentation error fix circular import for python 3.5 and 3.6. more import fixes put aqua q_if back in, linting minor commit minor commit linting another attempt to fix circular import across all pltforms. disable cyclic-import pylint check another attempt to remove cyclic import This also eliminates defining q_if in standard extension gates. forgot to add module add_control.py fix style method from qi * copied multi controlled gates from aqua todo: convert the gates to ControlledGates linting style simplify some tests minor fix * simplify code. catch rotation gates to avoid decomposition. * copied multi controlled gates from aqua todo: convert the gates to ControlledGates linting style simplify some tests minor fix Co-authored-by: Shaohan Hu <shaohan.hu@ibm.com> Co-authored-by: Manoel Marques <manoel@us.ibm.com> Co-authored-by: Albert Frisch <alfr@de.ibm.com> * simplify code. catch rotation gates to avoid decomposition. * add reference to base controlled gate This adds "base_gate" as class attribute of ControlledGate which is a class reference. * add some tests. fix imports * remove pdb * linting * add `to_gate` method to Instruction. * lint * linting * linting * add test for instruction_to_gate * add phase argument when computing control matrix * linting
…3465) * added release notes for controlled gate class (Qiskit#2862). Also remove some unused imports in test_controlled_gate.py. * remove pylint disable * remove one more unused import * change q_if to control in expectation of pr Qiskit#3455 * update release notes include imports in release notes.
Fixes #544, Fixes #2804
Summary
Adds a ControlledGate class inheriting from the Gate class. Also, adds a method
q_if
to the Gate class which returns a ControlledGate instance.addresses part of issue #2804
Details and comments