Skip to content

Added a demo for Resource Estimation of Matrix Inversion using QSVT#1667

Open
Jaybsoni wants to merge 63 commits intomasterfrom
qsvt_re
Open

Added a demo for Resource Estimation of Matrix Inversion using QSVT#1667
Jaybsoni wants to merge 63 commits intomasterfrom
qsvt_re

Conversation

@Jaybsoni
Copy link
Contributor

Title:
A new demo using the resource estimation functionality for CFD example using QSVT.

Summary:

Relevant references:

Possible Drawbacks:

Related GitHub Issues:


  • GOALS — Why are we working on this now?
  • Promote the new PL feature (estimator module)
  • Show a PL implementation of a recent paper (https://arxiv.org/pdf/2404.02819)
  • This demo should teach users how to estimate the cost of the QSVT based algorithm for solving LSEs.
  • We aim to highlight all of the practical considerations a user must make when specializing the algorithm for their specific problem instance.
  • How should I select my polynomial approximation 1/x (with what error?)
  • How does changing the block-encoding affect the cost of my algorithm?
  • This demo should estimate the cost for a useful application of the algorithm.
  • AUDIENCE — Who is this for?
  • Algo Researcher:

    • Expert knowledge of quantum algorithms & resource estimation
    • Lacks knowledge of PennyLane
    • Lacks knowledge of PennyLane Resource Estimation
  • Algo Software Dev:

    • Familiar with quantum algorithms & resource estimation
    • Familiar with PennyLane
    • Lacks knowledge of PennyLane Resource Estimation
  • KEYWORDS — What words should be included in the marketing post?

QSVT, Resource Estimation, Matrix Inversion, CFD, Linear systems of equations,

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

@github-actions
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!

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Your preview is ready 🎉!

You can view your changes here

Deployed at: 2026-02-26 21:50:04 UTC

@Jaybsoni Jaybsoni requested review from a team as code owners January 21, 2026 16:13
Copy link
Contributor

@KetpuntoG KetpuntoG left a comment

Choose a reason for hiding this comment

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

Great job @Jaybsoni ! 🚀
Leaving a few comments here 😄

print(resources)

##############################################################################
# Here the :class:`~.pennylane.estimator.compact_hamiltonian.PauliHamiltonian` class is used to
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to know why this are the resources, something like: note that by default we decompose the target get_set [...]. There is probably another demo you can link for the basics of the resource estimation functionality

#
# Polynomial Approximations of the Inverse Function
# -------------------------------------------------
# The cost of QSVT is directly proportional to the degree of the polynomial transformation. More
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend to link the matrix inversion demo for more details

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that could clarify a bit better the concept of kappa, right now it is not very clear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea!

#
# Diagonal Matrices & the Walsh-Hadamard Transform
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Let's start with the :math:`D_{k}` operators. These are a list of diagonal operators where
Copy link
Contributor

Choose a reason for hiding this comment

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

The operator D_k is not diagonal, it is a block encoding of a diagonal matrix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It becomes block diagonal when we include the multiplexer. But I guess my point is that each individual D_i is a diagonal operator no?

Copy link
Contributor

@AntonNI8 AntonNI8 left a comment

Choose a reason for hiding this comment

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

Initial pass through 😄

Copy link
Contributor

@drdren drdren left a comment

Choose a reason for hiding this comment

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

Better listing

Copy link
Contributor

@drdren drdren left a comment

Choose a reason for hiding this comment

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

The initial Python code block does not execute

Comment on lines +82 to +85
print(resources)

##############################################################################
# With one line, we can see that that the estimated T gate cost of naive block encoding this matrix is :math:`1 \times 10^{12}`. This block encoding is called many times within an instance of the QSVT algorithm, and can be the dominant cost. Now that we have established a baseline of the `standard' cost, we ask: Can we do better?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(resources)
##############################################################################
# With one line, we can see that that the estimated T gate cost of naive block encoding this matrix is :math:`1 \times 10^{12}`. This block encoding is called many times within an instance of the QSVT algorithm, and can be the dominant cost. Now that we have established a baseline of the `standard' cost, we ask: Can we do better?
print(resources)
##############################################################################
# With one line, we can see that that the estimated T gate cost of naive block encoding this matrix is :math:`1 \times 10^{12}`. This block encoding is called many times within an instance of the QSVT algorithm, and can be the dominant cost. Now that we have established a baseline of the `standard' cost, we ask: Can we do better?

# Each :math:`D_{k}` is a block-diagonal operator that contains the normalised entries from the :math:`k^{\text{th}}`
# diagonal of our d-diagonal matrix :math:`A`. By multiplexing over the :math:`D_{k}` operators, we can load all of
# the diagonals in *parallel*.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants