-
Notifications
You must be signed in to change notification settings - Fork 595
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
Improved documentation for Quantum Arithmetic #6136
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v0.38.0-rc0 #6136 +/- ##
==============================================
Coverage ? 99.66%
==============================================
Files ? 445
Lines ? 42359
Branches ? 0
==============================================
Hits ? 42217
Misses ? 142
Partials ? 0 ☔ View full report in Codecov by Sentry. |
As name says. Had to open a new PR due to merge conflicts.
As name says. Making myself a reviewer for the daily RC sync.
Automatic sync from the release candidate to master during a feature freeze. --------- Co-authored-by: Astral Cai <astral.cai@xanadu.ai> Co-authored-by: GitHub Actions Bot <> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
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.
Thank you for adding this documentation! 🙌🚀
Here I leave some comments
Make sure the changes I suggest are applied to all templates if necessary.
On the other hand, this PR should point to v0.38.0-rc0
instead of master. You may get several new files when you make the change, let me know if you have problems.
to encode the integer :math:`x < mod` in the Fourier basis. Therefore, we need at least | ||
:math:`\lceil \log_2(x)\rceil` ``x_wires`` to represent :math:`x`. After performing the modular addition operation, the resulting integer | ||
encoded in the Fourier basis can be as large as :math:`mod-1`. Hence, we need at least | ||
:math:`\lceil \log_2(mod)\rceil` ``x_wires`` | ||
to represent all the possible results. Since :math:`x < mod` by definition, we just need at least :math:`\lceil \log_2(mod)\rceil` ``x_wires``. |
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.
I found this paragraph difficult to follow and repetitive, could you try to simplify it?
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
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.
Left some comment for one of the operators, which also applies to all others.
|
||
The implementation is based on the quantum Fourier transform method presented in | ||
`arXiv:2311.08555 <https://arxiv.org/abs/2311.08555>`_. | ||
This operation can be represented in a quantum circuit as: |
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.
I am not sure adding the image here is helpful. The equation is clear enough.
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.
I would leave it if possible. Although in the equation it is clear, it seems to me more visual the in-place / out-place difference seen in this way
\text{Adder}(k, mod) |x \rangle = | x+k \; \text{modulo} \; mod \rangle. | ||
\text{Adder}(k, mod) |x \rangle = | x+k \; (mod) \rangle. |
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.
Why this is changed?
k (int): the number that needs to be added | ||
x_wires (Sequence[int]): the wires the operation acts on | ||
mod (int): the modulus for performing the addition, default value is :math:`2^{\text{len(x_wires)}}` | ||
work_wires (Sequence[int]): the two auxiliary wires to be used for performing the addition when :math:`mod \neq 2^{\text{len(x_wires)}}` |
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.
I suggest mentioning the default, instead of the math equation and referring the user to check "usage details".
|
||
The first one is ``x_wires`` which is used | ||
to encode the integer :math:`x < mod` in the computational basis. Therefore, we need at least | ||
:math:`\lceil \log_2(x)\rceil` ``x_wires`` to represent :math:`x`. After performing the modular addition operation, the resulting integer |
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.
:math:`\lceil \log_2(x)\rceil` ``x_wires`` to represent :math:`x`. After performing the modular addition operation, the resulting integer | |
:math:`\lceil \log_2(x)\rceil` ``x_wires`` to represent :math:`x`. However, after performing the modular addition operation, the resulting integer |
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.
I've rewritten this paragraph to be more concise and clear
:math:`\lceil \log_2(x)\rceil` ``x_wires`` to represent :math:`x`. After performing the modular addition operation, the resulting integer | ||
encoded in the computational basis can be as large as :math:`mod-1`. Hence, we need at least | ||
:math:`\lceil \log_2(mod)\rceil` ``x_wires`` | ||
to represent all the possible results. Since :math:`x < mod` by definition, we just need at least :math:`\lceil \log_2(mod)\rceil` ``x_wires``. |
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.
to represent all the possible results. Since :math:`x < mod` by definition, we just need at least :math:`\lceil \log_2(mod)\rceil` ``x_wires``. | |
to represent all the possible results. Since :math:`x < mod` by definition, we need at least :math:`\lceil \log_2(mod)\rceil` ``x_wires``. |
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.
I've rewritten this paragraph to be more concise and clear
Note that :math:`x` must be smaller than :math:`mod` to get the correct result. | ||
:math:`x` must be smaller than :math:`mod` to get the correct result. |
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.
I see that "Note that" sounded repititive here but starting with a math symbol, x, is also not ideal.
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.
I've changed to: "To obtain the correct result, :math:x
must be smaller than :math:mod
"
Context:
Adding extra documentation of arithmetic templates
Description of the Change:
Adding a detailed explanation of the templates' usage details, pictures and a dedicated folder in the templates section.