Skip to content

Conversation

mariaschuld
Copy link
Contributor

@mariaschuld mariaschuld commented Jul 23, 2025

This is a demo we are creating with the first authors of this paper.

Copy link

👋 Hey, looks like you've updated some demos!

🐘 Don't forget to update the dateOfLastModification in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).

Please hide this comment once the field(s) are updated. Thanks!

@Alan-eMartin
Copy link
Collaborator

Hi @mariaschuld — The metadata checks were failing due to the following categories not passing validation. I think @alvaro-at-xanadu can clarify if these need to be added. "Quantum Information Theory", "Fourier analysis" to the allowed categories list.

Copy link

github-actions bot commented Aug 5, 2025

Your preview is ready 🎉!

You can view your changes here

@ghost
Copy link

ghost commented Aug 6, 2025

Hi @mariaschuld — The metadata checks were failing due to the following categories not passing validation. I think @alvaro-at-xanadu can clarify if these need to be added. "Quantum Information Theory", "Fourier analysis" to the allowed categories list.

Hi @mariaschuld These are the allowed categories:

image

@mariaschuld
Copy link
Contributor Author

@daniela-angulo I added Tarik's pictures, but need to work on this demo a little more to polish and turn code into PL functionality. Will get back to it!

Comment on lines 792 to 797

######################################################################
#
# About the authors
# -----------------
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mariaschuld — we now no longer need these sections at the bottom demos, they are added dynamically when displayed on the website.

Suggested change
######################################################################
#
# About the authors
# -----------------
#

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alan!

@mariaschuld mariaschuld changed the title [WIP] Add demo on resourcefulness analysis with generalised Fourier transforms Add demo on resourcefulness analysis with generalised Fourier transforms Sep 17, 2025

import pennylane as qml
from scipy.stats import unitary_group

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alex-Preciado @isaacdevlugt , the code shared by the authors was creating these states by hand. I found it much neater to use PL, and I think this is an important use case: to make mathematical computations quicker and more reliable. However, I would love to have a qml.HaarState operator!


import itertools
import functools

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isaacdevlugt @Alex-Preciado

This would be a perfect section for PL's pauli module. I tried this:

from pennylane.pauli import string_to_pauli_word, pauli_word_to_matrix

n=2
all_strs    = [''.join(s) for s in itertools.product('IXYZ', repeat=n)]
# sort by number of identities in the Pauli word
basis = sorted(all_strs, key=lambda s: (n - s.count('I'), s))
# collect flattened Pauli basis matrices
B = []
for s in basis:
    pauli_word = string_to_pauli_word(s)
    M = pauli_word_to_matrix(pauli_word)
    print(pauli_word, M)
    M_flat = M.reshape(-1) / np.sqrt(2**n)
    B.append(M_flat)

B = np.array(B)

Where I gave up for now is that string_to_pauli_word somehow deletes the identities, and I end up with the wrong shape of the matrices. I know I could circumvent this using the wire_map keyword, but didn't have the patience.

@mariaschuld
Copy link
Contributor Author

@daniela-angulo this demo is ready for another technical review and a product review!

# `here <https://github.com/PennyLaneAI/qml/demonstrations_v2/tutorial_resourcefulness/utils.py>`__:
#

from utils import group_rows_cols_by_sparsity
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good way to do it? I could probably find a more elegant way than using this function, but it would take too much time right now.

# But ``Uvec_diag`` does not look block diagonal. What happened here?
# Well, it *is* block-diagonal, but we have to reorder the columns and rows of the final matrix to make this visible.
# This takes a bit of pain, which we outsource to a utility function that can be found
# `here <https://github.com/PennyLaneAI/qml/demonstrations_v2/tutorial_resourcefulness/utils.py>`__:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo: check this link when live!

@daniela-angulo
Copy link
Contributor

daniela-angulo commented Sep 17, 2025

I will wait until the technical review is done and then perform the content review. I'll keep an eye on. Thank you so much @mariaschuld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants