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 ϵ.Qubitization [1] achieves Hamiltonian simulation by combining the Jacobi–Anger expansion with the Linear Combination of Unitaries (LCU) technique, exploiting the fact that powers of the walk operator directly implement Chebyshev polynomial block-encodings. This approach is entirely constructive- it requires no classical preprocessing for rotation angles, but uses more ancilla qubits (O(logd), where d is the polynomial degree) than GQSP or QSVT.
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 O(logd) auxiliary qubits. No classical angle preprocessing required.Keywords: Hamiltonian Simulation, Block Encoding, Qubitization, Chebyshev Polynomials, Walk Operator, 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.Given an exact (s,m,0)-encoding of the Hamiltonian (denoting UH≡U(s,m,0)−H), we define the Szegedy quantum walk operator [2]W≡Π∣0⟩mUH,(1)where Π∣0⟩m reflects about the ∣0⟩ state of the block variable.The Chebyshev LCU approach presented here relies on the fact that the k-th power of walk operator directly implements a Chebyshev polynomial block-encoding of H:Wk=(Tk(H/s)∗∗∗)=U(1,m,0)−Tk(H/s).(2)This means we can implement the Hamiltonian simulation as an LCU over the walk operator powers, using the Jacobi-Anger expansion coefficients (Eqs. (3)–(4)) as the LCU weights:e−iHt≈k=0∑dβkTk(H/s)=k=0∑dβkWk.The resulting block-encoding has scaling factor βˉ=∑k∣βk∣ and block size m+⌈log2(d+1)⌉:U(βˉ,m~,ϵ)−exp(−iHt)=(e−iHt/βˉ∗∗∗).
This notebook demonstrates Hamiltonian simulation using the Qubitization (Chebyshev LCU) method.For the other approaches, see the companion notebooks on GQSP and QSVT.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 register 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 LCU coefficients for the Chebyshev polynomials come directly from the Jacobi–Anger expansion (Eqs. (3)-(4)). We compute the cosine and sine Chebyshev coefficients and combine them into complex coefficients for e−iHt=cos(Ht)−isin(Ht).
Note: The current implementation assumes that the block-encoding unitary UH is also Hermitian. For the non-Hermitian generalization, see the Technical Notes.
For the block-encoding of H, U(s,m,0)−H, we define the Szegedy quantum walk operator, W=Π∣0⟩mU(s,m,0)−H, according to Eq. (1) above.
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 build an LCU of the unitaries {Wk} with coefficients {βk}.The select operator over a series of unitary powers is implemented efficiently: instead of applying 2l multi-controlled operations, we apply l single-controlled operations, where the i-th control qubit applies W2i (analogous to the QPE circuit structure).
First, we define Quantum Structs for the Qubitization block-encoding.The block part, QubitizationBlock, contains the block variable from the Hamiltonian block-encoding, and a block variable on which we apply the PREPARE operation of the LCU to construct the sum of Chebyshev polynomials of H.The data variable follows that of the Hamiltonian encoding.
In addition, we assemble the lcu_cheb function using prepare_select with the efficient select_powered_unitaries as the select operation.
The code in the rest of this section builds a model that applies the lcu_cheb function on the randomly prepared vector, synthesizes it, executes the resulting quantum program, and verifies the results.
Generalizing to Non-Hermitian Block-Encoding Unitaries
The current implementation assumes that the block-encoding unitary UH is also Hermitian.This assumption underlies the walk operator’s spectral properties.For a non-Hermitian block-encoding unitary, an analogous walk operator can be defined as W~≡UHTΠ∣0⟩mUHΠ∣0⟩m, which satisfies equivalent spectral properties.See Section 7.4 in Ref. [3] for details.