-
Notifications
You must be signed in to change notification settings - Fork 212
[WIP] Add demo on groups, FFTs and QFTs #1469
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
base: master
Are you sure you want to change the base?
Conversation
👋 Hey, looks like you've updated some demos! 🐘 Don't forget to update the Please hide this comment once the field(s) are updated. Thanks! |
], | ||
"dateOfPublication": "2025-07-30T10:00:00+00:00", |
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.
These new metadata fields will let you control the executability of the demo. Not needed now, but in case there are dependency issues in the future you can set these to false to make the demo non-executable temporarily, without having to change the name of the demo:
], | |
"dateOfPublication": "2025-07-30T10:00:00+00:00", | |
], | |
"executable_stable": true, | |
"executable_latest": true, | |
"dateOfPublication": "2025-07-30T10:00:00+00:00", |
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 applied these to trigger a rebuild 😄
Co-authored-by: Paul Finlay <[email protected]>
Your preview is ready 🎉!You can view your changes here |
@alvaro-at-xanadu the demo is now in a final draft stage, and I tagged Vasilis and Guillermo for a technical review. What else would I need to do to proceed? Shall I ask Tarik for images? :) |
Hi @mariaschuld ! Yes, feel free to touch base with Tarik for images, and let us know when technical review is ready so we can do a quick product/content review. |
|
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.
Nice work! 🥳 Here some comments
# function :math:`f(x_1), ...,f(x_N)` evaluated or "sampled" at equidistant | ||
# x-values :math:`x_1,...,x_N`. The Fourier coefficients are then given as | ||
# | ||
# .. math:: \hat{f}(k) = \frac{1}{\sqrt{N}}\sum_{i=1}^N f(x_i) e^{2 \pi i \frac{k x}{N}} |
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'd suggest to use j = 1.... so the imaginary "i" is different
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.
sub-index in x is missing
# the interval :math:`0,..,N-1` is thought to be "periodically continued", which means that :math:`f(x_i) = f(x_i + N)`. | ||
# | ||
# Let's code this up: |
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.
In the way it is said here I thought you were going to show the periodicity
def g(x): | ||
"""Majority function for length-n bitstrings.""" | ||
count_ones = sum(x[i] for i in range(n)) | ||
return count_ones/n | ||
|
||
def chi(x, k): | ||
"""Character for Z_2^n""" | ||
return np.prod([np.exp(1j * k[i] * x[i]) for i in range(n)]) | ||
|
||
def g_hat(k): |
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 was not sure what these function are since the names do not match the text
# Choosing :math:`N=2` we get the group :math:`Z_2^n` mentioned above, where we consider N "copies" of the binary set :math:`\{0,1\}`. | ||
# This captures boolean logic ubiquitous in quantum algorithms. The characters for :math:`Z_2^n` are of the form | ||
# | ||
# .. math:: e^{i k_0 x_0} \dots e^{i k_{N-1} x_{N-1}}, \;\; k_0,...,k_{N-1} \in \{0,1\}, \; x_0,...,x_{N-1} \in \{0,1\} |
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 may be a
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.
Also in the code I think, but I may be wrong :)
# .. admonition:: Subgroup | ||
# :class: note | ||
# | ||
# A subgroup is a subset of the original set that, under the group operation, fulfills all group axioms. |
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.
If you are defining the bases, you could also say what dual G was before, I actually forgot what that means 🙈
# The entire trick of the Cooley-Tukey algorithm is a change of variables, | ||
# | ||
# .. math:: | ||
# \begin{align} | ||
# x &\rightarrow 3 x_1 + x_2, \;\; x_1 = 0,1, \; x_2 = 0,1,2 \\ | ||
# k &\rightarrow 2k_2 + k_1 , \;\; k_1 = 0,1,2 \; k_2 = 0,1 | ||
# \end{align} | ||
# |
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.
Where this come from? What should I do if I have a different m Z_m?
# | ||
# Essentially, the change in variables turns the Fourier basis function over period 6 into a Fourier basis function with period 2, | ||
# which makes the dependency on :math:`k_2` disappear. This effectively turns the Fourier transform into a sum of "smaller" Fourier transforms | ||
# over :math:`3x_1`, namely :math:`\{0, 3\}`, :math:`\{1, 4\}`, and :math:`\{2, 5\}`. These are combined with |
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.
not sure what (0,3),(1,4), (2,5) is referring to
# \begin{align} | ||
# x &\rightarrow 3 x_1 + x_2, \;\; x_1 = 0,1, \; x_2 = 0,1,2 \\ | ||
# k &\rightarrow 2k_2 + k_1 , \;\; k_1 = 0,1,2 \; k_2 = 0,1 | ||
# \end{align} |
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.
render is not ideal, maybe \quad instead of ; solve the issue
# | ||
# The splitting of the variable :math:`k` is related to the concept of "restricting a character" to the subgroup. | ||
# Essentially, it allows us turn the characters, or Fourier basis functions :math:`e^{\frac{2 \pi i}{6} x k }` | ||
# related to the original group, into characters of the subgroup, :math:`e^{\frac{2 \pi i}{2} x_1 k_1 }` by changing the period. |
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.
nice!
# | ||
|
||
####################################################################### | ||
# From FFTs to QFTs |
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.
In this section I have missed the connection with the previous section. After developing the mathematics I thought it would be clearer the connection. I saw the previous version where the formulas were and it was not clear to me neither, so I understand that it has been tried and it has not been easy 😅 (not a blocker but those were my thoughts after reading)
This demo was internally discussed, and is supposed to enlarge our portfolio of Fourier-theoretic methods in quantum algorithms.