The Bethe Ansatz as a Quantum Circuit

The Bethe ansatz is an analytical method to solve exactly solvable models in quantum mechanics. It has been shown that the states of the Bethe ansatz can be prepared by a deterministic quantum circuit whose quantum gates were determined numerically. We report our progress in recasting the Bethe ansatz as a deterministic quantum circuit. We present the analytical expressions of the quantum gates. Formulae rely upon diagrammatic rules that define the wave functions of the Bethe ansatz by matrix product states. Based on the analytical expressions, we prove the unitarity of the quantum gates. We use our results to clarify on the equivalence between the coordinate and algebraic Bethe ansatze in light of matrix-product states.


Introduction
In 1931 Hans Bethe introduced an ansatz for the eigenstates of the antiferromagnetic Heisenberg Hamiltonian in a closed spin-1/2 chain [1].This ansatz involves the summation of permutations of plane waves, with their quasi-momenta coupled through transcendental equations known as Bethe equations.This groundbreaking study marked the inception of exactly solvable models in condensed matter physics and statistical mechanics [2][3][4].Subsequently, the Bethe ansatz was expanded to encompass the XXZ model [5], the one-dimensional Bose gas with delta function interactions [6], the Hubbard model [7], and a plethora of other systems [8][9][10][11].
At the core of the exact solutions for these models lies their integrability, which denotes the presence of a maximal number of conserved quantities [12].The latter naturally emerge within the framework of the Algebraic Bethe Ansatz (ABA), pioneered by the Faddeev's school in the 70s-80s [13].This approach unveils the algebraic underpinnings of the Bethe ansatz, which are based on an R matrix that fulfils the Yang-Baxter equation.
In recent years the study of quantum many body systems has been strongly influenced by quantum information theory and quantum computing.In turn, this has led to a more profound understanding of the structure of many body wavefunctions, in particular with regards to entanglement structure.It was discovered that tensor networks provide the natural language with which to express entanglement structure in many body wavefunctions.A one-dimensional tensor network is a Matrix Product State (MPS), for a summary see [14][15][16].In view of these developments, it was natural to revisit the Bethe ansatz and explore how it could be reframed in the language of tensor networks.This was undertaken in [17][18][19], where a huge variety of exact integrable quantum chains were expressed in a unified way using matrix product ansatze, that are essentially equivalent to the ABA [20,21].
In parallel, the quantum computing community pursued the construction of efficient quantum circuits to prepare many body wavefunctions on quantum computers, taking advantage of the exact solutions derived for models such as the XY and Ising models.This was achieved either by the mapping of these models to free fermions [22,23] or by the elaboration on spin variables directly [24].However, the challenge of determining how to construct quantum circuits for models that involve interactions remains.In this work, we directly address this problem.We do so by considering a highly pertinent question: could the Bethe ansatz, which describes interacting models, be adapted to the newly introduced quantum computers?[25].Among the reasons behind this inquiry is the potential to compute traditionally inaccessible quantities via measurement, such as correlation functions with arbitrary ranges and higher orders [26].This might lead to a quantum advantage within this particular framework, which could be implemented in the currently available quantum computers.It is worth noting that low-energy states of integrable gapped spin chains can be prepared with MPS efficiently [14][15][16]27].However, both highly excited states of gapped spin chains and general states of ungapped integrable spin chains are out of reach for classical simulatability.
Progress in this direction was made in [28,29], where an algorithm to prepare eigenstates of the XXZ model was introduced.The algorithm complexity was polynomial in both the number of T gates and circuit depth.However, its probabilistic nature resulted in the success rate to diminish exponentially [30].Its applicability was moreover confined to real valued solutions of the Bethe equations, which presented a significant limitation.
A different pathway for creating a quantum circuit linked to the Bethe ansatz was introduced in [31], by using its algebraic representation.In contrast to the previously discussed approach rooted in the original plane wave ansatz, this alternative method leverages viewing the ABA as an MPS.Consequently, it could be transformed into a quantum circuit using conventional techniques from the field of tensor networks.The resulting circuit, termed Algebraic Bethe Circuit (ABC), offer the advantages of being deterministic and applicable to any solution, whether real or complex, of the Bethe equations.
ABCs are formulated in terms of multiqubit quantum gates.The algorithm complexity therefore translates into the efficiency of their decomposition in terms of one-qubit and two-qubit unitaries.While an efficient decomposition was proposed for the noninteracting XX chain, no conclusive answer was found for the XXZ model.The difficulty inherent to this problem was exacerbated by the lack of analytical expressions in a closed form for the gates comprising the circuit.Indeed, closed expressions were only obtained for scenarios involving one or two magnons, while more complicated cases were addressed numerically.
In this paper we comprehensively study the transformation leading to the ABC and arrive at an analytical expression for the quantum gates that form the ABC.Instead of relying on the MPS interpretation of the ABA, we use a simpler MPS structure underlying the Bethe ansatz.This structure turns out to be naturally linked to Bethe plane wave ansatz, also known as Coordinate Bethe Ansatz (CBA).Remarkably, the CBA related MPS can be encoded in a set of diagrammatic rules, which we exploit to present our findings.The shift from the ABA to the CBA ultimately enables us to provide complete analytical expressions for the unitary matrices that comprise the quantum circuit.These results are summarized in the following figure (1) The equivalence between the ABA and the CBA was proven soon after the systematic analysis of quantum integrability began.This equivalence, which holds independently of the Bethe equations, is highly nontrivial [32].Interestingly, the MPS reformulation of the coordinate and algebraic versions of the Bethe ansatz will lead us to novel insights into their equivalence, from which we recover the integrability constraints contained in the Yang-Baxter equation.
The paper is organized as follows: Section 2 provides a review of the Bethe wavefunction for the XXZ model, its representation through the ABA, and introduces the quantum circuit structure outlined in [31].Section 3 presents the Hilbert space structure based on the U (1) symmetry of the model, highlighting the resulting gate decomposition within the quantum circuit.Section 4 introduces the proposed analytic form of the general ABC gates, drawing inspiration from the simple one-magnon case.Section 5 introduces a set of diagrammatic rules defining an MPS that builds Bethe wavefunctions.Section 6 implements the transformation of this MPS into canonical form [14][15][16], such that valid quantum gates can be distilled.Section 7 shows how to obtain a deterministic quantum circuit.Section 8 offers a proof of the unitarity of the proposed circuit.Section 9 proposes an alternative understanding of the equivalence between the ABA and the CBA.Section 10 specializes the construction to the XX model, and presents an efficient decomposition of the associated ABC gates into two-qubit unitaries.Section 11 concludes by summarising key findings and contributions.Several appendices explain technical issues.

Algebraic Bethe Circuits
In this section we introduce the trial wavefunctions that are at the basis of the Bethe ansatz, and review the construction of their quantum circuit representation proposed in [31].

