Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
The Linear Combination of Hamiltonian Simulation (LCHS) method [1] solves linear ODEs of the form ddt∣u⟩=−A∣u⟩\frac{d}{dt}|u\rangle = -A|u\rangle on a quantum computer, where AA may be non-anti-Hermitian, leading to non-unitary time evolution. It works by expressing the propagator e−Ate^{-At} as a continuous linear combination of unitary evolutions, which is then discretized and implemented using standard Hamiltonian simulation primitives.
  • Input:
    • A matrix A=L+iHA = L + iH with L⪰0L \succeq 0 (positive semidefinite) and H=H†H = H^\dagger (Hermitian).
    • Block-encoding oracles for H/αHH/\alpha_H and L/αLL/\alpha_L.
    • The evolution time tt and target error ϵ\epsilon.
  • Output: A quantum state proportional to e−At∣u0⟩e^{-At}|u_0\rangle, obtained via post-selection on auxiliary qubits.
Complexity: The algorithm requires O(αA tlog⁡(1/ϵ))\mathcal{O}(\alpha_A\, t \log(1/\epsilon)) queries to the block-encoding oracle for AA [5], where αA≥∥A∥\alpha_A \geq \|A\| is the block-encoding normalization and ϵ\epsilon is the target operator-norm error ∥e−At−U~∥≤ϵ\|e^{-At} - \tilde{U}\| \leq \epsilon. This is optimal in all parameters, improving the O~(αA tlog⁡1+o(1)(1/ϵ))\widetilde{O}(\alpha_A\, t \log^{1+o(1)}(1/\epsilon)) scaling of prior work [1], [2].
Keywords: Non-unitary dynamics, Linear Differential Equations, Hamiltonian Simulation, Block Encoding, GQSP, Kernel Methods, Open Quantum Systems.

Background

The Problem

We wish to solve the linear ODE ddt∣u⟩=−A ∣u⟩,∣u(0)⟩=∣u0⟩,\frac{d}{dt}|u\rangle = -A\,|u\rangle, \qquad |u(0)\rangle = |u_0\rangle, where A∈CN×NA \in \mathbb{C}^{N \times N}. When AA is not anti-Hermitian, the solution ∣u(t)⟩=e−At∣u0⟩|u(t)\rangle = e^{-At}|u_0\rangle is non-unitary and cannot be directly implemented as a quantum gate. We decompose A=L+iHA = L + iH where:
  • H=12i(A−A†)H = \frac{1}{2i}(A - A^\dagger) is Hermitian (the conservative/oscillatory part),
  • L=12(A+A†)L = \frac{1}{2}(A + A^\dagger) is positive semidefinite (the dissipative/damping part).
Source terms. The homogeneous equation above can be extended to the inhomogeneous case ddt∣u⟩=−A∣u⟩+∣b(t)⟩\frac{d}{dt}|u\rangle = -A|u\rangle + |b(t)\rangle. Via Duhamel’s principle, the solution is ∣u(t)⟩=e−At∣u0⟩+∫0te−A(t−s)∣b(s)⟩ ds.|u(t)\rangle = e^{-At}|u_0\rangle + \int_0^t e^{-A(t-s)}|b(s)\rangle\,ds. Each term involves evaluating the non-unitary propagator e−Aτe^{-A\tau} and can therefore be handled by LCHS. In practice, the integral is discretized using a quadrature rule, and each quadrature point contributes an additional LCHS call at the corresponding time (t−s)(t - s) (see [5], Sec. 1.1.2 and [2]).

The LCHS Identity

