Skip to content

Upload nonlinear amplitude transformation demo - #1738

Open
drdren wants to merge 67 commits into
masterfrom
dren-nonlinear-QSVT
Open

Upload nonlinear amplitude transformation demo#1738
drdren wants to merge 67 commits into
masterfrom
dren-nonlinear-QSVT

Conversation

@drdren

@drdren drdren commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Before submitting

Please complete the following checklist when submitting a PR:

  • Ensure that your tutorial executes correctly, and conforms to the
    guidelines specified in the README.

  • Remember to do a grammar check of the content you include.

  • All tutorials conform to
    PEP8 standards.
    To auto format files, simply pip install black, and then
    run black -l 100 path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Title:

Summary:

Relevant references:

Possible Drawbacks:

Related GitHub Issues:


If you are writing a demonstration, please answer these questions to facilitate the marketing process.

  • GOALS — Why are we working on this now?

    Eg. Promote a new PL feature or show a PL implementation of a recent paper.

  • AUDIENCE — Who is this for?

    Eg. Chemistry researchers, PL educators, beginners in quantum computing.

  • KEYWORDS — What words should be included in the marketing post?

  • Which of the following types of documentation is most similar to your file?
    (more details here)

  • Tutorial
  • [ X] Demo
  • How-to

@drdren
drdren requested review from a team as code owners April 8, 2026 16:52
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

👋 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!

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Try to fix pip install

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove pip install

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Add pip install pyqsp

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment on lines +197 to +210
def MultiControlledZ(wires, control_values=None):
if control_values is None:
control_values = [0] * (len(wires) - 1)
qml.ctrl(qml.Z(wires=wires[-1]),
control=wires[:-1],
control_values=control_values)

# R_gate implements the reflection R used in the block construction.
def R(wires):
assert len(wires) % 2 == 1
n = len(wires)//2
qml.PauliX(wires=wires[0])
MultiControlledZ(wires=wires[1:n+1]+[wires[0]])
qml.PauliX(wires=wires[0])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Take a look to qml.Reflection(wires)
That should replace all this code 😄

Comment on lines +440 to +445
def ProjCtrlPhaseShift(control_wires, target_wire, phi):
qml.MultiControlledX(wires=control_wires + target_wire,
control_values=[0] * len(control_wires))
qml.RZ(phi = 2 * phi, wires=target_wire)
qml.MultiControlledX(wires=control_wires + target_wire,
control_values=[0] * len(control_wires))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this qml.PCPhase?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think they are equivalent. I tested it numerically and they both apply different phase patterns.

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove pip install pyqsp

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
@github-actions

github-actions Bot commented Apr 17, 2026

Copy link
Copy Markdown

Your preview is ready 🎉!

You can view your changes here

Deployed at: 2026-08-20 20:27:47 UTC

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update figures

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/metadata.json Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/metadata.json Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/metadata.json Outdated

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fix figure formatting

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
@drdren

drdren commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Hi @josh146 , we are finalising this demo so that @rishabh-gupta28 's collaborators can review it. I think the earliest release date is in September.

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated
Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/demo.py Outdated

@drdren drdren left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @rishabh-gupta28 , I left some comments suggesting how to rework some parts of the demo, as we discussed. It is an excellent demo that I am confident people will want to read. Let me know your thoughts!

rishabh-gupta28 and others added 8 commits August 17, 2026 16:29
…demo.py

Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
…demo.py

Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>

@rishabh-gupta28 rishabh-gupta28 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@drdren I went through all your suggested changes and approved all of them without any changes as they are already perfect!

Comment thread demonstrations_v2/tutorial_nonlinear_amplitude_transformation/metadata.json Outdated
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
"username": "georgepwhuang"
},
{
"username": "hyizhak"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We must add Patrick's handle too.

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.

5 participants