Bethe wavefunctions
The trial wavefunctions of the Bethe ansatz are linear superpositions of spin waves, also called magnons.Their construction relies upon the presence of a U (1) symmetry whose conserved quantity is the projection of the total spin along a chosen direction, which customarily is taken to be the z axis.The U (1) symmetry implies the conservation of the total number of magnons.Due to integrability, the interaction among magnons factorizes in two-body scattering events that preserve the value of their individual momenta.
Throughout the paper we focus on a spin-1/2 chain.Together with the requirements of integrability, the presence of U (1) symmetry and nearest neighbours interaction, this leads to the XXZ Heisenberg model described by the Hamiltonian where σ α j (α = x, y, z) are the Pauli matrices acting at the site j = 1, . . ., N , and σ α N +1 = σ α 1 for periodic boundary conditions.One spin-1/2 site and one qubit share the same Hilbert space, namely, H = C 2 .We will then identify the spin basis with the computational basis of a qubit by The U (1) symmetry allows us to choose |0 N ⟩ = |0⟩ ⊗N as a reference state, where N is the total number of sites of the chain.Magnons are spin waves over this reference state, such that the number of magnons counts the amount of sites in the state |1⟩.
Imposing periodic boundary conditions on the trial wavefunctions leads to the Bethe equations for the magnon momenta.In this paper, however, we will only be concerned with the preparation of the trial wavefunctions on a quantum computer.We refer to them as Bethe wavefunctions, as opposed to Bethe eigenstates which are the result of applying the Bethe equations.Therefore, the boundary conditions should be addressed separately.
As an example let us consider the Bethe wavefunction describing two magnons supported by N qubits.It reads where we defined the variables x a = e ipa , with p a the magnon momenta, and |n 1 n 2 ⟩ denotes the state of the computational basis of N qubits with |1⟩ at positions n 1 and n 2 .The only input of the construction is the scattering amplitude which encodes the scattering S matrix between two magnons In the XXZ model the function s 12 is given by where ∆ is the coupling constant appearing in the Heisenberg Hamiltonian (2).If the scattering amplitude is symmetric, the S matrix reduces to a sign flip, in which case there exists a Jordan-Wigner transformation that maps the system to free fermions [33].This result is consistent with the antisymmetry of the wavefunction under the exchange of momenta p 1 and p 2 .
For M magnons, the Bethe wavefunction is with n m signalling the position of the qubits at |1⟩.The choice of ansatz (8) is suitable for the consideration of periodic boundary conditions.By the assumption of two-body factorization, the coefficients are proportional to the product of phase shifts (5) corresponding to the permutation that brings 1, . . ., M into a 1 , . . ., a M .Note that (8) is antisymmetric under permutations of any pair of momenta, and thus vanishes whenever two of them coincide.It should be stressed that the state (8) is not normalized.We shall return to this fact in due course.The previous construction of the wavefunction is known as Coordinate Bethe Ansatz, or CBA for short.

From ABA to a quantum circuit
As explained in the introduction, there exists an algebraic approach to compute Bethe wavefunctions, termed Algebraic Bethe Ansatz or simply ABA, which exploits the quantum integrability of the system explicitly.The wavefunction in the ABA is built upon the action of magnon creation operators B(p) on the reference state The proportionality factor ρ, which in general depends on the momenta p a , makes it clear that the norm of the states produced by the CBA and the ABA need not coincide.The operators B(p a ) admit a tensor network representation in terms of the R matrix.
The R matrix defines a map on the tensor product of the Hilbert space of a site, H phys , and an auxiliary Hilbert space, H aux .The role of the latter is to input the required number of |1⟩ states into the network.Graphically, the ABA tensor network is given by (10) Rounded boxes denote that the R matrices are nonunitary.Each R matrix depends on one magnon momentum, R a = R(p a ), and each row of R matrices, all of them depending on the same momentum, defines the operator B(p a ).This network can be recast in the circuitlike form (11) where the tensors R T follow from the contraction of the R matrices in a column of (10).This reinterpretation requires N physical plus M ancillary qubits.
The output state of every ancillary qubit must be set to |0⟩ to recover the correct state (9) in the physical qubits.In spite of the suggestive form, neither R nor the R T are unitary, and thus do not define quantum gates.
In [31], a procedure was presented to distil unitary gates out of R T , and at the same time eliminate the ancillary qubits.The procedure eventually supplies the following deterministic quantum circuit (12) which was named Algebraic Bethe Circuit or ABC.Sharp boxes denote the gates are unitary.The gates P k are the solution to certain recursion relations involving R T .These recursion relations were solved numerically in [31], although analytical expressions were obtained for wavefunctions describing one and two magnons.In this paper we follow a different approach.Instead of focusing on the recursion relations, we will propose an informed ansatz for the ABC gates.A partial proof and strong numerical arguments will be then given in favour of its validity.In this way, we derive the complete solution of the quantum circuit preparing the wavefunction (8) for an arbitrary number of magnons and sites.Although integrability motivates (8) and determines the scattering amplitude to have the form (7), we note that the construction presented in the next sections applies for an arbitrary scattering amplitude s 12 .

Symmetry sectors
We introduce here our notation, which relies on the assumed U (1) symmetry of the integrable chain.We first present an efficient way to index the computational basis states belonging to different symmetry sectors.We then exploit both the symmetry and the staircase structure of the ABC to break down the P k gates into a collection of restricted maps.

Hilbert space
The Hilbert space of k qubits, H k = (C 2 ) ⊗k , is spanned by the computational basis We stress that we order qubits from left to right.The Hilbert space H k decomposes into symmetry sectors with definite total spin along the z axis, which, by the assumption of U (1) symmetry, will be preserved by the quantum gates.The decomposition , where H r,k is the subspace with r The restriction of the computational basis to the r symmetry sector can be equivalently described with the notation |n 1 . . .n r ⟩ of Section 2, which singles out the location of qubits at |1⟩ When we need to represent graphically the state of the qubits, we shall use a red line for |1⟩ and a black line for |0⟩.The dimension of H r,k is the binomial coefficient whose sum, using the binomial expansion, gives the dimension of H k .
To describe the symmetry structure of the quantum gates, it would be convenient to label the basis states of each sector with an integer a = 1, . . ., d r,k .This is easily achieved as follows.Let the tuple (i 1 . . .i k ) r describe a computational basis state belonging to H r,k .We can use its binary digits to define an integer We sort every possible χ in an ordered list and assign to each χ the number a that indexes its position in the list.We illustrate the map with the example k = 4 and r = 2 in the table below. (18)

