-
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
Minor fixes for new adder and multiplier gates classes #13530
Conversation
Added define method to HalfAdder, FullAdder, and ModularAdder classes to allow constructing Operators from quantum circuits containing such adder gates. Fixing plugins related to adder_ripple_v95, the plugins can be used only if n-1 clean ancillas are available. Improved the default adder plugins to choose the best decomposition based on the number of state qubits and the number of ancilla qubits.
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 12293335092Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@Cryoris should we include this for 1.3.1? If so, could you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two tiny comments on the test/reno, but the fix LGTM 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for the updates!
* Fixes to AdderGate classes Added define method to HalfAdder, FullAdder, and ModularAdder classes to allow constructing Operators from quantum circuits containing such adder gates. Fixing plugins related to adder_ripple_v95, the plugins can be used only if n-1 clean ancillas are available. Improved the default adder plugins to choose the best decomposition based on the number of state qubits and the number of ancilla qubits. * Adding tests for the case that adder plugins do not apply * Constructing Operators from circuits with MultiplierGates * release notes * docstring fix * apply suggestions from code review * futher improving tests based on additional review comments (cherry picked from commit b9ea266)
* Fixes to AdderGate classes Added define method to HalfAdder, FullAdder, and ModularAdder classes to allow constructing Operators from quantum circuits containing such adder gates. Fixing plugins related to adder_ripple_v95, the plugins can be used only if n-1 clean ancillas are available. Improved the default adder plugins to choose the best decomposition based on the number of state qubits and the number of ancilla qubits. * Adding tests for the case that adder plugins do not apply * Constructing Operators from circuits with MultiplierGates * release notes * docstring fix * apply suggestions from code review * futher improving tests based on additional review comments (cherry picked from commit b9ea266) Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Summary
This PR adds several fixes and improvements for the new adder and multiplier gate classes
FullAdderGate
,HalfAdderGate
,ModularAdderGate
andMultiplierGate
.First, it adds the
_define
method to each of these classes, populatingself.definition
with some default decomposition of the gate that does not use any ancilla qubits and in particular allows to constructOperator
s from quantum circuits containing these gates.Second, it fixes the plugins for adder gates based on the "ripple_v95" synthesis function that requires
n-1
ancilla qubits. Previously the function could be called with fewer qubits available and the synthesized quantum circuit was not guaranteed to fit into the original quantum circuit leading to internal errors inHighLevelSynthesis
pass.Third, it adds the default synthesis plugin for
FullAdderGate
and improves the default synthesis plugins forHalfAdderGate
andModularAdderGate
to always choose the best synthesis method depending on the number of ancillas available. Previously, we were getting less optimal circuits for certain small values ofn
.Details and comments