Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
This demonstration is based on the paper Encoding of Linear Kinetic Plasma Problems in Quantum Circuits via Data Compression [1], and was created in collaboration with its authors. We explore how quantum algorithms can be used to solve a linearized kinetic model of plasma, focusing on a simplified Vlasov-Ampère system in one spatial dimension with an external electric field. Plasmas - often called the fourth state of matter - are ionized gases consisting of charged particles. They exhibit rich collective behavior due to long-range electromagnetic interactions. Understanding and simulating plasmas is critical in many fields, especially in nuclear fusion, where plasma must be confined and controlled inside reactors such as tokamaks [2]. Fusion energy aims to replicate the Sun’s energy source on Earth. In magnetic confinement fusion (e.g., tokamaks), charged particles spiral along magnetic field lines. To predict plasma behavior in such systems, physicists use kinetic equations, which describe the full distribution of particle positions and velocities in phase space. However, these models are nonlinear and high-dimensional, making simulations extremely expensive. To make progress, scientists often linearize the models around a known steady-state.

The Vlasov-Ampère System

We consider a linearized 1D Vlasov-Ampère system with an external driving current. This system governs how perturbations to a background plasma evolve in phase space under the influence of electric fields. The equations are: iω0g(x,v)−ζbc v ∂xg(x,v)−∂vf0(v)E(x)=0i \omega_0 g(x, v) - \zeta_{bc} \, v \, \partial_x g(x, v) - \partial_v f_0(v) E(x) = 0 iω0E(x)+∫vg(x,v) dv=j(x)i \omega_0 E(x) + \int v g(x,v) \, dv = j(x)

Physical Meaning and Assumptions

  • g(x,v)g(x,v) is the first-order perturbation of the distribution function from equilibrium. It captures how particles deviate from their steady-state behavior: f(x,v,t)=f0(v)+g(x,v)e−iω0tf(x, v, t) = f_0(v) + g(x,v) e^{-i \omega_0 t}.
Here we assume the background is homogeneous and so f0(v)=n02πTexp⁡(−v22T)f_0(v) = \frac{n_0}{\sqrt{2\pi T}} \exp\left(-\frac{v^2}{2T}\right).
  • E(x)E(x) is the (complex) electric field.
  • j(x)j(x) is a known source term (e.g. external driving or antenna).
  • ζbc\zeta_{bc} encodes non-reflecting boundary conditions:
    • ζbc=1\zeta_{bc} = 1 for outgoing waves.
    • ζbc=0\zeta_{bc} = 0 for incoming waves.
  • All variables in the equation were normalized such that we get dimensionless equations (see more details in the paper).

Discretizing the variables xx and vv leads to very large linear systems. Upon discretization, they form a structured linear system suitable for block encoding, making them compatible with quantum linear solvers. In the next sections, we will show how to construct block encoding for the equations using classiq, then plug it to a linear solver (QSVT in this case) to solve a certain toy problem. We emphasize that due to the dependence of the linear system solver on the condition number - O(κlog⁡(1ϵ))O(\kappa \log(\frac{1}{\epsilon})), and the dependece of the condition number in the grid size, we don’t expect any quantum advantage for the 1D system. However, generalizing for higher dimensional systems should be straightforward thanks to the high level modeling approach.

Block Encoding of the Linear System

image.png In the following section we describe how to assemble the block encoding of the equations using Classiq.”Notice that in order to have a simulatable circuit, sometimes we use non-scallable functions that have better measures for small number of qubits - these are the arbitrary state preparation and amplitude assignment functions. However, we describe how to replace them with scalable alternatives. First, choose the parameters of the problem:

Data Encoding

We define a quantum struct that will define the mapping of the coordinates to the effective block-encoded matrix of the problem:
v holds the velocity coordinate as a signed number, as the velocity can hold negative values as well. x holds the position coordinates. It will encode a non-negative number in the range [0,xmax][0, x_{max}] The value E switches between the encoding of g(x,v)g(x, v) (for E=0) and E(x)E(x) (for E=1, v=0). Notice that the values E=1, v!=0 are redundant (in fact we could eliminate them through the projector of the block encoding, but we keep them as they don’t change the reuslt). The block variable needed by each block encoding is managed automatically by the BlockEncoding combinators (+, @, weighted_sum, tensor_product) as we compose them below.
Now we are ready to block encode all parts of the equation. We show how to block encode each part, as well as the final matrix, using block encoding built-in implementations and block encoding arithmetics. Let us look again on the equations: iω0g(x,v)−ζbc v ∂xg(x,v)−∂vf0(v)E(x)=0i \omega_0 g(x, v) - \zeta_{bc} \, v \, \partial_x g(x, v) - \partial_v f_0(v) E(x) = 0 iω0E(x)+∫vg(x,v) dv=j(x)i \omega_0 E(x) + \int v g(x,v) \, dv = j(x) The matrix we encode will have a row for each gg‘s degree of freedom, and a row for each EE dof. The columns represent the participating terms in each equation.