Gate structure
The quantum circuit (12) creates a Bethe wavefunction supported by N qubits.It contains N − 1 gates P k , which can be classified in two types.When k is smaller than the number of magnons, M , the gates P k act on a number of qubits that grows as k + 1.We will refer to them as short gates.They are crucial to obtain a deterministic quantum circuit.On the contrary, the gates with k ≥ M act on a fixed number of M + 1 qubits.We will call them long gates.First we describe the symmetry structure of the long gates.Their rightmost input qubit is by construction always at |0⟩, as can be seen in (12).Hence, for our purposes, only the map is relevant.Due to the underlying symmetry, this map decomposes as k , where is the restriction of (19) to input and output configurations with r qubits in |1⟩.In components, it reads Without loss of generality, we have chosen The last row vanishes because there is no input state in the symmetry sector r = M + 1.
The small ABC gates are k + 1 qubit unitaries with no restriction on the input configurations.Therefore we need to determine the complete map Breaking down into components restricted to different symmetry sectors, we have k , or equivalently where we have set Up to now we have been exploiting the U (1) symmetry of the integrable model.We can also consider the staircase structure of the ABC.As is clear from (12), the leftmost output qubit of each P k is not affected by any other quantum gate.Hence, it determines how many qubits in the state |1⟩ will flow through the rest of the circuit.It is thus convenient to further split the symmetry reduced maps , with i = 0, 1, which make explicit the final state of this qubit The depiction of long and short gates is, respectively, The input and output configurations to the left map satisfy An analogous condition holds for the right map We recall rounded boxes in (24) stress that P (i,r) k need not be unitary.We have moreover introduced a notation that will serve us along the paper.We denote in parenthesis the state of those qubits which are already explicitly or implicitly described by P (i,r) k , and therefore do not count as input or output to these matrices.This is the case of the leftmost output qubit, associated to the superscript i, and the rightmost input qubit of long gates, which is fixed to |0⟩.The main properties of the matrices P (i,r) k are collected in the following table.
4 Ansatz for the ABC gates Below we propose analytical expressions for the maps P (i,r) k building the ABC gates with arbitrary M and N .In order to motivate our ansatz, we start by reviewing the construction of the ABC in the simple case M = 1, which was derived in [31].

One-magnon states
The Bethe wavefunction (8) for one magnon is with x = e ip .When the magnon momentum is real, we obtain a plane wave.The previous state is unnormalized.By construction, the ABC should prepare its normalized version where N |Ψ (1) The circuit (12) in this simple case only contains twoqubit gates, reducing to All gates are of the type denoted in Section 2 as long gates, whose rightmost input qubit is always in the state |0⟩.The decomposition into symmetry protected blocks of their relevant entries is given in (20).
The only nontrivial block is k , which can be determined as follows.
We focus first on the leftmost qubit of the circuit.It is only acted upon by the gate P N −1 .In order to reproduce the coefficient of the state The second entry of P (1) N −1 is then fixed, up to a phase, by unitarity (33) In the last equality, we have used the recursion relation which is easily derived from (30).It relates the norms of the wavefunctions supported by N and N −1 qubits.This is the first of a series of recursion relations with the same property that will be crucial in our construction.Since (33) moves the input state |1⟩ one position to the right, it seems natural to adjust the free phase such that it reproduces the plane wave momentum: We turn now to the second leftmost qubit.It is acted upon by two gates, such that the coefficient of the state Therefore, P N −2 must cancel the normalization factor C N −1 , such that the correct normalization of the wavefunction of N qubits is restored.Making the same choice for the free phase, this implies that P is given again by expressions (32) and (33) upon replacing N by N − 1.We arrive at the following result implied by the recursion relation (34).The subcircuit formed by the gates P k with k < N − 1 creates a plane wave of the same momentum p but supported on N −1 qubits.Iterating these arguments, we obtain where we have decomposed P (1) k according to (23).The function C k encodes the norm of the wavefunction (28) Contrary to the tensor R T in (11), which is directly derived from the ABA, the ABC unitaries have an explicit dependence on the gate index k.

Gate ansatz
We will use the results of the previous section to propose an ansatz describing the general ABC gates, preparing M magnon states.When M = 1, we only had to consider the normalization of the states emerging from the single R matrices at each step of (11).
In the general case, the distillation of unitaries out of the tensor R T implies a more involved problem.Namely, the normalization and orthogonalization of the wavefuncions created by the rightmost k tensors of the network (11).Recall that for that partial circuit the input to the leftmost M legs of the lower R T can be an arbitrary state.This means that the single function (37) has to be promoted to a set of matrices which should contain the information about norms and overlaps inside each symmetry sector, necessary to turn (11) into a valid quantum circuit.We will refer to them as overlap matrices.Accordingly, we generalize with the matrix A While the matrices A and B implement the change to an orthonormal basis, Λ (i,r) should be responsible for building the coefficients of the Bethe wavefunction (8).
The ansatz (40) has a clear MPS inspiration.An MPS is an approximation to the multileg tensor in the right hand side (rhs) of (15) given by the product (41) which is defined with the help of an auxiliary Hilbert space living on the horizontal links.The three-leg tensor Λ can be promoted to a matrix satisfying Λiβ α0 = Λ i αβ , where α and β take values in the auxiliary space and i is a physical index.Using this matrix, (41) admits the circuitlike representation The ABA constructing M magnons states can be very directly interpreted as a MPS network [31].Indeed, the previous figure is equivalent to (11), with (42) given by R T .The auxiliary space in that case is the Hilbert space of M qubits, and The MPS has a large gauge freedom, corresponding to a change of basis in the auxiliary space (44) which can vary from link to link.Using this freedom, it is always possible to transform such that the associated matrices (42) are unitary and (43) defines a valid quantum circuit.An MPS with this property is said to be in canonical form [14][15][16].The transformation into canonical form was the procedure used in [31] to bring the ABA into the ABC.
The matrices X k were determined by recursion relations too involved to be analytically solved in the general case.Here we will pursue an ansatz of the same structure but different components, in search of a simplification.Indeed, (40) has the form (45) with A identified with X and B with its inverse.This idea will lead us to an MPS tensor naturally linked to the CBA.
We will focus first on the long gates, whose graphical representation is where we used the notation explained in (24).All the matrices in the ansatz (40) for long gates act on M qubits.Their properties are described in the table below Our ansatz for the short ABC gates, which are crucial for obtaining a deterministic quantum circuit, entails some peculiarities.We postpone their discussion to Section 7.

The Λ tensors
Here we present our proposal for the matrices Λ (i,r) .The simple M = 1 circuit reviewed in Section 4.1 will serve us again as a guide.

