-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Single-register arithmetic gates #13371
Conversation
no support for parameter expressions for now
some tests miss, some HLS tests fail (maybe Sasha's PR fixes this)
One or more of the following people are relevant to this code:
|
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.
Is there a plan to add deprecation warnings in the related non-gates classes?
Should it be done as part of this PR?
qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py
Outdated
Show resolved
Hide resolved
We cannot deprecate them yet as the alternative has not been available for 1 release. I'd suggest we handle it like the |
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.
minor misprints
You should also add release notes. Could you explain there why gates are better than quantum circuits? |
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.
looks good. I have some comments on the docs.
Also - are there test for exact reciprocal gate? linear pauli rotation gate?
piecewise polynomial pauli rotation gate? polynomial pauli rotation gate
* :class:`.IntegerComparatorGate` (replacing :class:`.IntegerComparator`) | ||
* :class:`.LinearPauliRotationsGate` (replacing :class:`.LinearPauliRotations`) | ||
* :class:`.PiecewiseLinearPauliRotationsGate` (replacing :class:`.PiecewiseLinearPauliRotations`) | ||
* :class:`.PiecewiseChebychevGate` (replacing :class:`.PiecewiseChebychev`) |
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.
there is a misprint here. should be "PiecewiseChebyshev" and not "PiecewiseChebychev"
self.breakpoints = breakpoints if breakpoints is not None else [0] | ||
|
||
num_compare = 0 if breakpoints is None else int(len(breakpoints) > 1) | ||
super().__init__("PiecewiseChebychev", num_state_qubits + num_compare + 1, [], label) |
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.
there is a misprint here. should be "PiecewiseChebyshev" and not "PiecewiseChebychev"
@@ -259,6 +259,7 @@ | |||
:template: autosummary/class_no_inherited_members.rst | |||
|
|||
LinearAmplitudeFunction | |||
LinearAmplitudeFunctionGate |
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.
the class "FunctionalPauliRotations" should not be a gate? it's just a base class?
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.
Yes, the methods it provided are not really necessary anymore now that the objects are not BlueprintCircuit
s anymore, so it doesn't need a new equivalent 🙂
positive. For the negative case it is assumed that the remaining string represents | ||
:math:`1 - x`. This is because :math:`e^{-2 \pi i x} = e^{2 \pi i (1 - x)}` for | ||
:math:`x \in [0,1)`. | ||
name: The name of the object. |
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.
here it should be label and not name
@@ -0,0 +1,17 @@ | |||
--- | |||
features_circuits: |
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.
you should also mention here the synthesis functions (Unary Arithmetic Synthesis) and the HLS plugins (Integer comparators, Sums).
|
||
.. autofunction:: synth_integer_comparator_2s | ||
.. autofunction:: synth_integer_comparator_greedy | ||
|
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.
the function synth_weighted_sum_carry does not appear in the docs?
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.
It should be there, see L157 🙂
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.
Another comment: it seems that the names of these functions do not comply with the naming convention in the synthesis library, which usually include the authors' initials and the year. what do you think?
(this convention is usually useful if there are several synthesis methods of the same object).
- Description | ||
- Auxiliary qubits | ||
* - ``"default"`` | ||
- :class:`~.WeightedSumSynthesisDefault` |
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.
the link does not work
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.
Good catch, this is missing in the toctree, I'll add it 👍🏻
from qiskit.circuit import QuantumCircuit | ||
from qiskit.circuit.library import ( | ||
LinearPauliRotations, | ||
PolynomialPauliRotations, | ||
PiecewiseLinearPauliRotations, | ||
PiecewiseLinearPauliRotationsGate, |
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.
should there be a test for LinearPauliRotationsGate ? PolynomialPauliRotations ?
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.
Yeah that'd be good, we can extend the tests for the PiecewiseLinearPauliRotationGate
to also check others.
Summary
Part of #13046: Gates for the single-register arithmetic operations.
Details and comments
I'm opening this PR for people to have a look and for more HLS test cases, but this can probably use some more cleanup. Also all the piecewise gates need an auxiliary qubit, which is currently part of the Gate
num_qubits
but probably shouldn't be and instead be handled by a synthesis plugin.Since there's already enough for 1.3 I'd suggest we don't include this.