Use this file to discover all available pages before exploring further.
View on GitHub
Open this notebook in GitHub to run it yourself
Simulating physical and chemical systems was among the original motivations for quantum computing, as first envisioned by Richard Feynman in 1982, and remains one of its most impactful applications. Time-independent Hamiltonian simulation refers to the task of approximately implementing the unitary evolution operator e−iHt for a Hermitian matrix H. When access to the Hamiltonian is provided via block-encoding, this can be realized by applying an appropriate polynomial transformation within a desired precision ϵ.Quantum Singular Value Transformation (QSVT) [1] achieves Hamiltonian simulation by exploiting the decomposition e−iHt=cos(Ht)−isin(Ht). Two QSVT blocks, one for the even polynomial cos(xt) and one for the odd polynomial sin(xt) (both approximated via the Jacobi–Anger expansion, Eqs. (3)-(4)), are combined via LCU. Unlike GQSP and Qubitization, QSVT operates directly on the block-encoding without requiring a walk operator or controlled block-encoding calls, using only two auxiliary qubits.
Input: A Hermitian operator H given through a block-encoding unitary UH with scaling factor α≥∥H∥, evolution time t, and target error ϵ.
Output: A unitary U approximating e−iHt, with ∥U−e−iHt∥<ϵ.
Complexity:O(αt+log(e+log(ϵ−1)/αt)logϵ−1) calls to the block-encoding, using two auxiliary qubits. No controlled block-encoding calls required. Requires classical preprocessing to compute QSVT rotation angles.Keywords: Hamiltonian Simulation, Block Encoding, Quantum Singular Value Transformation, QSVT, Quantum Signal Processing, LCU, Oracle/Query complexity.
A block-encoded Hamiltonian refers to its embedding within a larger unitary matrix.Definition: A (s,m,ϵ)-encoding of a 2n×2n matrix A refers to completing it into a 2n+m×2n+m unitary matrix U(s,m,ϵ)−A:U(s,m,ϵ)−A=(A/s∗∗∗),with functional error (U(s,m,ϵ)−A)0:2n−1,0:2n−1−A/s≤ϵ.Here s is a scaling factor that ensures the overall operator is unitary, m is the number of auxiliary (block) qubits, and ϵ is the encoding error.This notebook assumes basic knowledge of Linear Combination of Unitaries (LCU) and the PREPARE–SELECT implementation; see the LCU tutorial for background.We assume an exact (s,m,0)-encoding of the Hamiltonian as input.The QSVT method outputs an approximated block-encoding of its time evolution:U(s,m,0)−H→U(2,m+2,ϵ)−exp(−iHt)=(exp(−iHt)/2∗∗∗).This is achieved by implementing a block-encoding for the polynomial approximation P(H)≈s~1e−iHt. To recover the exact unitary e−iHt one would apply amplitude amplification to drive the prefactor 1/2→1; here we instead employ projected statevector simulation.QSVT is a general method for implementing polynomial singular value transformation of block-encoded matrices, where each polynomial must have a well-defined parity (even or odd).The transformation is based on Quantum Signal Processing (QSP), achieved by a series of qubit rotations. In the case of general polynomial transformation, as in Hamiltonian simulation e−iHt=cos(Ht)−isin(Ht), one can apply two polynomial transformations, one for the even polynomial cos(xt) and one for the odd polynomial sin(xt), combined via Linear Combination of Unitaries (LCU).The two QSVT circuits are combined using the qsvt_lcu function, which implements an optimized select operation that interleaves the rotations of both polynomials within a single QSVT traversal.The overall result is a (2,m+2,ϵ)-block-encoding of e−iHt,
where one block qubit comes from the QSVT and the second one, as well as the 1/2 prefactor, originates from the LCU.(In practice, our prefactor is slightly different, 2β−1 with β=0.9999 which ensures numerical stability of the classical angle computation).
This notebook demonstrates Hamiltonian simulation using the QSVT method.For the other approaches, see the companion notebooks on GQSP and Qubitization.For a side-by-side comparison of all three methods, see the table at the end of this notebook.
We set some specific hyperparameters for our problem. We use a simple Hamiltonian given as a sum of Pauli strings, and the lcu_pauli function to block-encode it via the Linear Combination of Unitaries (LCU) technique:H=i∑αiUi,U(αˉ,m,0)−H=(H/αˉ∗∗∗),αˉ=i∑∣αi∣.To treat different problems with the same algorithm, simply change theses hyperparameters.
import timeimport matplotlib.pyplot as pltimport numpy as npimport scipyfrom classiq import *
Working with block-encoding typically requires post-selection of the block variable being at state ∣0⟩.The success of this process can be amplified via Oblivious Amplitude Amplification. In this notebook, instead, we use a statevector simulator and project the result. We import two utility functions from hamiltonian_simulation_utils:
get_projected_state_vector: extracts the post-selected statevector from the execution results.
compare_quantum_classical_states: aligns the global phase and computes the overlap with the classically computed reference.
The polynomial approximation of the time evolution relies on the Jacobi–Anger expansion.For QSVT, we use the real Chebyshev forms cos(xt) and sin(xt) (Eqs. (3)–(4)), computed via poly_jacobi_anger_cos and poly_jacobi_anger_sin.From these, we derive the QSVT rotation angles using qsvt_phases.
As a sanity check before the main algorithm, we verify the Hamiltonian block-encoding: we apply UH on the initial state and check that the post-selected result matches (H/αˉ)∣ψ⟩ as expected.
We define Quantum Structs for the QSVT block-encoding.Two block qubits are used: one for the QSVT signal processing (block_qsvt) and one for the LCU, selecting between odd and even polynomials (block_lcu).These are added to the block variable of the Hamiltonian encoding.The qsvt_hamiltonian_evolution function uses prepare_select with the qsvt_lcu as the select operation.The LCU coefficients (1/2,−i/2) implement 21(cos(Ht)−isin(Ht))=21e−iHt.The projector_cnot function implements the QSVT projector onto the ∣0⟩ state of the Hamiltonian block variable.
The code in the rest of this section builds a model that applies the qsvt_hamiltonian_evolution function on the randomly prepared vector (ψ,0), synthesizes it, executes the resulting quantum program, and verifies the results.