Block Encoding: Advective Term

Notice that the advective term ζbc v ∂xg(x,v)\zeta_{bc} \, v \, \partial_x g(x, v) is in the upper left corner of the block encoded matrix (as it only involves gg). Ignoring ζbc\zeta_{bc} part, the term is a tensor product of 2 block encodings - a diagonal vv encoding, and a derivative term.

Derivative Term

The derivative term consists of normal finite-difference rule intermediate x points. At the boundaries of xx, the derivative is according to a 2nd order interpolating polynomial (as described in the paper Eqs.19). We decompose it as a sum of 2 matrices: 12Δx(−34−10⋯0−1010⋯00−101⋯0⋮⋱⋱⋱⋱⋮0⋯0−1010⋯01−43)=12Δx(01−101−10⋱⋱⋱1−10)+12Δx(−33−10⋯0000⋯⋯0⋮⋮⋮⋮0000⋯00001−33)(1)\frac{1}{2\Delta x}\begin{pmatrix} -3 & 4 & -1 & 0 & \cdots & 0 \\ -1 & 0 & 1 & 0 & \cdots & 0 \\ 0 & -1 & 0 & 1 & \cdots & 0 \\ \vdots & \ddots & \ddots & \ddots & \ddots & \vdots \\ 0 & \cdots & 0 & -1 & 0 & 1 \\ 0 & \cdots & 0 & 1 & -4 & 3 \end{pmatrix} = \frac{1}{2\Delta x}\begin{pmatrix} 0 & 1 & & & \\ -1 & 0 & 1 & & \\ & -1 & 0 & \ddots & \\ & & \ddots & \ddots & 1 \\ & & & -1 & 0 \end{pmatrix} + \frac{1}{2\Delta x}\begin{pmatrix} -3 & 3 & -1 & 0 & \cdots & 0 \\ 0 & 0 & 0 & \cdots & \cdots & 0 \\ \vdots & & & \vdots \\ \vdots & & & \vdots \\ 0 & 0 & 0 & 0 & \cdots & 0 \\ 0 & 0 & 0 & 1 & -3 & 3 \end{pmatrix}\qquad (1) The first matrix is a 1D x-derivative with dirichlet boundary conditions, a matrix composed by constant diagonals.
For the boundary conditions matrix, we use a flag for applying it only on the first and last row. Additionaly, a control on the MSB of the x variable to take care for both edges of the system. It is assumed that the size of x in qubits is at least
The block encoding for the derivative along x on the boundaries:
Combine matrices to get the block-encoding of the derivative term (Eq. (1)):

Diagonal vv Term

The velocity coordinate vv (scaled by vmaxv_{max} and signed) is a diagonal matrix in the (x,v)(x, v) basis. BlockEncoding.from_dense_diagonals builds this directly from the array of diagonal values.

Non-Reflecting Boundary Conditions

The ζ\zeta term is enforcing non-reflecting boundary conditions, not allowing incoming waves to the system: ξbc ∣x,v⟩=({0,x=0,  v>0,0,x=2nx−1,  v<0,1,otherwise)∣x,v⟩.\xi_{\mathrm{bc}} \, |x,v\rangle = \left( \begin{cases} 0, & x = 0,\; v > 0,\\[4pt] 0, & x = 2^{n_x}-1,\; v < 0,\\[4pt] 1, & \text{otherwise} \end{cases} \right) |x,v\rangle .
Combine the advective term block encoding: take the tensor product of v_encoding and derivative_be, then multiply by zeta_be to enforce the non-reflecting boundary conditions. Since the action factors into an operation on vv (V=diag(v)V = \mathrm{diag}(v), from v_encoding) and one on xx (DxD_x, from derivative_be), i.e. V∣v⟩⊗Dx∣x⟩V|v\rangle \otimes D_x|x\rangle, we combine them with BlockEncoding.tensor_product(v_encoding, derivative_be). Throughout this notebook we write A⊗BA \otimes B for tensor_product(be_A, be_B), with AA acting on the low-order (least-significant) qubits and BB on the high-order qubits - matching BEData’s (v,x,E)(v, x, E) bit order. Multiplying by zeta_be (diagonal in (x,v)(x,v)) then gives advective_encoding=Ξbc (V⊗Dx).\mathrm{advective\_encoding} = \Xi_{bc} \, (V \otimes D_x).

Eliminating the Lower-Right Block (E = 1)

Since E distinguishes between the gg block (E=0) and the EE-field block (E=1), and the advective term only acts on gg, we need to zero out the E=1 rows and columns. e0_encoding is the block encoding of the projector onto E=0, i.e. PE=0∣E⟩P_{E=0}|E\rangle. Taking its tensor product with advective_encoding (as the low-order factor, matching BEData’s (v, x, E) bit order) gives the block encoding of the full advective term: first_part_encoding=advective_encoding⊗PE=0,PE=0=(1000).\mathrm{first\_part\_encoding} = \mathrm{advective\_encoding} \otimes P_{E=0}, \qquad P_{E=0} = \begin{pmatrix}1&0\\0&0\end{pmatrix}.

Block Encoding: Off Diagonal Terms

Block encode the force and current terms, corresponding to the upper right and lower left blocks.

Loading the Force Term

In our setting ∂vf0(v)E(x)=v2πexp⁡(−v22)E(x)\partial_v f_0(v) E(x) = \frac{v}{\sqrt{2 \pi}} \exp \left(- \frac{v^2}{2 } \right)E(x) It is a column vector in the matrix, and to load it we have several options. One is to first load one of them (vv or H(v))H(v)) as a state, then use amplitude loading of the other one to create a block encoding of the multiplication. A second option that we use here is to directly prepare the state of the multiplication. The advantage is a better scaling factor. It can be performed as suggested here [3] (though for this specific method there would still be a scaling factor issue). For simplicity we use here the general state preparation method (which is not scallable). Finally, we zero the columns for which v != 0, beacuse we want only columns that encode the field EE.