The central insight of LCHS is the integral identity (Eq. 4 in [5], originally [1]): e−At=12π∫−∞∞f^(k) e−i(kL+H)t dk,e^{-At} = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \hat{f}(k)\, e^{-i(kL + H)t}\, dk, where f^(k)\hat{f}(k) is the Fourier transform of a function ff chosen to satisfy f(x)=e−xf(x) = e^{-x} for x≥0x \geq 0. For each k∈Rk \in \mathbb{R}, the matrix H+kLH + kL is Hermitian, so the exponential e−i(kL+H)te^{-i(kL+H)t} is a unitary operator that can be implemented using standard Hamiltonian simulation techniques. In practice this integral is truncated to a finite interval [−R,R][-R, R] (where RR is the truncation radius) and discretized into a finite sum that can be implemented via LCU on a quantum computer. A key innovation of [5] is the approximate LCHS: the kernel ff need only approximate exponential decay (rather than match it exactly), which circumvents a no-go result from prior work and enables the optimal O(αA tlog⁡(1/ϵ))O(\alpha_A\, t \log(1/\epsilon)) query complexity.

Kernel Function

Reference [5] uses the kernel function (Eq. 9, with j=2j=2, y=1y=1): f^2(k;γ,c)=22πec(1−ik) e−(k2+1)/(4γ2)1+k2.\hat{f}_2(k;\gamma,c) = \frac{2}{\sqrt{2\pi}} \frac{e^{c(1-ik)}\, e^{-(k^2+1)/(4\gamma^2)}}{1+k^2}. This is a product of a Lorentzian 1/(1+k2)1/(1+k^2) and a Gaussian e−k2/(4γ2)e^{-k^2/(4\gamma^2)}. The Lorentzian alone is the Fourier transform of exact exponential decay e−∣x∣e^{-|x|}, but its tails decay only as 1/k21/k^2, making it expensive to truncate the integral. The Gaussian envelope suppresses the tails exponentially, enabling truncation to a finite interval [−R,R][-R, R] with small error. The tradeoff is that the kernel now only approximates exponential decay, with the approximation quality controlled by γ\gamma: larger γ\gamma gives a wider (flatter) Gaussian and a better approximation, at the cost of a larger truncation radius RR. The shift parameter cc controls the normalization factor αf^2≤ec\alpha_{\hat{f}_2} \leq e^c, which determines the post-selection success probability. Theorem 2 of [5] sets γ=1cc+log⁡1+1/(2π)ϵlchs\gamma = \frac{1}{c}\sqrt{c + \log\frac{1+1/(2\pi)}{\epsilon_{\mathrm{lchs}}}} and R=2cγ2R = 2c\gamma^2 to guarantee kernel approximation error ≤ϵlchs\leq \epsilon_{\mathrm{lchs}}.

Discretization

The integral is discretized on a uniform grid of N=2JN = 2^J points with spacing h=2R/Nh = 2R/N over the interval [−R,R)[-R, R) ([5], Theorem 3, which proves exponential convergence of the uniform quadrature): e−At≈h2π∑j=−N/2N/2−1f^2(kj) e−i(kjL+H)t,kj=h⋅j.e^{-At} \approx \frac{h}{\sqrt{2\pi}} \sum_{j=-N/2}^{N/2-1} \hat{f}_2(k_j)\, e^{-i(k_j L + H)t}, \qquad k_j = h \cdot j. The stepsize hh is chosen according to: h≤π∥L∥⋅t/2+log⁡ ⁣(64 e3c/215 ϵdisc),h \leq \frac{\pi}{\|L\| \cdot t/2 + \log\!\left(\frac{64\, e^{3c/2}}{15\,\epsilon_{\mathrm{disc}}}\right)}, The number of grid points N=2JN = 2^J is then J=⌈log⁡2(2R/h)⌉J = \lceil \log_2(2R/h) \rceil. Note that a uniform quadrature is sufficient. This sum is implemented via LCU, with the kernel values f^2(kj)\hat{f}_2(k_j) as coefficients.

Quantum Circuit Structure

The full LCHS quantum circuit consists of the following components:
  1. Kernel state preparation: Load ∣f^2(kj)∣|\hat{f}_2(k_j)| into an auxiliary register ∣j⟩|j\rangle.
  2. Block-encoding of H+kjLH + k_j L: For each grid point jj, block-encode the Hermitian operator (H+kjL)/α(H + k_j L)/\alpha, where α=αLR+αH\alpha = \alpha_L R + \alpha_H is the normalization.
  3. Hamiltonian simulation: In this demo we apply the Jacobi-Anger polynomial approximation of e−i(H+kjL)αte^{-i(H+k_j L)\alpha t} using Generalized QSP on the walk operator derived from the block encoding.
  4. Post-selection: Measure all auxiliary qubits in the ∣0⟩|0\rangle state to extract the desired output.

