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)ζbcvxg(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)eiω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).

Block Struct

We also add additional struct for the block encoding. It will hold additional variables that are required by the encoding process through - for adding block encodings (lcu), eliminating parts of existing block encodings (flag) or for diagonal block encoding (ind).
Finally, the following struct will hold both defined structs:

Now we are ready to block encode all parts of the equation. We show how to block encode each part of them, then combine them with Linear Combination of Unitaries. Let us look again on the equations: iω0g(x,v)ζbcvxg(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 ζbcvxg(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(3410010100010100010100143)=12Δx(0110110110)+12Δx(33100000000000000133)\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} The first matrix is a 1D x-derivative with dirichlet boundary conditions. The 2 diagonals are combined using LCU of modular adders, where the overfolwing terms are eliminated using a flag qubit.
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
derivative along x on the boundaries:
Combine matrices to get the block-encoding of the derivative term:

Diagonal vv Term

We use the assign_amplitude_table function, that performs the operation v0indv(f(v)1ind+1f2(v)0ind)|v\rangle|0\rangle_{ind} \rightarrow |v\rangle(f(v)|1\rangle_{ind} + \sqrt{1-f^2(v)}|0\rangle_{ind}), which is exactly a diagonal block encoding, where the additional indicator part of the block qubits. To save qubits we use implementation for arbitrary f(v)f(v), which is not scallable to large variable sizes. However, it is possible to perform it with a linear scaling in the number of qubits, using a primitive that block encodes f(v)=vvmaxf(v) = \sqrt{\frac{v}{v_{max}}} to the amplitude, using quantum comparator. To achieve the function f(v)=vvmaxf(v)=\frac{v}{v_{max}}, one can simply take the square of the block encoding, using qsvt or block encoding multiplication. For more details, see the qsvt notebook.

Non-Reflecting Boundary Conditions

The ζ\zeta term is enforcing non-reflecting boundary conditions, not allowing incoming waves to the system: ξbcx,v=({0,x=0,  v>0,0,x=2nx1,  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 to the advective term block encoding. Since each block encoding uses different block qubits, it is possible to create their multiplication without additional block qubits.
Keep track of the normalization factor of each part of the block encoding:

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 are located in different off-diagonals, there is no need for LCU here, and we can directly use control-else mechanism on the E variable. We also need to balance both terms to be on the same scaling (both are currently normalized according to the norm of each term), that is done using the function equalize_amplitude.

Full Block Encoding

The full block encoding is just a combination of all the terms using LCU. Notice that the diagonal term which has the same coefficient both for EE and gg is achieved by simply using the IDENTITY operation (= “do nothing”).
Output:

Extracting the Block Encoding Using Quantum Simulation

In order to get the resulting block encoded matrix using statevector simulation, we add a reference variable that duplicates the input variable before the application of the block encoding, thus surving as a marker for the input state before the application of the block encoding.
Compile the program:
Output:
Execute using state-vector simulation. To reduce resulting state-vector, filter out results where the block is different than
show the resulting block encoding:
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(xx0)22(ΔS)2j(S)= i \omega_0 e^{- \frac{(x - x_0)^2}{2 (\Delta_S)^2}}

QSVT Phases Calculation

Solve an optimization problem for the qsvt polynomial, and find the corresponding QSVT phases:
output
Output:

Full QSVT Circuit

image.png The QSVT projector is just checking whether the entire block is
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