Current Term

The current term is an integration, represented by row multiplication: ∫vg(x,v) dv\int v g(x,v) \, dv To load v, a linear state-preparation is enough. This can be done using the method in [4]. Because we only have equations with this term for the EE degrees of freedom, we zero columns where v != 0.
As both terms are normalized and located in different off-diagonals, there is no need for LCU here - we can directly select between them with a control/else on the E qubit. Since each term is normalized to its own scale, we also rebalance them to a common scale using a diagonal block encoding of diag(force_be.alpha, current_be.alpha) on the E qubit. We first define a helper function that encodes two block encodings on the upper-right and lower-left of a bigger matrix. The bigger matrix is defined by the MSB of the data variable (the E field in our case).
Next, we define the two block encodings to assign on the off diagonal blocks, and build the off-diagonal terms of our final block encoding. Both the force and current terms act only on vv, with the identity on xx, i.e. F(v)∣v⟩⊗Ix∣x⟩F(v)|v\rangle \otimes I_x|x\rangle (and similarly for the current term) - so a tensor product with vv as the low-order factor (matching BEData’s bit order) builds it directly: force_be=F(v)⊗Ix,current_be=C(v)⊗Ix,\mathrm{force\_be} = F(v) \otimes I_x, \qquad \mathrm{current\_be} = C(v) \otimes I_x, where F(v)F(v) and C(v)C(v) are the (rank-1, column/row) operators encoded by force_term_be/current_term_be.

Full Block Encoding

The full block encoding is just a combination of all the terms. Notice that apart from the upper-left and off-diagonal blocks, we have a diagonal term iω0i\omega_0.
We can inspect the block encoding quantum program
Output:

Inspecting the Block Encoding

BlockEncoding.to_matrix() reconstructs the encoded matrix directly via statevector simulation. show the resulting block encoding:
Output:
Output:
output

Linear Solver Using QSVT Matrix Inversion

Now we use the block encoding to solve the equation. We only left to encode the external source we want to solve for as initial state, and apply matrix inversion on the it. Because the condition number of the resulting matrix is high for our simulation, we limitied ourselves for small grid size, on which the problem solution is not physical, though we show it for educational purposes.

Initial State Loading

We solve for a source term localized at x0x_0, according to the following formula: j(S)=iω0e−(x−x0)22(ΔS)2j(S)= i \omega_0 e^{- \frac{(x - x_0)^2}{2 (\Delta_S)^2}}

Matrix Inversion via QSVT

BlockEncoding.inverse() builds the QSVT-based matrix inversion directly from full_be_encoding, given the matrix’s condition number (kappa) and a target polynomial degree.
Output:

Full QSVT Circuit

image.png inv_be.unitary() already wraps the QSVT projector and phase sequence internally, so main only needs to prepare the source term and call it.
Output:
Output:

Post-Process

Here we plot the resulting EE vector.
Output:
output

Compare to a Classical Solver

Output:
output

References

[1]: Novikau, I., Dodin, I.Y., & Startsev, E.A. (2024). Encoding of linear kinetic plasma problems in quantum circuits via data compression. Journal of Plasma Physics, 90(4). https://doi.org/10.1017/S0022377824000795 [2]: Tokamak (Wikipedia). [3]: McArdle, S., Gilyén, A., & Berta, M. (2025). Quantum state preparation without coherent arithmetic. arXiv:2210.14892 [quant-ph]. https://arxiv.org/abs/2210.14892 [4]: Gonzalez-Conde, J., Watts, T. W., Rodriguez-Grasa, P., & Sanz, M. (2024). Efficient quantum amplitude encoding of polynomial functions. Quantum, 8, 1297. https://doi.org/10.22331/q-2024-03-21-1297