Preliminaries

Problem Definition and Parameters

We define the Hamiltonians HH and LL and derive all algorithm parameters - state size, block-encoding normalization, kernel shape, and error budget - from these operators and the desired precision.
Output:
Notice that in practice these bounds are worst-case and not tight, and the actual error is much smaller.

Classical Reference Simulation

Before building the quantum circuit, we implement the LCHS formula classically to verify correctness.
  1. Exact: Direct matrix exponentiation e−(L+iH)t∣u0⟩e^{-(L+iH)t}|u_0\rangle.
  2. LCHS: The discretized sum h2π∑jf^2(kj) e−i(H+kjL)t∣u0⟩\frac{h}{\sqrt{2\pi}} \sum_j \hat{f}_2(k_j)\, e^{-i(H+k_jL)t}|u_0\rangle using exact matrix exponentials.

Classical Verification

We verify the LCHS simulation against the exact solution using a random test problem.
Output:

Quantum Implementation

image.png We now implement the full LCHS algorithm as a quantum circuit using Classiq. The circuit follows the structure described in the background:
  1. Prepare the kernel amplitudes ∣f^2(kj)∣|\hat{f}_2(k_j)| in the ∣j⟩|j\rangle register.
  2. Block-encode the jj-dependent Hamiltonian (H+kjL)/α(H + k_j L)/\alpha.
  3. Simulate the time evolution via GQSP on the walk operator.
  4. Post-select on auxiliary qubits being ∣0⟩|0\rangle.

Data Structures

We define quantum struct types for the LCHS circuit. The LchsBlock struct holds the auxiliary registers:
  • j: a signed integer register for the grid index,
  • lcu_block: auxiliary qubit for the LCU of HH and kLkL,
  • linear_block: auxiliary qubit for the linear block-encoding of kk (explained below),
  • matrices_block: auxiliary qubits for the block-encoding of HH and LL.

Block-Encoding the Hamiltonians

For each grid point jj, we need a block-encoding of the Hermitian operator H+kjLα,α=αLR+αH.\frac{H + k_j L}{\alpha}, \qquad \alpha = \alpha_L R + \alpha_H. This is achieved by an LCU decomposition: H+kjLα=αLRα⋅kjR⋅LαL+αHα⋅HαH.\frac{H + k_j L}{\alpha} = \frac{\alpha_L R}{\alpha} \cdot \frac{k_j}{R} \cdot \frac{L}{\alpha_L} + \frac{\alpha_H}{\alpha} \cdot \frac{H}{\alpha_H}. The factor kj/Rk_j / R is block-encoded using a linear amplitude encoding: ∣j⟩∣0⟩↦j2J−1∣j⟩∣0⟩+∣⊥⟩|j\rangle|0\rangle \mapsto \frac{j}{2^{J-1}}|j\rangle|0\rangle + |\perp\rangle, which embeds the linear function of jj into an amplitude. The other constants are applied as part of the LCU probabilities. The Pauli-decomposed operators HH and LL (defined in the parameters cell above) are each block-encoded via lcu_pauli, which implements the LCU of Pauli terms using ancilla qubits.

Walk Operator and GQSP Hamiltonian Simulation

Given the block-encoding UAU_A of (H+kjL)/α(H + k_j L)/\alpha, we construct the walk operator W=(2∣0⟩⟨0∣−I)⋅UAW = (2|0\rangle\langle 0| - I) \cdot U_A, whose eigenvalues are e±iarccos⁡(λi/α)e^{\pm i\arccos(\lambda_i/\alpha)} for each eigenvalue λi\lambda_i of (H+kjL)(H + k_j L). We then use GQSP with a Jacobi-Anger polynomial approximation to implement e−iλite^{-i\lambda_i t} as a function of cos⁡−1(λi/α)\cos^{-1}(\lambda_i/\alpha), effectively realizing the Hamiltonian simulation e−i(H+kjL)te^{-i(H + k_j L)t} within the block.