Diagrammatic rules
We start by analysing the case when the leftmost output qubit of a long ABC gate is in the state |0⟩, denoted with the superscript i = 0.It is instructive to revisit the one magnon result for P (0,1) k and compare it with the decomposition (40) (48) In the gate like representation (42), the MPS tensor shifts one site to the right the lines associated to H aux .For clarity, we represent in parenthesis the qubits belonging to H phys , on which the matrix Λ (i,r) does not act.We also highlight in red the flow of qubits in the state |1⟩.
From (48) we immediately obtain Λ (0,1) = x, which has the appealing interpretation of arising from the displacement of the input |1⟩ one position toward the right.Extrapolating this intuition to the general case, we propose that Λ (0,r) is a diagonal matrix whose entries are the momentum factors arising from displacing its input state one site to the right.This prescription is better understood with a graphical example.Let us consider a long gate of an ABC creating a three-magnon state in the r = 2 symmetry sector.The action of Λ (0,2) on the input state |110⟩ will be (49) Namely, a factor x n arises for each red line at the nth input position, counted from left to right, where n can take values 1, . . ., M .
Interestingly, (49) hints toward the construction of Λ (1,r) .In this case the leftmost output qubit is by definition in the state |1⟩.If we follow the same prescription as before, a red line should now traverse the green area from the bottom right to the upper left.But this implies that the rightmost input qubit needs to be in |1⟩, while by assumption the rightmost input qubit of a long gate is in |0⟩.We overcome the difficulty by completing the shift realized by (49) with a previous operation.It will be represented in yellow and implements permutations between the fixed rightmost |0⟩, which we represent graphically as (0), and one of the input qubits in |1⟩.The rightmost qubit of the output is at |1⟩, and we denote it by (1).Taking as example the input state |110⟩ to Λ (1,2) , we obtain the following two possible outcomes (50) We define the matrix Λ (1,r) as the result of performing first this permutation and then the shift represented by (49).For the same example, the complete action of Λ (1,2) thus is It should be stressed that no shift factor is associated with the red line crossing the green area diagonally from bottom right to upper left.The fact that this line is red, contrary to the situation in (49), is however important.When r > 1 some of the red lines necessarily cross.Every time this happens, we add a scattering contribution which depends on whether the crossing happens in the yellow or green areas The numbers inside the orange circle indicate which lines cross, with n labelling the left input line and m the right one.The crossings inside the green area carry the dynamical information of the model.The role of those in the yellow area is to ensure the correct antisymmetrization factors.Collecting all ingredients, (51) results into Now we translate the previous set of diagrammatic rules into mathematical expressions.First, we consider the diagonal matrix Λ (0,r) .In order to characterize the shift toward the right in (49), we introduce collective momentum variables.Associated with an input configuration in the r symmetry sector with qubits in |1⟩ at positions n 1 , . . ., n r , we define The integer a = 1, . . ., d r,M labels efficiently all possible configurations, as explained in Section 3.1.See We define Λ (0,0) = 1, hence x (0) 1 = 1 in the zeromagnon sector.Let us move now to i = 1, where the information about scattering is contained.By definition, Λ (1,r) acts as a link between the r and r − 1 symmetry sectors.The transition between the two sectors happens in (50), where an input 1s is swapped with the fixed rightmost (0).This can be described as a → a m , meaning for m = 1, . . ., r.The action in the green area of (51) is again diagonal, given by (55) upon replacing r with r − 1.Finally, we have to add the multiplicative scattering factors (52).Collecting all pieces, we obtain with a and a m related as in (56), and s nmnm absent.

From ABC to CBA
According to the logic of the ansatz (40), the MPS tensor defined by the symmetry restricted maps Λ (i,r) and should reproduce the Bethe wavefunctions (8).We will prove in Appendix B that this is indeed the case.
Here we illustrate how the component |n 1 n 2 ⟩ = |13⟩ of the two-magnon state (4) is reproduced by our diagrammatic rules.For that, it is enough to analyse the action of the first three Λ matrices (60) We correctly obtain

⟨13|Ψ
(2) We stress that our diagrammatic rules exactly prepare the Bethe wavefunction (8).Namely, no proportionality factor needs to be included, contrary to the state (9) constructed by the ABA.It should be noted that determining the proportionality factor between the states created by the ABA and the CBA is a complicated problem.
Thus, we can conclude that (55) and (57) provide the MPS tensor naturally associated with the CBA.Although the map between both tensors must be a transformation of the form (44), it is necessarily nontrivial.The ABA tensor for multimagnon states is constructed out of a product of R matrices, each of them depending on an individual magnon momenta.On the contrary, the Λ defined above only depends on the scattering amplitude of the model, which is a function of pairs of magnon momenta.

The A and B matrices
The MPS tensor associated to the CBA derived above and that of the ABA do not lead directly to valid quantum gates.They need to be brought into canonical form using the freedom (44).In this and the next section we will determine the change of basis needed to transform (55) and (57) into the quantum gates P k .

Overlap matrices
In the search for the required transformation, let us consider the subcircuit formed by the first k − 1 gates of the ABC, highlighted in yellow below We assume that k > M , such that P k−1 is a long gate.While the input configuration to P N −1 is fixed to |1 M ⟩ ⊗ |0⟩, that of a general long gate can have the first M qubits in an arbitrary state.A basis for the input states to P k−1 is thus |n 1 . . .n r ⟩, where the number of qubits in |1⟩ can take any value r ≤ M and n r ≤ M assures that the rightmost qubit is in |0⟩.For each basis element, the subcircuit highlighted in yellow will output a different state supported by k qubits The integer a = 1, . . ., d r,M is related to (n 1 , . . ., n r ) as explained in Section 3.1.Since the circuit is unitary, all these states are orthonormal The MPS based on the tensor Λ derived in the previous section builds the Bethe wavefunctions (8).Equivalently, the probabilistic circuitlike network (43), with Λ associated to Λ as explained in (42), outputs Bethe wavefunctions when the M rightmost auxiliary qubits are projected into the reference state |0⟩.The ABC is, however, a deterministic circuit which needs no auxiliary qubits.Based on the ansatz (40), we have interpreted the ABC as the unitary version of (43).The mismatch between the number of qubits involved in both realisations of (8) renders their correspondence nontrivial.This issue will be addressed in the next section.Here it is enough to notice that the subcircuit in (62) must be equivalent for consistency to (65) The matrices Λ in the green area create k qubit states |Ψ (r) k,a ⟩, with the same conventions as in (63).Since Λ is not unitary, these states are not orthogonal and they are not normalized.We define a matrix of overlaps in each symmetry sector, whose entries are This is known in mathematical terms as a Gram matrix.To ensure that (65) coincides with the highlighted area of (62), we need B to transform the non orthogonal set into an orthonormal set, that is This relation can only be satisfied if the overlap matrix is positive definite.By definition it is also Hermitian.A matrix with these properties can be subject to the so called Cholesky decomposition The matrix A becomes unique if we chose it to be upper triangular and with positive diagonal entries.Relation (67) fixes B up to a unitary transformation.Substituting the Cholesky formula into (67), we fix that freedom by requiring that the matrices A and B are inverse of each other, as we mentioned above (40).
With this choice, B will also be upper triangular.Explicit formulae for A and B in terms of minors of the overlap matrices can be found in Appendix A .These matrices, together with (55) and (57), complete the ansatz (40) for the long gates.

