Educational utilities and examples for Quantum Singular Value Transformation (QSVT) using PennyLane.
Project description
Quantum Singular Value Transformation (QSVT)
Lightweight tools for experimenting with Quantum Singular Value Transformation (QSVT) using PennyLane.
PyPI package: https://pypi.org/project/qsvt-pennylane/
This repository combines:
- a notebook-first introduction to QSVT
- a reusable Python package for bounded polynomial transforms
The focus is on spectral intuition:
how bounded polynomials transform singular values or eigenvalues via block encodings.
Table of Contents
Installation
Install from PyPI:
pip install qsvt-pennylane
Install from source:
git clone https://github.com/SidRichardsQuantum/Quantum_Singular_Value_Transformation.git
cd Quantum_Singular_Value_Transformation
pip install -e .
Requirements:
- Python ≥ 3.10
- PennyLane ≥ 0.36
- NumPy ≥ 1.23
- Matplotlib ≥ 3.7
Quick example
Scalar polynomial transform:
from qsvt.qsvt import qsvt_scalar_output
qsvt_scalar_output(
x=0.5,
poly=[0,0,1], ## x²
encoding_wires=[0],
)
Diagonal transform:
from qsvt.qsvt import qsvt_diagonal_transform
qsvt_diagonal_transform(
values=[1.0, 0.7, 0.3, 0.1],
poly=[0,0,1],
encoding_wires=[0,1,2],
)
Design a bounded sign polynomial:
from qsvt.design import design_sign_polynomial
coeffs = design_sign_polynomial(
gamma=0.25,
degree=13,
)
Package overview
The package provides small, composable utilities for constructing and applying bounded polynomial transforms.
Polynomial utilities
qsvt.polynomials
- Chebyshev polynomials
- polynomial degree and parity
- boundedness checks
- coefficient normalisation
Polynomial approximation
qsvt.approximation
- Chebyshev fitting
- approximation error metrics
- polynomial evaluation helpers
Polynomial templates
qsvt.templates
Ready-to-use bounded polynomial families:
- inverse-like polynomials
- sign approximations
- soft threshold filters
- sqrt approximations
- exponential weighting functions
- approximation-quality reports
Useful for quick experiments.
Polynomial design
qsvt.design
Task-oriented polynomial builders:
- inverse-like transforms
- sign polynomials
- projector polynomials
- sqrt approximations
- power-law transforms
- smooth spectral filters
- approximation-quality reports
Designed for reusable QSVT workflows.
Reports
qsvt.reports
- convert diagnostics reports to JSON-safe containers
- save and load report JSON files
- plot target, polynomial, and error curves
Useful for recording approximation quality and making report output reusable outside notebooks.
Matrix helpers
qsvt.matrices
Small Hermitian test matrices:
- diagonal matrices
- rotated diagonal matrices
- involutory matrices
Classical spectral reference
qsvt.spectral
Reference matrix-function utilities:
- matrix powers
- matrix square roots
- matrix sign
- spectral projectors
Useful for validating polynomial transforms.
QSVT simulation utilities
qsvt.qsvt
Thin wrappers around PennyLane QSVT:
- scalar QSVT transforms
- diagonal transforms
- block extraction
- classical vs QSVT comparisons
- QSVT transform reports
Documentation
Full documentation:
- Theory: THEORY.md
- Usage guide: USAGE.md
- API reference: docs/qsvt/api_reference.md
- Package index: docs/qsvt/index.md
- Changelog: CHANGELOG.md
Current release: 0.1.6
Notebooks
The notebooks provide a guided introduction to QSVT as polynomial functional calculus.
- scalar intuition
- singular value filtering
- QSP polynomials
- exact linear solvers
- approximate inverse behaviour
- polynomial design and approximation
- matrix powers and roots
- sign function and projectors
- reusable polynomial workflows
The examples emphasise:
- bounded polynomial structure
- spectral interpretation
- simple matrices
- reproducible results
CLI
After installation:
qsvt scalar --x 0.5 --poly "0,0,1"
qsvt diag \
--values "1.0,0.7,0.3,0.1" \
--poly "0,0,1" \
--wires 3
qsvt cheb --degree 3 --x 0.5
qsvt design-report --kind sign --gamma 0.2 --degree 13 \
--output sign-report.json \
--plot sign-report.png
qsvt template-report --kind inverse --degree 7 --mu 0.3 \
--output inverse-report.json
qsvt compatibility-report --poly "0,0,1"
qsvt design-compatibility \
--kind sign \
--degree 13 \
--gamma 0.2
qsvt compare-report \
--values "1.0,0.7,0.3,0.1" \
--poly "0,0,1" \
--wires 3 \
--output qsvt-report.json
qsvt apply-design \
--kind sign \
--values="-0.8,-0.3,0.3,0.8" \
--degree 13 \
--gamma 0.2 \
--wires 3
The report commands print the same JSON diagnostics used by the Python
helpers, including fit error and boundedness information. --output writes the
report to JSON, and --plot writes a target-vs-polynomial plot for
approximation reports.
Compatibility reports distinguish bounded polynomial approximation from PennyLane QSVT synthesis compatibility.
Scope and philosophy
This repository is intentionally:
- educational
- explicit
- simulator-friendly
- polynomial-focused
The goal is to make QSVT easier to experiment with and understand.
Topics intentionally outside scope:
- circuit optimisation
- resource estimation
- fault tolerance
- amplitude amplification
- state preparation methods
The emphasis is understanding how polynomial transforms act on spectra.
Support development
If this repository is useful for research, learning, or experimentation, you can support continued development via GitHub Sponsors:
https://github.com/sponsors/SidRichardsQuantum
Sponsorship supports continued work on open-source implementations of quantum algorithms, including polynomial-based quantum signal processing, spectral transforms, and reproducible research tooling.
Support helps maintain accessible reference implementations for experimenting with QSVT, QSP, and matrix functional calculus workflows.
Author
Sid Richards
GitHub: https://github.com/SidRichardsQuantum
LinkedIn: https://www.linkedin.com/in/sid-richards-21374b30b/
License
MIT License — see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qsvt_pennylane-0.1.6.tar.gz.
File metadata
- Download URL: qsvt_pennylane-0.1.6.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bb75da99d4b2fcd3fc68dfa21d05fc2515abb613154917dd60b58662ce95562
|
|
| MD5 |
1558abb9eb6badf6046f0b9df9b77329
|
|
| BLAKE2b-256 |
f47a363d7f6ba020d0aa6b7417543b32a63026140fb0b5d9474ee3978dbaeac3
|
Provenance
The following attestation bundles were made for qsvt_pennylane-0.1.6.tar.gz:
Publisher:
publish.yml on SidRichardsQuantum/Quantum_Singular_Value_Transformation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qsvt_pennylane-0.1.6.tar.gz -
Subject digest:
4bb75da99d4b2fcd3fc68dfa21d05fc2515abb613154917dd60b58662ce95562 - Sigstore transparency entry: 1361584418
- Sigstore integration time:
-
Permalink:
SidRichardsQuantum/Quantum_Singular_Value_Transformation@f565a5e64fd6ca08e16d48a324d79b87c54b046d -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/SidRichardsQuantum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f565a5e64fd6ca08e16d48a324d79b87c54b046d -
Trigger Event:
push
-
Statement type:
File details
Details for the file qsvt_pennylane-0.1.6-py3-none-any.whl.
File metadata
- Download URL: qsvt_pennylane-0.1.6-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2d761838c6acddb0ef7ae1725153d715fdaf006d6ce5c334ac940109d0f8ebd
|
|
| MD5 |
e92c0ca6a62c6723b62cde0d184485d8
|
|
| BLAKE2b-256 |
c0e12fa2704b7165d5c931341b43dc6ff38ed295d7a72ed99b6dad8e31f08236
|
Provenance
The following attestation bundles were made for qsvt_pennylane-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on SidRichardsQuantum/Quantum_Singular_Value_Transformation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qsvt_pennylane-0.1.6-py3-none-any.whl -
Subject digest:
f2d761838c6acddb0ef7ae1725153d715fdaf006d6ce5c334ac940109d0f8ebd - Sigstore transparency entry: 1361584431
- Sigstore integration time:
-
Permalink:
SidRichardsQuantum/Quantum_Singular_Value_Transformation@f565a5e64fd6ca08e16d48a324d79b87c54b046d -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/SidRichardsQuantum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f565a5e64fd6ca08e16d48a324d79b87c54b046d -
Trigger Event:
push
-
Statement type: