Algorithms#
In quantum mechanics, the Hamiltonian \(H\) describes the energy of a system and determines how its quantum state \(|\psi\rangle\) evolves over time. For a time-independent Hamiltonian, the Schrödinger equation
has the solution
The matrix exponential \(e^{-itH}\) is therefore the time-evolution operator. The resulting state can be used to estimate expectation values or sampled in the computational basis to generate output bitstrings. Hamiltonian evolution is central to quantum simulation, including the study of interacting particles and spin models. For an \(n\)-qubit system, the Hamiltonian has dimension \(2^n\times 2^n\), and constructing the full matrix quickly becomes impractical because its computational and storage costs grow exponentially with the number of qubits.
Viewed as a linear operator, the Hamiltonian maps the state vector space into itself:
Time evolution applies the exponential of this operator to an input state,
producing the new state \(e^{-itH}v\). Exponential-action algorithms
compute this vector from repeated evaluations of the map \(v\mapsto Hv\),
without constructing any explicit representation of the matrices \(H\) or
\(e^{-itH}\). quantlop provides efficient implementations of two
such ideas:
Higham method uses scaling and truncated Taylor expansions to approximate the exponential action through repeated Hamiltonian-vector products.
Krylov method projects the Hamiltonian onto a low-dimensional Krylov subspace, evolves the state there, and maps the result back to the full state space.
Higham method#
The algorithm of Al-Mohy and Higham [AH11] approximates
\(e^{-itH}v\) by dividing the evolution into scaled steps and evaluating
each step with a finite Taylor polynomial. quantlop selects the scaling
and polynomial degree from the requested relative tolerance, then generates
the Taylor terms through direct applications of the Pauli-sum Hamiltonian.
Scaling and Taylor degree#
Let \(A=-itH\) and define the degree-\(m\) Taylor polynomial
Instead of evaluating one high-degree polynomial for \(e^A\), the algorithm uses
where \(s\) is a positive scaling factor. Taylor approximation is most effective when the norm of its argument is moderate. Dividing \(A\) by \(s\) reduces that norm, and applying the same polynomial \(s\) times recovers the evolution over the full time interval.
The two parameters express a cost trade-off. Increasing \(m\) makes each step more accurate but requires more Hamiltonian-vector products per step; increasing \(s\) makes the individual steps easier to approximate but requires more steps. For a Pauli decomposition
each \(P_k\) has unit matrix norm, giving the inexpensive bound
This bound can be computed directly from the Pauli coefficients. Parameter selection therefore needs only the compact Pauli representation and does not construct or inspect the full matrix.
Using this bound and the requested rtol, quantlop compares suitable
Taylor degrees and scaling factors. It chooses a combination expected to meet
the accuracy target with the fewest Hamiltonian-vector products.
Matrix-free recurrence#
For each of the \(s\) scaled steps, the Taylor action is accumulated using
with \(f_0=v\). Here \(b_k\) is the next term of the Taylor series and
\(f_k\) is the running polynomial approximation.
Within each step, \(v\) denotes its current input state. To compute
\(b_k\), quantlop applies \(H\) to \(b_{k-1}\) and
multiplies the result by \(-it/(sk)\). It never forms the matrix powers
\(H^k\); only the vectors needed for the current recurrence step are kept
in memory. Although \(m\) sets the maximum degree, evaluation stops
earlier when the next terms are already below the termination threshold.
The result of one scaled step becomes the input to the next. After \(s\) steps this produces the full evolution. Only a small fixed number of state-sized work vectors is needed, so memory usage remains linear in the state vector dimension and independent of the Taylor degree.
Krylov method#
The matrix-free Lanczos-Krylov method [Saad92] constructs a low-dimensional subspace from repeated applications of the Hamiltonian to the input state. It projects the evolution problem onto this subspace, evaluates the exponential of the resulting small matrix, and maps the evolved state back to the full state vector space.
Krylov subspace#
The powers of \(H\) appearing in the Taylor expansion above also motivate the Krylov method. For \(A=-itH\), the exponential action is determined by the sequence \(v,Hv,H^2v,\ldots\). Its first \(m\) vectors define the Krylov subspace
Since the Hamiltonian is Hermitian, an orthonormal basis for this subspace can
be constructed efficiently using the Lanczos recurrence. For a fixed
\(m\), this is generally easier over shorter evolution times or a narrower
relevant spectral interval. quantlop handles longer times or broader
spectra by increasing the dimension or using multiple time steps.
Rather than evaluating or truncating the power series term by term, the Krylov method projects \(H\) onto the orthonormal basis of the subspace, evaluates the exponential of the projected matrix, and maps the result back to the full state space. Increasing \(m\) generally improves the numerical approximation at the cost of additional matrix-vector products.
Lanczos iteration#
For a Hermitian matrix, the Lanczos algorithm constructs an orthonormal Krylov basis through a three-term recurrence involving only the current and previous basis vectors. Starting from a nonzero input \(v\), initialize
At iteration \(j\), the algorithm applies the Hamiltonian to \(q_j\) and removes its components along the current and previous basis vectors:
In exact arithmetic, Hermiticity ensures that \(r_j\) is orthogonal to every Lanczos vector constructed so far. Its norm and normalized direction provide the next recurrence coefficient and basis vector:
Each iteration requires one Hamiltonian-vector product. The coefficients
\(\alpha_j\) and \(\beta_{j+1}\) record how \(H\) acts within the
growing basis and later become the entries of the projected tridiagonal
matrix. Repeating this process produces the basis
\(q_1,\ldots,q_m\).
When \(\beta_{j+1}=0\), the current Krylov subspace is invariant under
\(H\): applying the Hamiltonian cannot generate a new direction, and the
recurrence terminates exactly. In floating-point arithmetic, quantlop
treats a sufficiently small \(\beta_{j+1}\) as this breakdown condition
and otherwise continues until reaching the automatically selected Krylov
dimension.
Projected evolution#
After \(m\) Lanczos steps, the basis vectors form the matrix
For a full state-space dimension \(N=2^n\), the matrix \(Q_m\) has shape \(N\times m\). Projecting the Hamiltonian onto this basis gives
In exact arithmetic, the Lanczos recurrence makes \(T_m\) real symmetric and tridiagonal, with the \(\alpha_j\) coefficients on the diagonal and the \(\beta_j\) coefficients on the adjacent diagonals:
Since \(q_1=v/\lVert v\rVert_2\), the input vector is represented in the Krylov basis by \(\lVert v\rVert_2 e_1\), where \(e_1=(1,0,\ldots,0)^T\) is the first coordinate vector. The Lanczos-Krylov approximation is therefore
The small exponential \(e^{-itT_m}\) evolves the Krylov coefficients, and \(Q_m\) maps the result back to the full state space. Because \(m\ll N\), the method evaluates the exponential of a much smaller tridiagonal matrix rather than that of the full Hamiltonian.
The matrix \(Q_m\) is useful for expressing the method, but
quantlop does not store all \(m\) basis vectors simultaneously.
It first runs the Lanczos recurrence to construct \(T_m\), computes the
small exponential, and then repeats the recurrence to reconstruct the evolved
state. This second pass uses additional Hamiltonian-vector products in
exchange for keeping only a fixed number of state-sized work vectors. Memory
therefore remains linear in \(N\), apart from the small
\(m\times m\) projected matrix.
References#
Awad H. Al-Mohy and Nicholas J. Higham, “Computing the Action of the Matrix Exponential, with an Application to Exponential Integrators,” SIAM Journal on Scientific Computing, 33(2), 488–511, 2011. https://doi.org/10.1137/100788860
Yousef Saad, “Analysis of Some Krylov Subspace Approximations to the Matrix Exponential Operator,” SIAM Journal on Numerical Analysis, 29(1), 209–228, 1992. https://doi.org/10.1137/0729014