Partial Bethe wavefunctions
The previous construction would remain rather formal unless we determine the states |Ψ (r) k,a ⟩.These states turn out to be again Bethe wavefunctions, with momenta drawn from the magnon momenta defining the state prepared by the complete quantum circuit.The subset of momenta associated to |Ψ (r) k,a ⟩ is determined by the input state to the shaded region in (65) as follows with a related to (n 1 , . . ., n r ).This assignment is proven in Appendix B.Here we will limit ourselves to give an example of how it arises.Let us consider an ABC creating a Bethe wavefunction describing three magnons, and input to the shaded region of (65) the state |n 1 n 2 ⟩ = |12⟩ from the r = 2 symmetry sector.The coefficient multiplying the basis element |13⟩ of the output is obtained by adding the contributions of the graphs (70) Using the rules of Section 5, we obtain This result coincides with (61), which emerges from the ABC designed to build a two-magnon Bethe wavefunction (4) with momenta p 1 and p 2 .If the input state is instead |n 1 n 2 ⟩ = |13⟩, the coefficient of the same output element |13⟩ will be which is now consistent with a two-magnon output state of momenta p 1 and p 3 .As before, (72) arises from the contributions of two graphs.These are Notice that the states |Φ (r) k,a ⟩ resulting from the subcircuit in (62) are in general not Bethe wavefunctions.This is only the case for r = M , since there is only one state in that symmetry sector.Hence which generalizes the analogous statement for M = 1, obtained in Section 4.1.Namely, when the input to the shaded circuit in (62) is |1 M ⟩ ⊗ |0⟩, it outputs the same Bethe wavefunction prepared by the complete circuit, but supported by k instead of N qubits.

The short gates
Long and short gates differ in the number of qubits on which they act.The latter act upon a number of qubits that grows with their gate index as k + 1 until k = M is reached.This property is essential for the ABC to define a deterministic circuit.A graphical representation of (40) applied to short gates is Some adjustments in the construction of Λ and the unitarization matrices A and B with respect to previous sections are clearly necessary.

A ghost leg for Λ
The dependence of Λ on k just comes into play through the number of qubits on which it acts.For this reason, we will keep the previous notation and do not add to it a gate subscript.We want the matrix Λ of short gates for consistency to be based on the same diagrammatic rules presented in Section 5.But this raises a caveat.The fixed input |0⟩ of the long gates's rightmost qubit played an essential role.The input state to the short gates is instead unconstrained, making unclear how to apply the diagrammatic rules.We solve this problem by adding a rightmost |0⟩ as a ghost input, namely, an input which does not correspond to a real qubit.It will be represented graphically by a •.We consider first the matrices Λ (0,r) , resorting again to an example.With the help of the ghost input, the action on the state |101⟩ of the matrix Λ (0,2) as part of the short gate P 2 is given by The same trick applies straightforwardly to the matrices Λ (1,r) .For instance, the action of Λ (1,2) belonging to the short gate P 1 on |11⟩ leads to (77) Hence, the new Λ (i,r) provide a map between input and output configurations of k +1 physical qubits.As a result, the matrix A for short gates must connect k + 1 with k qubit configurations.This means that it extinguishes the ghost leg introduced by Λ (78) We represent this again with a •, which we define to always absorb a |0⟩.Let us give an example of how these new rules fit together in the decomposition (75), using a graph associated to the short gate P 2 (79) The dimensions of the matrices A, B and Λ building the short gates are summarized in the Table below The mathematical expressions for Λ are still given by (55) and (57), after substituting M by k + 1 1 .The unifying definition of Λ for long and short gates 1 Although the dimensions of Λ depend on k, we keep this dependence implicit and do not add the corresponding subscript.In this way we stress that the same principle defines Λ for long and short gates.
has however the consequence that (75) cannot be interpreted as a transformation into canonical form.Since A is not a square matrix, it does not correspond to a change of basis.Such an interpretation could be restored with a different choice of the elements in the decomposition (75), but it would come at the expense of obscuring their meaning, therefore this will not be pursued here.

Small overlap matrices
To determine the matrices A and B of the short gates, we follow the logic outlined in Section 6.The matrix B should describe a change of basis that orthonormalizes the states prepared by a part of the ABC.In analogy with the shaded area of (65), this part is We have labelled the green gate with the three-leg tensor Λ instead of its matrix version Λ to emphasize that the ghost leg implies no additional qubit.Carrying on the parallel with long gates, when a basis state |n 1 . . .n r ⟩ enters (81), the output should be a k qubit Bethe wavefunction with momenta drawn from the subset p 1 , . . ., p k according to the rule (69).Unfortunately we were not able to fully prove this statement.In spite of that, we take it as valid and determine B by the requirement The overlap matrix C has dimension d r,k × d r,k and is defined as in (66). Setting k is not compatible with the dimensions described in Table 80.The matrix A (r) k has been taken to bridge between configurations of k + 1 and k qubits.Guided by this, we build a new map from k + 1 qubit configurations into states supported by k qubits where r ≤ k by U (1) conservation.k,a ⟩ can be linearly independent.As a result, their overlap matrix C (r) k will be positive semidefinite.The Cholesky decomposition of such a matrix still exists but, contrary to (68), A (r) k is now upper rectangular.Its number of rows is determined by the rank of the matrix that we want to decompose, which in our case is d r,k .Hence, it has the right dimensions to constitute our guess for the corresponding matrix in (75).

The product matrix L
Although the product of A and B for long gates is the identity, this product for short gates defines a relevant new matrix The matrix L has dimension d r,k × d r,k+1 with r ≤ k.Given that C contains C, we can fix B to be the inverse of the upper triangular block of A. Appendix A then shows that which is easily seen to reduce to the identity when the rightmost leg is in |0⟩.The notation a → b means that the ath row of C is substituted by the bth row of C.
Using the matrix L, (81) can be recast as In the derivation of the matrices A and B, we have assumed that this network builds Bethe wavefunctions.
In Appendix B on the other hand, these states are shown to be created by the probabilistic circuitlike network (88) Hence the correctness of the short gate construction relies upon the equivalence of (87) and (88).In particular, it completes the proof that the M magnon ABC on N qubits builds the desired Bethe wavefunction when k = M .The different dimensions of the green gates in (87) and (88) however render a general demonstration of the equivalence difficult.We have checked that it holds up to k = 5 using computer algebra software, and tested it numerically up to k = 10 with Qibo [34], an open source library to simulate quantum circuits.The programs to reproduce these results are available in [35].

