Skip to content

Add Hamiltonian simulation with GQSP demo#1815

Open
Mostafa-Atallah2020 wants to merge 9 commits into
PennyLaneAI:masterfrom
Mostafa-Atallah2020:demo/hamiltonian-simulation-gqsp
Open

Add Hamiltonian simulation with GQSP demo#1815
Mostafa-Atallah2020 wants to merge 9 commits into
PennyLaneAI:masterfrom
Mostafa-Atallah2020:demo/hamiltonian-simulation-gqsp

Conversation

@Mostafa-Atallah2020

Copy link
Copy Markdown

Title:

Hamiltonian simulation with Generalized Quantum Signal Processing

Summary:

The demo implements the time-evolution operator exp(-iHt) with qml.GQSP in three steps. First it block-encodes H as a qubitization walk W (qml.Qubitization) whose eigenphases are +/- arccos(E/lambda). Then it chooses the polynomial via the Jacobi-Anger expansion, so that a single complex polynomial of W equals exp(-iHt) on the walk's eigenphases. Finally it runs qml.GQSP with angles from qml.poly_to_angles(..., "GQSP"), undoes the Laurent z^K shift, and reads exp(-iHt) off the top-left block, verified against scipy.linalg.expm.

Relevant references:

  • D. Motlagh and N. Wiebe, Generalized Quantum Signal Processing, PRX Quantum 5, 020368 (2024).
  • G. H. Low and I. L. Chuang, Hamiltonian Simulation by Qubitization, Quantum 3, 163 (2019).

Possible Drawbacks:

The worked example is a small 2-qubit Heisenberg-type Hamiltonian, chosen so the full exp(-iHt) matrix can be formed and compared directly. The method itself is general; the small size is purely for an exact, fast check. For the same reason the demo reads the evolution from the dense circuit matrix on default.qubit, rather than running it as a sampled circuit, which is appropriate for a correctness-focused demo at this scale.

Related GitHub Issues:

Closes #1807.


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

  • GOALS: Why are we working on this now?

    PennyLane ships qml.GQSP and a GQSP resource-estimation demo, but there is no executable, end-to-end recipe taking qml.GQSP to its flagship application, Hamiltonian simulation. This demo fills that gap, showing the full runnable pipeline and verifying it against the exact evolution.

  • AUDIENCE: Who is this for?

    Graduate students and researchers comfortable with qubitization and QSP basics who want to run GQSP-based Hamiltonian simulation, not just estimate its cost.

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

    GQSP, Generalized Quantum Signal Processing, Hamiltonian simulation, qubitization, quantum signal processing, Jacobi-Anger, block encoding.

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

  • Tutorial
  • Demo
  • How-to

@Mostafa-Atallah2020 Mostafa-Atallah2020 requested review from a team as code owners June 17, 2026 14:57
@github-actions

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!

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Your preview is ready 🎉!

You can view your changes here

Deployed at: 2026-06-25 14:18:29 UTC

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

@nobese nobese left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi again @Mostafa-Atallah2020 ! Thanks for your prompt implementation of my previous comments, things are on the right track! I left a few more thoughts, let me know if you have any questions and feel free to ping me when you are done!

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

@nobese nobese left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A few more small comments, @Mostafa-Atallah2020 , we're almost there!

One suggestion that I have is a slight modification to the title, I think the "how to" will flag this demo among similar style demos that are available. Search "how to" on pennylane.ai and view the demos that come up if you are curious!

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

@nobese nobese left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks great, @Mostafa-Atallah2020, thanks for all your edits! There are a few logistics on our end that precede merging to the website, but I will get the ball rolling and keep you updated :)

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.

[DEMO] Hamiltonian simulation with Generalized Quantum Signal Processing

3 participants