Kernel Preparation

The kernel state preparation loads the absolute values ∣f^2(kj)∣|\hat{f}_2(k_j)| into the ∣j⟩|j\rangle register. The complex phase of the kernel, e−ikjc=e−ihcje^{-ik_j c} = e^{-ihcj}, is applied as a separate phase gate after the Hamiltonian simulation.
output The full LCHS circuit wraps these steps in a within_apply pattern:

Running the Quantum Circuit

We define the main function, synthesize the circuit, and execute it using a statevector simulator. We post-select on the block register being ∣0⟩|0\rangle to extract the LCHS output state.
Output:
Output:

Quantum vs.

Classical Comparison We compare the quantum LCHS output against:
  1. Exact: Direct matrix exponentiation e−(L+iH)t∣u0⟩e^{-(L+iH)t}|u_0\rangle.
  2. LCHS (classical): Classical emulation of the quantum circuit (discretized LCHS with the GQSP polynomial approximation).
For this demonstration, we use the block-encodings defined above.
Output:

Technical Notes

  1. Access model: The algorithm assumes block-encoding access to HH and LL separately. If only access to A=L+iHA = L + iH is available, one can extract HH and LL via H=12i(A−A†)H = \frac{1}{2i}(A - A^\dagger) and L=12(A+A†)L = \frac{1}{2}(A + A^\dagger), though this may double the block-encoding cost. Alternatively, as noted in [5] (Sec. 1.1.5), one can block-encode kL+HkL + H directly from a block-encoding of AA using the identity kL+H=(k−i)A+((k−i)A)†2kL + H = \frac{(k-i)A + ((k-i)A)^\dagger}{2}.
  2. Time-dependent case: If HH or LL are time-dependent, the inner Hamiltonian simulation becomes time-dependent and can be handled using methods such as Dyson or Magnus series (see the Time Marching notebook).
The LCHS framework in [5] is stated in full generality for time-dependent A(t)A(t).
  1. Normalization and post-selection: The LCU of the kernel introduces a normalization factor αf^2=ecerfc⁡(1/(2γ))≤ec\alpha_{\hat{f}_2} = e^c \operatorname{erfc}(1/(2\gamma)) \leq e^c, which is Θ(1)\Theta(1) for constant cc [5].
The final result is obtained by post-selecting on all block qubits being ∣0⟩|0\rangle, with success probability determined by this normalization and the GQSP scaling factor.
  1. Scalable kernel preparation: The inplace_prepare_amplitudes function used here loads arbitrary amplitudes but does not scale efficiently. [5] (Theorem 4) provides an efficient circuit for preparing the kernel state with O(log⁡(∥L∥+log⁡(1/ϵ))log⁡5/2(1/ϵ))\mathcal{O}(\log(\|L\| + \log(1/\epsilon)) \log^{5/2}(1/\epsilon)) two-qubit gates.

References

[1] An, D., Liu, J.-P., & Lin, L. Linear Combination of Hamiltonian Simulation for Nonunitary Dynamics with Optimal State Preparation Cost. Physical Review Letters 131, 150603 (2023). arXiv:2303.01029 [2] An, D., Childs, A. M., & Lin, L. Quantum algorithm for linear non-unitary dynamics with near-optimal dependence on all parameters. Communications in Mathematical Physics (2025). arXiv:2312.03916 [3] Motlagh, D. & Wiebe, N. Generalized Quantum Signal Processing. PRX Quantum 5, 020368 (2024). arXiv:2308.01501 [4] Hamiltonian Simulation with Block Encoding (Classiq Library) [5] Low, G. H. & Somma, R. D. Optimal quantum simulation of linear non-unitary dynamics. (2025). arXiv:2508.19238