An example
In order to better understand the role of the matrices L in the previous equivalence, we will analyse the simple case k = 3. Disregarding the first green gate of each side because they have the same action on physical qubits, it reduces to prove (89) We will need the explicit expressions of L (r) 1,2 .Using (86), they are given by When the rightmost input qubit to the left hand side (LHS) of (89) is in |0⟩, the action of L 2 becomes trivial.We thus rather focus on input configurations where that qubit is in |1⟩.1,2 , the contribution of these graphs leads to This correctly reproduces the result of the single path allowed by the rhs of (89) to connect those input and out states The red line in the single path above visits auxiliary qubits which do not have a counterpart in (92).The rightmost line entering L 2 in (92) is a continuation of the ghost leg created by the previous matrix Λ.When that leg carries a |1⟩, and before extinguishing it, the mission of L 2 is to bring back the |1⟩ into the flow of physical qubits.This is the crucial point that makes the equivalence in (89) possible.An analogous analysis holds for the transition between |001⟩ and |10⟩.The graphs (95) in agreement with (97) Finally, we consider input states |101⟩ and |011⟩.Both of them connect with the output |11⟩.We will only analyse the input |101⟩ because, in this case, the other does not bring any new insight.The LHS of (89) gives raise again to two paths The matrix L 2 contributes equally to both, obtaining This time also the rhs of (89) leads to two paths (100) whose contribution agrees with (99).It is tempting to associate the first and second graphs in (98) separately with the first and second graphs in (100).Their separate contributions do not coincide however.Agreement is only found between their sums, providing one more witness to the intricacy of the short gate construction.

Unitarity
We have completed our proposal for the ABC gates and given strong arguments that they prepare the desired Bethe wavefunctions.The last and fundamental requirement to prove is unitarity.We address again first the long gates.For the purpose of the ABC, it was only necessary to specify how they act when the rightmost input qubit is in |0⟩.The condition for P k |0⟩ to be promoted to a unitary matrix acting on M + 1 qubits, is for k ≥ M .There is no unique way to realize this embedding and thus can be adjusted to the quantum architecture our disposal.Inside each symmetry sector, the previous condition becomes We substitute the ansatz (40) for the ABC gates, and eliminate the resulting matrices A using the Cholesky formula (68).Unitarity translates then into .Hence (104) leads to the recursion relations (0) k = 1.These relations summarize the structure that made possible to find an explicit solution for the ABC gates.They turn out to also guarantee their unitarity.Indeed, inserting it into we recover the change of basis relation that defines B. When M 1, (105) reduces to the simple recursion relation (34).
The treatment of the short gates is analogous.The main difference lies in the Cholesky decomposition, since we should use formula (84) instead of (68), obtaining for k < M .As a consequence, the overlap matrix C in (103) is replaced by C, defined in terms of the enlarged set of states (83).From the definitions of the matrices A and B for short gates, it is easy to see that both overlap matrices are related by The circuitlike representation of k+1 is again given by (104), but since now k < M , all matrices Λ are cut away and only remains the network (108) From (107), the shaded region builds in this case and the figure translates into the recursion relations When substituted in (106), they prove the unitarity of the short gates.

ABA = CBA
In this section we will clarify the connection between the approach to derive the Bethe circuits followed here, based on the CBA, and that in [31], based on the ABA.The ABA has a straightforward interpretation as an MPS, where the associated three-leg tensor is This figure makes explicit the decomposition of the tensor R T in (11) in terms of the R matrices of the model.The XXZ R matrix for the spin-1/2 chain is Integrability imposes where ∆ is the anisotropy of the Hamiltonian (2).The global factor ρ is a free parameter, which we will set to 1.Each R matrix is thus a function of the magnon momentum, R j = R(x j ).
Reference [31] introduced the transformation of Γ into canonical form as the way to derive the quantum gates of the ABC.Let us focus on long gates, since we have seen that short gates involve additional considerations.In analogy with (40), long gates were given by P with A k and B k inverse of each other2 .Unlike the comprehensive approach followed here, the starting point in [31] was the recursion relations of the form (105) under the substitution Λ → Γ and These recursion relations were solved iteratively to find the matrix A k , a task that in general could only be achieved via numerical techniques.The and the CBA are known to prepare the same wavefunctions, up to a normalization factor, even before imposing the Bethe equations for the magnon momenta [32].While it is straightforward to obtain the CBA norms, those of the ABA states pose a notoriously difficult problem [8,36,37].With the insights developed in the present paper, the hardness of finding analytic solutions to the ABA recursion relations can be partly explained by this fact.
tified with A k and G −1 k with B k+1 .The matrices G k were determined there by the recursion relation (16).
Since Λ and Γ build the same wavefunctions, they must be related by the MPS gauge freedom (44) Given that both tensors are site independent, the transformation X must be site independent.It also has to be consistent with the U (1) symmetry.The value ρ = 1 for the global factor of the R matrix leads straightforwardly to Γ (0,0) =1.The diagrammatic rules constructed in Section 5 imply Λ (0,0) = 1.This shows that (114) is satisfied in the trivial, zerocharge sector.Choosing a different value for ρ would require introducing a proportionality factor between both sides of (114).We now define It is then clear that (114) and (115) solve the ABA recursion relations, because with these definitions they just reduce to (105), and lead to the same quantum gates as (40).
The relation between the tensors Γ and Λ offers an interesting alternative way to prove the equivalence between the algebraic and coordinate versions of the Bethe ansatz.The existence of a matrix X fulfilling (114) is nontrivial.Let us analyse the two-magnon case as an example.When M = 2, we have Hence X is a matrix that diagonalizes Γ 0 .This condition only determines X up to left multiplication by a diagonal matrix . Since Γ 0 is upper triangular, X 0 will also be upper triangular.We fix it by requiring the diagonal entries to be the unity.With this condition, we obtain This construction is easily seen to work for arbitrary M .
When i = 1, we have and Equation (114) applied to these matrices overdetermines the diagonal matrix D in (117).A solution can only be found if the following relation holds Exchanging 1 ↔ 2 inverts the LHS.It is simple to see that the consistency of the rhs with this property is equivalent to the integrability condition (112).Then, substituting the integrability condition above, leads to XXZ scattering amplitude (7), up to a symmetric function of the magnon momenta.We will see below that a symmetric s is physically irrelevant and can be thus discarded.Remarkably, (114) encodes the integrability structure of the model, otherwise formulated in terms of the Yang-Baxter equation.
For the sake of completeness, we include the solution of the diagonal matrix which contains the information about the norms of the ABA states.

Free fermion circuits
The implementation of our algorithm on a real quantum processor depends on the possibility of efficiently decomposing P k into elementary quantum gates.Here we will only address this very important question when the magnon S matrix (6) reduces to a sign, whereby the system maps to free fermions through a Jordan-Wigner transformation.This corresponds to the symmetric point of the scattering amplitude (7), which is achieved for vanishing ∆ and leads to the XX chain.At this point, the dependence of the Bethe states on the scattering amplitude factorizes and thus can be altogether ignored.Without loss of generality, we will set s pq = 1 in this section.The gates of the ABC at the free-fermion factorize into matchgates, whose analytical expressions we will show now.Strong numerical evidence for this realization was already presented in [31].

Matchgate decomposition
Unitarity strongly constrains the r = 1 symmetry sector of the ABC gates.Orthonormality between the columns of P (1) Following (23), the entries in the first row correspond to P (1,1) k , while the rest belong to P (0,1) k . The nested structure of (124) implies that the r = 1 sector can be represented by a layer of two-qubit unitaries of the form with parameters given by For free fermion models, there is evidence [31] that the same layer of F jk unitaries reproduces all symmetry sectors, for which we provide here the analytical expressions.Namely, long and short gates P k admit respectively the efficient decomposition (127) Although this decomposition appears similar to (110), it is considerably more intricate.Contrary to the R matrices, which depend on a single magnon momentum, (126) implies that F kj depends on p 1 , . . ., p j .As in the general case, the short gates require adjustments.It is easy to see from (124) that a single qubit unitary acting on the rightmost qubit needs to be added to the F jk layer.The gate U k is diagonal and acts trivially when the rightmost qubit is in |0⟩.When this qubit is in |1⟩, it gets multiplied by u kk+1 defined as in (126), which unitarity ensures to be a phase.
The decomposition (127) means that r = 1, associated to one-magnon configurations, contains the complete dynamical information of the model.It is a very natural statement in the absence of interaction.Moreover, the matrices F kj are a U (1) preserving restriction of the so-called matchgates [38,39], which are ubiquitous in the circuit realisation of free fermion models.In spite of that, it turns out that a complete analytical proof of (127) is technically involved.In [31] it was obtained for states with up to three magnons, while successful numerically tests were carried out for a larger number of magnons.A related result holds at the level of overlap matrices.In the free fermion limit, they reduce to determinants of inner products of one-magnon states with a = (n 1 , . . ., n r ) and b = (m 1 , . . ., m r ).This equation is just a consequence of Wick's theorem.
Since overlap matrices are central to the construction of the ABC gates, (128) is an important ingredient in the proof of their matchgate decomposition.It is actually the difficulty of operating with the previous expression that prevented us from obtaining the general proof of (127).

Interacting chains
A first study on the implementation of the ABC for the interacting XXZ model was performed in [31].
The P k gates preparing states with low numbers of magnons were reproduced via a variational ansatz with several layers of U (1) preserving two-qubit gates.
The result of the optimization pointed toward the need of an exponentially growing number of layers with an increasing number of magnons.On the other hand, it is known that the gap for adiabatically building the ground state of the XXZ closes only polynomially [5].Since there is a polynomial equivalence between adiabatic and digital computation [40], this suggests that an efficient decomposition of the ABC could exist.We hope that the structure uncovered in this paper can help to find an improved ansatz.In this sense, the interest of finding a proof of (127) is not only mathematical.Understanding how the general ansatz (40) can be reduced to a single layer of two-qubit unitaries for the XX model, is the natural starting point to address the interacting case.

Conclusions
In this paper, we have proposed a deterministic quantum circuit designed to generate the Bethe wavefunction associated with the XXZ spin chain model.
Our efforts build upon the approach initiated in reference [31], which we now complete by providing comprehensive analytic expressions for the quantum gates, applicable to systems with any number of sites and magnons.The method employed in [31] relied on a series of recursive equations hinging on the R matrix of the Algebraic Bethe Ansatz which required numerical solutions, particularly for scenarios involving more than two magnons.
In contrast, this paper takes a distinct standpoint that revolves around the discovery of a novel Matrix Product State structure inherent to the Coordinate Bethe Ansatz.This construction offers greater clarity regarding the role of the dynamics, as elucidated by the phase and scattering factors of the model.Furthermore, it possesses an intriguing diagrammatic structure that merits further investigation and exploration.We also highlighted the connection between the method presented here and the approach introduced in [31], based on the Algebraic Bethe Ansatz.As a bonus, we obtain a new understanding of the equivalence between the coordinate and the algebraic version of the Bethe ansatz.Looking at the technical aspects, it is worth noting the significant role played by the Cholesky decomposition in this construction, which differs from the role undertaken by the QR decomposition in [31].
Our construction does not impose the periodicity condition on the Bethe wavefunction, which is the condition yielding the Bethe equations for the momenta.Consequently, to obtain the eigenfunctions of the XXZ Hamiltonian, it becomes necessary to initially solve these equations and then incorporate the solutions into the quantum gates.Alternatively, one could employ the circuit as a tool for a Variational Quantum Eigensolver (VQE) to seek out solutions for the Bethe equations.This presents an interesting avenue for exploration.
A central question regards the decomposition of the ABC gates into one-qubit and two-qubit unitaries.We have strengthened the evidence that an efficient decomposition in terms of matchgates exists for the free fermion chain.Addressing the interacting case is crucial for the implementation of our algorithm on a real quantum computer.At any rate, we should stress that the framework presented here treats free and interacting models on an equal footing, offering analytical expressions for both.It thus appears as an optimal playground to analyse the interplay between integrability, interaction and complexity.
The complete proof that the gates of the ABC construct actual Bethe wavefunctions is on the other hand missing.We have demonstrated that the MPS based on Λ yields the CBA.We also proved that the canonical form of the MPS brings about the long gates of the ABC.However, the canonical form does not produce the short gates of the ABC in a straightforward fashion, which arise under the elimination of ancillae and render the quantum circuit deterministic.We have tested that the ABC with short gates prepare the CBA wavefunctions for a few magnons, but a complete demonstration would be nonetheless desiderable.Moreover, we have assumed that the gates of the ABC reduce to one layer of matchgates at the free-fermion point.We have checked that the matchgate decomposition holds analytically in the r = 1 sector.Despite strong numerical evidence in favor of the decomposition in every other sector, a complete proof still lacks.
Our results hold the potential for extension in several directions.These include exploring open boundary conditions, investigating inhomogeneous systems, delving into the nested Bethe ansatz, exploring semiclassical exactly solvable models, and even nonintegrable models.In this sense, it is interesting to note that the ABC can prepare plane wave superpositions of the form (8) for an arbitrary scattering amplitude s(p, q) not related to integrability.
To demonstrate now that A and B above are inverse matrices, we need to check that one of the two alternative products, say BA, is proportional to the identity.Furthermore, we just need to focus on the diagonal and upper triangular entries of BA, for its lower triangular entries vanish.According (A1) and (A2), the nontrivial entries of BA read ) where a ≤ b.The identity directly holds if a = b.We assume a < b hereafter.
We demonstrate (A4) by proving the lemma If the lemma were to hold, we could start from c = a + 1 in (A5) and apply it iteratively in (A4) until we prove identity.Our next step exploits the fact det c C c→b and det c C a→b share the nonvanishing minor det c−1 C a→b , whose associated matrix we denote by M .The matrix M is nonsingular and invertible because it is built upon the inner product of linearly independent Bethe wavefunctions.We can thus employ formula which is an identity due to the repetition of columns in the last determinant.This last step finishes the proof of the lemma (A5), and, thus, of the identity (A4) and formula (A2).
these definitions, we propose the following ansatz The input state |001⟩ leads to two possible outputs, |01⟩ and |10⟩.Two different braids connect |001⟩ with |01⟩ (92) Substituting the appropriate entries of L (1) The following figure gives a representation of C (r) k+1 , provided the input and output states are M qubit configurations |n 1 . . .n r ⟩ in the r symmetry sector (104) and i runs on the two values 0 and 1.The network in the shaded area builds then C (r−i) k

)C
where we have introduced the c − 1 dimensional column vectors(v a ) b = C ba , w d = C da if d ̸ = b , w b = C ca .(A8)If we use these expressions and expand det c C by minors, we can rephrase (A5) asw † M −1 (det c−1 C a→c v a − det c−1 C v c ) + cd det c−1 C d→c = 0 .(A9)The dth component of the vector between parentheses consists of two terms of the expansion by minors of det c C * c→d , which vanishes because of the repetition of rows (recall d = 1, . . ., c − 1) .Therefore, (A9)equals c−1 d=1 d̸ =a det c−1 C d→c (C cd − w † M −1 v d ) = c−1 C d→c det c Ca→b C 11 . . .C 1b . . .C 1d . . . . . . . . .C c1 . . .C cb . . .C cd

kσ 2 a=a σ ba y 2 bσ 1 (− 1 )
to be d r,k × d r,k+1 matrix that applies the Cholesky decomposition (84) to C (r) k .The overlap matrix is positive semidefinite rather than positive definitive.The reason is that it is built upon the inner product of linearly dependent Bethe sates.Nonetheless, A (r) k is still unique as it is upper rectangular and has positive diagonal entries in the leftmost square block.This block in fact provides the Cholesky decomposition of C (r) k , the overlap matrix of a complete set of linearly independent Bethe wavefunctions in the rth symmetry sector of a spin chain of k < M sites.Since the overlap matrix is now positive definite, we can transfer the conclusions we drew for long gates to this case.The formula for the entries of the leftmost d r,k × d r,k block A (r) k is hence (A2).It also follows that the formula for the d r,k × d r,k matrix B (r) k is (A1) again.(The ranges of the indices of both formulae of course change.)To determine A (r) k completely, we also need to fix the entries beyond the leftmost block.To do so, we look at |Ψ (r) k,a ⟩, the overcomplete set of d r,k+1 Bethe wavefunctions that underpin the positive semidefinite overlap matrix.(We drop the hats from the definitions (83) and (84) to avoid cluttering the notation.)We set the first d r,k Bethe wavefunctions to be a linear basis of H r,k .This choice implies we can unambigu-⟩ , b = d r,k + 1, . . ., d r,k+1 , (A11) where P is a rectangular matrix.The basis of Bethe wavefunctions is amenable to the same reasoning behind formulae for long gates (under the replacement d r,M → d r,k ).Therefore, we can write, up to an unitary rotation, |Ψ (r) k,b ⟩ = d r,k a,c=1 C 11 . . .C 1a P cb C 1c . . . . . . . . .C a1 . . .C aa−1 P cb C ac det a−1 C last step we have extended the formula (A2) to a = 1, . . ., d r,k and b = 1, . . ., d r,k+1 .The matrix A (r) k thus constructed straightforwardly yields the Cholesky decomposition (84).We deduce that (A2) correctly specifies A (r) k for short gates as well.(The expression (A2) is actually a closed form for the Cholesky decomposition of any positive semidefinite matrix.)Last,we prove formula (86) for L. Consider the rhs of (A4).The expression is also valid for BA in short gates.The difference lies in the ranges of the indices, which now are a = 1, . . ., d r,k and b = 1, . . ., d r,k+1 .If b > d r,k , the iteration of lemma (A5) leaves a remnant because it halts at c = d r,k .The remnant is just (86), which was to be proven.BThe tensor network of Bethe wavefunctionsIn this appendix, we prove that the circuitlike network (88) constructs the Bethe wavefunction|Ψ y mr−1 ar |m 1 . . .m r ⟩ .(B1)where |n 1 . . .n r ⟩ is the initial state tensor network, y 1 , . . ., y r denote the associated subset of momentum variables of x 1 , . . ., x M such that y a = x na and σ ab denotes the scattering amplitude of y a and y b .Let us begin with the first (lowest) level of (88).We use Λ |0⟩ = Λ, (55), and (57) to obtainΛ |n 1 . . .n r ⟩ |0⟩ = r a=1 y a |0⟩ |n 1 . . .n r ⟩ ba y b |1⟩ |n 1 . . .n a . . .n r ⟩ , (B2)where n a denotes n a is absent in the list.If we introduce the notationΛj ≡ 1 2 j−1 ⊗ Λ ⊗ 1 2 l−j , (B3) where 1 ≤ l ≤ k, at the second level we have Λ1 Λ2 |n 1 . . .n r ⟩ |00⟩ = r b=1 y |00⟩ |n 1 . . .n r ⟩ (|01⟩ + y a |10⟩) |n 1 . . .n a . . .n r ba2 σ ba1 y 2 b σ a2a1 y a2 |11⟩ × |n 1 . . .n a1 . . .n a2 . . .n r ⟩ , (B4) where α 1 = a 1 and α 2 labels the position of a 2 inside the ordered set of r − 1 elements 1, . . ., a 1 , . . ., r.The generalization to the higher levels of (B2) and (B4) is apparent.The projection of the last M ancillae on ⟨0 M | at the kth level completes the tensor network.Therefore, we can write (88) like ⟨0 M | Λk . . .Λ1 |n 1 . . .n r ⟩ |0 k ⟩ = k m b =1 m b <m b+1 r a b =1 a b ̸ =a1,...,a b−α1...+αr+r r p,q=1 p>q σ apaq y m1−1 a1 . . .y mr−1 ar |m 1 m 2 . . .m r ⟩ , (B5) where α b labels the position of m b inside the ordered set of r − (b − 1) elements 1, . . ., a 1 , . . ., a b−1 , . . ., r.

Table 18
for an explicit example of this map.Using the previous variables, we can write