Digital-analog quantum computation with arbitrary two-body Hamiltonians

Digital-analog quantum computing is a computational paradigm which employs an analog Hamiltonian resource together with single-qubit gates to reach universality. Here, we design a new scheme which employs an arbitrary two-body source Hamiltonian, extending the experimental applicability of this computational paradigm to most quantum platforms. We show that the simulation of an arbitrary two-body target Hamiltonian of n qubits requires O ( n 2 ) analog blocks with guaranteed positive times, providing a polynomial advantage compared to the previous scheme. Additionally, we propose a classical strategy which combines a Bayesian optimization with a gradient descent method, improving the performance by ∼ 55% for small systems measured in the Frobenius norm


I. INTRODUCTION
When quantum computing was originally proposed [1,2], it was envisioned as a way of simulating the dynamics of a quantum system employing another controllable system.This set the foundations of what we now call analog quantum computing (AQC) [3].A different approach was introduced when Deutsch proposed the concept of a quantum gate [4], which finally led to the digital quantum computing (DQC) paradigm.
One of the main advantages of AQC is the robustness of the simulation.Quantum control techniques have been developed in the last decades, providing a high fidelity and further protecting the dynamics against different sources of errors [5,6].Despite their robustness, AQC is strongly limited by the dynamics of the system, making it difficult to implement most dynamics of interest.In contrast, DQC is performed through the sequential application of quantum gates in a discrete manner, mimicking classical computations.It is proven that any unitary can be decomposed with arbitrary precision in terms of single-qubit gates (SQG) and at least one entangling two-qubit gate (TQG) [7].One of the main features that DQC provides is the possibility of applying quantum error correction (QEC) techniques [8].In the current Noisy Intermediate-Scale Quantum (NISQ) era [9], the qubits and the gates available are noisy and prone to errors.Thus, the only hope of reaching fault tolerant quantum computing is through the application of sophisticated QEC techniques [10] once we fulfill the requirements for the quantum threshold theorem [8,11,12].
The digital-analog quantum computing (DAQC) paradigm was proposed as a way of combining the robustness of AQC with the versatility of DQC, [13,14].The main idea behind DAQC is employing the natural interaction Hamiltonian of a system as an entanglement resource.By alternating the evolution under this Hamiltonian (analog blocks) and the application of SQGs (digital blocks), one can simulate an arbitrary target Hamiltonian.Here, we can distinguish two kinds of approaches.If the interaction Hamiltonian is turned off during the application of the digital blocks, we call this approach stepwise-DAQC (sDAQC) circuit.Otherwise, if for practical purpose the system Hamiltonian is always on, and the SQGs are performed on top of this dynamics, we call this approach banged-DAQC (bDAQC) circuits.Interestingly, although this introduces a systematic error, this scales better than main error sources found in quantum computers [15].It has already been experimentally proven that DAQC is a suitable paradigm for the NISQ era, for instance, in the implementation of a variational quantum algorithm in a system with up to 61 qubits [16].
In order to enhance the range of quantum platforms suitable for DAQC, we must extend the techniques to arbitrary resource Hamiltonians.Previously, the resource Hamiltonian was the aforementioned Ising Hamiltonian.Additionally, the construction of an arbitrary target Hamiltonian was performed through a two-step procedure.First, by transforming the source Hamilto-nian into an adequate ZZ Hamiltonian [17].Then, by employing sequences of SQGs to build an arbitrary Hamiltonian [14].However, the question of systematically performing this transformation in a single step was still open.
In this article, we extend the DAQC protocol to approximate the evolution under an arbitrary target twobody Hamiltonian by evolving under another arbitrary two-body resource Hamiltonian up to a certain Trotter error.By means of the Trotter-Suzuki formula, we argue that by repeating this sequence n T times one can reduce the error exponentially with n T .The tools we develop in this article allow for a practical realization of DAQC schedules in faulty hardware, in which spurious couplings prevent us from approximating the system as an Ising Hamiltonian.We also solve the problem of the negative analog blocks times that limited the implementability of previous protocols.Additionally, we introduce a classical optimization technique to find optimal angles for the SQGs.Taking into account the depth limitations of quantum circuits in the NISQ era, our objective is to maximize the fidelity of the circuit employing a fixed amount of digital-analog blocks.We show how it is possible to employ DAQC schedules with a low number of digital-analog blocks that achieves fidelities compared to a systematic approach with higher count of blocks.
The rest of the article is organized in the following manner.In Sec.II, we review the previous protocol employing ZZ Hamiltonians.In Sec.III, we present the new protocol which extends it to an arbitrary two-body source Hamiltonian, and discuss the error scaling.Then, in Sec.IV, we introduce an optimization technique for approximating arbitrary dynamics employing a fixed number of blocks, and illustrate the technique for a particular problem.Finally, in Sec.V we conclude with some final remarks.

II. WARM-UP: DAQC PROTOCOL FOR ZZ HAMILTONIANS
As a warm up, let us review the previous protocol for simulating the dynamics during a time T of a target ZZ all-to-all (ATA) Hamiltonian by employing a source ZZ ATA Hamiltonian For achieving this, in Refs.[14,18] the authors proposed a universal protocol, pictorially shown in Fig. 1.It consists in sandwiching each analog block with two X gates, applied to a different pair of qubits each time.Effectively, this changes the sign of all couplings in which only one of the qubits is selected.Noticing that all terms FIG. 1. sDAQC circuit for the Ising ZZ ATA Hamiltonian for 5 qubits.For simulating an arbitrary evolution, we sandwich several analog blocks with a couple of X gates applied to all combinations of two qubits.The blocks labeled with ti,j represent the unitary evolution under the source Hamiltonian for the time ti,j, this is e −it i,j H S .
of the Hamiltonian commute with each other, we have that the Trotter formula is exact, so we can write where δ ij is the Kronecker delta and t i,j is the analog time for the corresponding analog block.Note that throughout this work, we are considering ℏ = 1.We can rewrite the equation more conveniently as a linear system of equations where the elements of the matrix M (i,j),(ℓ,m) = (−1) δ iℓ +δim+δ jℓ +δjm represents the effective signs of the couplings between qubits (i, j) in every analog block (ℓ, m), ⃗ t is the vector of times of each analog block, and (g/h) (i,j) is a vector of the proportion between the target and the source coupling strengths between the qubits (i, j).If there is a missing coupling in both source and target Hamiltonians, g i,j = h i,j = 0, then we remove the corresponding element from the vector − − → g/h and the corresponding row in M .If the coupling is missing but the target coupling is non-zero, then the Hamiltonian cannot be simulated.It can be proven that the matrix M is non-singular for all number of qubits except 4, so we can obtain an exact simulation of the desired dynamics employing this schedule.

III. EXTENSION OF DAQC TO ARBITRARY TWO-BODY HAMILTONIANS
The proof that almost any entangling two-body Hamiltonian, together with SQGs, can be employed to simulate the dynamics of another two-body Hamiltonian was shown in Ref. [19], but no constructive method was pro-vided.From now on, we will refer to the source Hamiltonian and the target Hamiltonian as where σ µ i is the Pauli operator µ acting on qubit i.Then, the objective is to obtain a circuit to simulate the evolution of H T for a time T , U = e −iT H T .The first step of the proof is to note that it is possible to decouple a pair of qubits from the rest in an n-qubit system.Then, by employing a 36-step digital-analog protocol, it can be proven that any two-qubit interaction can be simulated.The proof for universality can be obtained by extending this to every coupling in the target Hamiltonian, and repeating the circuit n T times for simulating a time ∆ = T /n T in each Trotter step.However, this protocol gets convoluted as the number of qubits in the system, n, increases.In general, the circuit requires O(n 3 n T ) analog blocks, with an error of ε ∼ O(n 2 T 2 /n T ).As it stands, the question of obtaining a more efficient protocol is still open.
2. sDAQC circuit for an arbitrary ATA Hamiltonian for 5 qubits.The protocol for simulating any target Hamiltonian can be divided into two steps.In the first step (top), we select each of the n(n − 1)/2 pair of qubits in our system.In the second step (bottom), for each pair of qubits, we apply all the 9 possible combinations of the Pauli gates.The number of analog blocks for this protocol scales quadraticaly with the number of qubits, O(n 2 ).
For the general case, we can extend the ideas reviewed in Sec.II and extend it to arbitrary two-body Hamiltonians.The first step for our protocol is to select each pair of qubits {i, j} of our system.Now, instead of just applying an X gate to both of them, we will apply all 9 possible choices of pairs of gates {XX, XY, XZ, Y X, Y Y, Y Z, ZX, ZY, ZZ}.This is illustrated for a simple example in Fig. 2. Applying this to every pair of qubits, we effectively change the sign of some of the couplings, generating a non-singular system of 9n(n − 1)/2 equations.As the number of equations coincides with the number of variables and the number of parameters to define an arbitrary two-body Hamiltonian, this protocol is optimal in the number of digital-analog blocks.Unfortunately, in the general case the Hamiltonian does not commute with itself.This means that unlike the warm-up case, the Trotter formula is not exact, and thus, if we want to achieve an arbitrarily small error, we need to employ more Trotter steps.As a quick sketch of the proof, we write the problem as a system of equations similar to the one in Eq. 4, The matrix for a n-qubit system can be constructed recursively as a block matrix, where the blocks P (n), Q(n) and P (n) can be constructed systematically by taking into account the change of signs of the effective Hamiltonian terms after sandwiching them by Pauli gates.Then, by using the properties of this matrix and the definition of the formal determinant, we can prove that it is non-singular.Further details for the proof of the universality of the protocol are given in Appendix A. With this result, we can then employ the same results as in the original work by Suzuki [20] to argue that an arbitrarily small error can be attained.

A. Analysis of the errors
In order to obtain a bound for the maximum error of this protocol, we can resort to the original error analysis of the Suzuki-Trotter formula [20].Since we have proven that the sum of the effective Hamiltonians in each block is exactly the target Hamiltonian, we can employ the formula for the (n T , 1) approximant where is the effective Hamiltonian in the k-th analog block and ∥•∥ is the Frobenius norm defined as ∥A∥ = √ AA † .We will employ this norm for matrices throughout the text.
Since in each block only the sign of some Pauli string terms in the Hamiltonian changes, the norm is the same for all blocks ∥H (k) S ∥ = ∥H S ∥.With this, we have that the error is bounded by the sum of the times of the analog blocks.If we assume that we have a correct protocol in which all the time of the analog blocks are positive, we can rewrite where The total analog time will be lower bounded by the norms of H S and H T and the time T of the simulation, t A ≥ T ∥H T ∥/∥H S ∥.This corresponds to a situation in which both Hamiltonians are proportional to each other, H S ∼ H T .Let us now study a general case.Assume an optimal protocol in which the total time is minimized over all possible protocols.In this case, t A is upper bounded by the weakest source coupling and the strongest target coupling as where C(n) ≥ 1 is a constant depending both on the protocol and the system size.In the case a coupling h µ,ν i,j is 0 we take it out the corresponding element from both ⃗ g and ⃗ h and the corresponding row from the matrix M .In general, the constant C(n) heavily depends on the protocol, but it does not monotonically grow with the number of qubits.For example, we find that for the original protocol in Ref. [14] is upper bounded by C(n) = n(n − 1)/(n − 4)(n − 5) ≤ 15 when n > 5 for a balanced solution ( ⃗ t ∼ (1, . . ., 1)).Similarly, the protocol in Ref. [18] for a nearest-neighbour Hamiltonian has C(n) ≤ 3/2 for any system size.
Employing this result, we see that we can make the error arbitrarily small by increasing the number of Trotter steps of the protocol.However, this would only work for sDAQC circuits.When working on the bDAQC paradigm increasing the number of Trotter steps would increase the bang error in the protocol, as the time to apply the SQGs remains the same.This means that there is a point at which increasing the number of Trotter steps actually reduces the fidelity of the circuit.However, this analysis should be performed case by case, as it heavily depends on the problem and the system characteristics.As a rule of thumb, the time for the shortest analog block in the circuit should be at least two orders of magnitude above the time for applying a SQG, min(t k ) ≳ 10 2 t SQG .

B. A note about negative times
When computing the times of the analog blocks in Eq. 4, one can obtain a solution comprising some negative times.Simulating the evolution over a negative time would require to completely flip the sign of all the terms in the corresponding H (k) S .However, this cannot be done in general.For instance, one can straightforwardly prove that one can not do this for the 3 qubit all-to-all connected system by exhausting all possible combinations.As a suggestion for solving this problem, it was originally proposed to add one extra analog block, without it been sandwiched by any SQG.However, this only solves the problem in some particular cases.Approximate solutions to similar problems have been proposed [21], but the question of finding a systematic solution was still open.
Here we propose a method for constructing DAQC protocols in which the times are all positive.This method is highly inefficient in single qubit gate counts, but useful for proving the existence of such solution.The problem is exactly the same as in Eq. 7 but, instead of a square matrix M (n), we will employ all combinations of Pauli gates plus the identity {1, X, Y, Z} to construct a matrix with 4 n different columns M i .Then, we map the problem to a non-negative least-squares (NNLS) problem, for which we then employ the Algorithm NNLS to obtain a positive solution [22].However, we first need to prove that a positive solution exists.Here we roughly sketch the proof for this claim.Firstly, we note that the columns M i corresponds to the vertices of a polytope.Secondly, we prove that there is a strictly positive solution for the homogeneous system − − → g/h = ⃗ 0, with ⃗ t = 4 −n ⃗ 1. Lastly, we build a hypersphere centered in ⃗ 0 with small radius with a strictly positive vector ⃗ s = 4 −n ⃗ 1 + ⃗ ε, from which we can reach to any possible problem − − → g/h by scaling with a positive number, − − → g/h = λ⃗ s for λ > 0.Even though we are using an exponential number of blocks for the proof, numerically we observe that the solution contains only ∼ 9n(n − 1)/2 nonzero elements.The full proof is provided in Appendix B.

IV. CLASSICAL OPTIMIZATION OF THE DAQC SCHEDULE
The protocol discussed in the previous section is a systematic method to obtain an arbitrary target Hamiltonian using another arbitrary Hamiltonian as a source.Its implementation involves a number of digital-analog blocks that grows quadratically with the number of qubits.With the current limitations of NISQ devices, long circuits can accumulate large experimental errors, so it becomes necessary to find a trade-off between the accuracy of the theoretical approximation and the required experimental resources.
With the goal of reducing the number of digital-analog blocks, we propose a classical optimization strategy to find a set of SQGs sandwiching K analog blocks such that the digital-analog schedule is as close as possible to the ideal evolution.This way, we propose an optimization problem where the parameters to be optimized are the times of the analog blocks t k and the parameters of an arbitrary SQG where {θ, ϕ, λ} ∈ [0, 2π) are the rotation angles of the SQG.The cost function we minimize is the Frobenius distance between the target evolution U T and the circuit with the optimized parameters U C , similar to the calculation in Eq. 9.By employing the Frobenius distance between the unitaries as a proxy for the fidelity, we can test the approach in general, without imposing any assumptions about the initial state of the system or without expensive Haar integral calculations.
For simulating the circuits, we have employed two techniques.One, in which we simulated the exact evolution of an ideal quantum computer.Since the cost of computing the exact evolution under a Hamiltonian scales exponentially with the number of qubits n, O(2 3n ), we have tested a less resource demanding method as well.By means of the first order Trotter expansion, we can approximate the evolution as where 1 r(i,j) is the identity matrix for the subspace of all qubits except i and j.Using this approximation, we can reduce the cost of calculating the matrix exponential.Additionally, since every term is a sparse matrix with sparsity ∼ 1 − 2 −n , we can employ efficient functions for the matrix products.Techniques involving matrix-product-states (MPS) or matrix-productoperators (MPO) could be useful for extending this classical optimization strategy to larger systems [23,24].

A. The parameter space
The complete parameter space is given by the parameters of the SQG applied to qubit i of the k-th analog block, {θ i k , ϕ i k , λ i k } ∈ [0, 2π), and the evolution time of the k-th block, t k .We have restricted the evolution time of the analog blocks to be 0 ≤ t k ≤ T ∥H P ∥/K∥H S ∥, where K is the number of analog blocks, to avoid both negative and times much larger than the total time T of the target evolution.As the number of qubits increases, this quickly leads to a wide and hard to explore parameter space, which makes convergence slow in the optimization process.We found a good compromise in reducing the kind of SQG applied on each block to just two, one R k (θ k , ϕ k , λ k ) applied to all even qubits and an additional applied to all odd qubits.These kind of odd-even SQG layers are the same as those required to compute the Trotterized evolution in many DAQC systems [25], which gives a good starting point and sufficient flexibility for the optimization.
Calculating the evolution under the source Hamiltonian for all analog blocks is a resource-intensive task.As a mean of simplifying the computational cost and reducing the number of variables for the optimization, we have performed tests in which we fix the analog-block times to a fraction of the total evolution time of the target evolution T divided by the total number of analog blocks K.Even though in certain cases one can achieve better results by having the evolution time t k as an optimization parameter, fixing t k = T /K results not only in a faster computation, but in a much faster and consistent convergence as well, as we show in Sec.IV C.

B. Optimization protocol
Despite the compromises previously described, the optimization landscape is complex and shows multiple local minima.Moreover, evaluating the cost function for a new set of parameters is computationally very expensive.There are many strategies to tackle an optimization of this kind of "black-box" functions, such as genetic [26] or swarm [27] algorithms.
In this work, we propose a combined strategy of Bayesian optimization and a gradient descent algorithm.The popular gradient descent consists of evaluating a point, computing the gradient of the function at that point and tuning the parameters following the slope of the function.It is a fast and efficient tool to exploit local minima, but falls short when searching for a global minimum and is highly dependent on the initial point of the optimization.Meanwhile, Bayesian optimization is specially advantageous to efficiently explore unknown and computationally expensive functions.Bayesian optimization treats the black-box function as a random function and considers a prior upon it.Then, it evaluates only the function, and not its derivative, to compute an acquisition function, which usually is based in the expected improvement or the probability of improvement.Finally, it uses this acquisition function to find the next point to evaluate and updates the prior for the next iteration.For an in depth read on Bayesian optimization, we refer the readers to Refs.[28,29].
As mentioned, the gradient descent is highly dependent on its initial point, as it usually converges towards the nearest local minimum, not the global one.A common way of dealing with this problem is performing several gradient descent optimization by changing the initial point, such as with random or grid searches on the parameter space [30].The aforementioned Bayesian method allows us to minimize the number of initial points by means of a guided search through its acquisition function.The combined strategy leads to a much faster convergence to the global minimum than random or grid searches, achieving faster and better results.

C. Example: Nearest-neighbour Hamiltonian
A simple case of simulating the dynamics of the onedimensional XY model is presented as a test for this strategy.Let us assume a target nearest neighbours Hamiltonian of the form Let's also assume that the source Hamiltonian to which we have access to is This problem was also studied within the DAQC paradigm in Ref. [17].
In the following, we will discuss two cases: the homogeneous case, in which all couplings strengths are equal to the target Hamiltonian coupling strength, h k i = h ∀i, k, and the inhomogeneous case.For the inhomogeneous case, we propose a more realistic scenario in which the coupling strengths of the system follow a Gaussian distribution around the value of the target coupling strength hk i = N (g, σ), where σ is the variance of the distribution.
To simulate Eq. 14 using Eq. 15 in the homogeneous case, the general approach can be simplified into applying a single-qubit π rotation around the x axis to all the qubits, R x (π) = ⊗ n i=1 σ x , so that the crossed terms (σ x σ z and σ z σ x ) change signs.Then, since the rotated and system Hamiltonian do not commute, we employ the Trotter approximation and n T is the number of Trotter steps.The second step consist in sandwiching the resulting H ZZ evolution in either a R x (π/2) or R y (π/2) to rotate all qubits from σ z i to σ y i or σ x i , respectively.This, of course, requires an additional Trotterization.This approximation can be made arbitrarily precise by increasing the number of Trotter steps at the cost of increasing the number of required digital-analog blocks (4 blocks per Trotter step).
As previously described, we can use two or more analog blocks sandwiched between arbitrary rotations on even and odd qubits, and find the optimal rotation angles to achieve the best approximation.Since the set of all arbitrary rotations includes the specific rotations used for the Trotter approximation, the optimization must result in values necessarily equal or better than the Trotter approximation for the same amount of blocks.
In Fig. 3, we show a comparison between the performance of a Trotter approximation and the proposed Bayesian plus gradient descent optimization with N = 6 qubits.The chosen coupling strengths for the studied case where h k i = g = 1 ∀i, k in the homogeneous case and hk i = N (1, 0.175) for the inhomogeneous one.Additionally, we performed both the optimization process with fixed evolution times and with t k as an optimization parameter were tested.For each point, we computed 20 runs, using only a 10-step optimization for the Gaussian process.Fixed-time optimizations achieve convergence in these 10 steps, as evidenced by their small error bars.Larger error bars show a higher variance in the achieved value for the cases with time as a parameter, meaning a lack of convergence and the need for a longer optimization with more steps to reach the global minimum.Comparing the results obtained with the Trotter formula we see an improvement on the Frobenius distance.In particular, we see an improvement of ∼ 68% and ∼ 78% for the 4 block cases in which the time is not a parameter for the inhomogeneous and homogeneous case respectively.When we include the analog block times as a parameter, we only obtain a mean improvement of ∼ 45% and ∼ 65% respectively.Although leaving the time as a parameter can lead to better results, the improved consistency and convergence rates of fixed-time optimization, along with a much lower computational cost, makes the fixed-time optimization the most desirable approach.
Homogeneous and random inhomogeneous couplings perform comparably.As expected, the case with homogeneous couplings have a slight advantage, as the target Hamiltonian is also homogeneous.This is good evidence that, as long as the coupling strengths associated with the system and the target Hamiltonians are similar, the approach is suitable for arbitrary two-body Hamiltonians.
Most importantly, all optimization approaches achieve a significantly smaller Frobenius distance, and therefore, a better fidelity than the traditional first order Trotter approximation for the same number of analog blocks.This way, by employing this classical optimization strategy on the digital layers (SQRs) of the simulation, one can achieve the same or better theoretical precision in the approximation saving up experimental resources.With current NISQ devices, this could directly lead to reduced experimental errors.
Additional non-extensive testing has been done in combining this optimization strategy with classical approximate simulations of the system.As the cost of classically calculating the unitary evolution under a Hamiltonian scales exponentially with the number of qubits, we need to find an alternative with a better scaling and which still can provide some advantage.With this goal, we employed the first order Trotter formula for simulating the analog blocks, which reduces the cost of the calculation when combined with sparse matrix multiplication algorithms.Here, instead of exactly calculating the evolution of our circuit, we employed the first order Trotter formula for approximating the evolution under both the target and the system Hamiltonians.These approximations, U T,appx and U S,appx respectively, are employed during the Bayesian optimization process.For checking the performance one would get when using the result of the optimization for running the quantum circuit, we calculate the Frobenius distance with the exact expressions.This way, we can directly compare the results obtained in both tests.We conclude that the Trotter approximation limits our capacity for optimizing the circuit.For the lowest amount of blocks for the Trotterization (4 blocks), we can obtain a ∼ 54%/51% of improvement for the inhomogeneous/homogeneous problems when we discard the time as an optimizable parameter, and ∼ 56%/55% improvement when we include it.This confirms the higher expresibility of the optimization model when we include the time as a parameter, at the cost of increasing the time to solution of the classical algorithm.However, for shallow circuits, the improvement of the fidelity is worth the optimization process.Particularly, the fixed-time optimization gives us a competitive Frobenius distance for circuits with 5 or less blocks compared to the Trotter decomposition.As it is also shown, we can simulate a system with a single analog block while maintaining the fidelity of the evolution obtained with 4 blocks employing the Trotter formula, ∥U exact − U Trotter ∥ = 11.1, ∥U exact − U appx ∥ = 10.3 for the inhomogeneous problem, and ∥U exact − U appx ∥ = 10.5 for the homogeneous.

V. CONCLUSIONS
In this article, we provide a set of versatile tools to implement DAQC circuits in realistic scenarios, where the terms in the Hamiltonians of both the system and the target do not commute by pairs.Following on the universality of DAQC, we have proposed a protocol for simulating an arbitrary two-body Hamiltonian by employing another arbitrary two-body Hamiltonian.This was achieved by sandwiching the analog blocks with pairs of SQGs picked from the Pauli gate set.This systematic method is universal, and provides an optimal number of digital-analog blocks Q that scales quadratically with the number of qubits for all-to-all Hamiltonians, Q ≤ 9n 2 .This strategy employs less blocks compared to previous approaches, which required Q ≤ 36n 3 steps.Additionally, we have proposed a new method for obtaining DAQC protocols in which all analog block times are positive, and thus, are implementable in practice.
With the same objective, we have explored a less resource-intensive approximation.We have proposed a classical strategy in which all possible SQG rotations are considered as digital blocks.Solving this optimization problem, we have shown that one can achieve an accuracy comparable or even better than large sequences of Trotter steps employing significantly less analog blocks.
The benefits are twofold, as not only the accuracy of the systematic error is decresed, but a reduced amount of analog blocks also reduces the experimental error.In this regard, we have proposed a classical optimization strategy consisting in a Bayesian optimization method that explores the parameter space to find the optimal initial point of a gradient descent.This process is done without any assumption about the initial state, as the information given to the routine is just the target unitary evolution.For a low number of Trotter steps, we have shown that a precision comparable to that of regular Trotter approximations can be achieved by using only a fraction of the experimental resources.
The two approaches we have proposed in this work provide new tools for the implementation of DAQC circuits in NISQ devices.These new protocols for working with arbitrary two-body Hamiltonians pave the way for generating and scaling experimental implementations of this paradigm.The next steps for widening DAQC should search for an optimal solution for the negative analog block times problem, and further extend the protocols for k-body Hamiltonians.The exact method involve O(3 k n 2 ) digital-analog blocks in the worst case, but ∼ 9n 2 on numerical simulations.This suggests that approximate solutions, similar to the one proposed in this article, should be explored for obtaining implementable DAQC circuits.
with a DAQC schedule employing another arbitrary twobody Hamiltonian, We are assuming that if we have a non-zero g µ,ν i,j term, we will have a non zero h µ,ν i,j coupling in the source Hamiltonian.
The protocol we propose is the following: select each of the possible pair of qubits i, j, and apply all the combinations of {x, y, z} gates, which are the corresponding Pauli gates.This, changes the signs of the effective couplings, according to a (±1) matrix, which we will call M (n).Now, we want that our DAQC schedule simulates our original problem, this is To prove that this protocol is universal we have to prove that we can always find a set of times for the duration of the analog blocks (t µ,ν i,j ).

Notation and definitions
We define the notation employed for the proof.We employ a single index for labeling pairs of qubits, Whenever we refer to a label of a coupling or a pair of qubits, we will be using this labeling convention.We also give a formula for the inverse of this indexing [31] Additionally, we define an indexing method for the different selection of SQGs for a pair of qubits, f ℓ (µ, ν).This indices are given from 1 to 9 according to the order in the following list: {xx, xy, xz, yx, yy, yz, zx, zy, zz}.For example, the pair of SQGs {y, z} has the index f ℓ (y, z) = 6.
The elements can be expressed as a matrix by employing the previous labeling of the pair of qubits, which can be then mapped to a matrix . The rows and columns of this matrix are defined as The times for each analog block t µ,ν i,j can be expressed as a column vector by employing the same labeling as in Eq.A6, t µ,ν i,j = t g ℓ (i,j,µ,ν) .We also define a new column vector − − → g/h, which contains the information about the couplings in the hardware and the couplings we want to simulate, again, we employ the same labeling as in Eq.A6 such that ( − − → g/h) µ,ν i,j = ( − − → g/h) g ℓ (i,j,µ,ν) .Now, the problem of finding the times for the analog blocks can be expressed as Let's write the full M (n) matrix as a block matrix, where A(n) is a (n − 1) × (n − 1) block matrix, and M (n) a n(n − 1)/2 × n(n − 1)/2 block matrix.Here, each row labels a coupling in H S and each column labels the pair of qubits where the SQGs are applied.For example, the coupling between the qubits 1 and 4 would be addressed in row I = b ℓ (1, 4) = 4, and the blocks in which the SQGs are applied on qubits 2 and 3 correspond to the column J = b ℓ (2, 3) = n.Each of these terms are defined also as block matrices (which we will call them from now on as sub-matrices).These blocks are 9 × 9 matrices, that can be one of the four {M 2 , M 1.1 , M 1.2 , M 0 }, according to the following formula else. (A9) For a detailed construction of a M (n) matrix see Sec.A 4.
Let's define each of these sub-matrices: • M 2 : this is the matrix that represent the signs of the effective couplings µ, ν when we apply a SQG to each of the two qubits i, j.The columns represent each pair of gates, in the order given by f ℓ (µ, ν).
Equivalently, each column represents the sign of each effective coupling between the pair of qubits i, j, with the same order as the columns.Then, we have the following matrix, • M 1.1 : in this case we only apply a SQG in the first qubit of the pair, • M 1.2 : the case we apply one SQG on the second qubit, • M 0 : in this case neither SQGs is applied on any of the two qubits.This is the trivial case in which the signs of the effective couplings doesn't change, For example, we apply an x gate to the qubit 1 and an y gate to the qubit 3. We want to know how does the sign of the coupling yz changes between the qubits 2 and 3.
In this case, we are applying a SQG only to the second qubit, so we have to look at the M 1.2 sub-matrix.Now, the SQG we have applied are xy, so this corresponds to the 2 nd column, and the yz coupling to the 6-th row.
Looking at the matrix we see that the matrix, we see that in this case we have a change of sign of the effective coupling, and thus, we have a −1 in the corresponding matrix element.
We have some properties with these sub blocks: Also, we have some properties related to how these sub-blocks appear in the matrix: (P.6)The number of sub-blocks that fulfill M (n) I,J = M (n) J,I = M 1.1 is the same as the number of subblocks fulfilling M (n) I,J = M (n) J,I = M 1.2 .
From now on, we will employ N = n(n − 1)/2 to refer to the total number of pairs of qubits.

Non-singularity of M (n) through its determinant
The main argument that we use for proving that our protocol is universal is that the matrix M (n) that it generates is non-singular, and thus we can always obtain a set of times for the analog blocks that solves the equation in Eq.A3.We know that a matrix is non-singular if and only if its determinant is different from zero.Thus, we try to prove that Det(M (n)) = 0.For this, we employ the expansion of the formal determinant [32] [33], labeled with "det", of our block matrix, (A14) If we study the properties (S.1)-(S.6),we see that if in a term of a determinant we have a M 0 element or a pair M 1.1 M 1.2 , that term will be proportional to M 0 .The rest are cases in which we have terms with {M 2 , M 1.1 }, {M 2 , M 1.2 }, or {M 2 }.By using the properties (P.1)-(P.6),we see that the last case appears only once, and correspond to the elements of the main diagonal.Thus, we have that our formal determinant will be where β k , γ k ∈ Z.Looking at the properties (S.2)-(S.4),we see that α = ±3 q , with q ∈ N. Now, we will reorder the rows and columns.What we will do is to reorder them in such way that we obtain a expression equal to the one from Eq. A8 but with the M 1.1 and M 1.2 swapped.In the original ordering, we wrote the b indices appear in ascending order, such that the corresponding first label of the qubits appear in ascending order, and for the same first label, the second labels are in ascending order.Now, if we employ a new labels for the pairs which inverts all the ordering to be in descending order, b ′ (i, j) = n(n−j)−(n−j+1)(n−j+2)/2+(n−i+1).Now, if we compute the formal determinant of the matrix with the new labels, we have Since we have performed as many changes in the rows as in the columns, the number of total swaps of rows and columns is even.Since the properties P1-4 are invariant under this change, we have that Det(M . With this, we can conclude that For clarity, let's rewrite Eq.A15 as where we have evaluated the analytical expression for B k in Mathematica, with the elements We also evaluate the expression for the powers of M 2 , with the elements We can give a explicit expression for the matrix m(n), where and To evaluate the determinant of this matrix, since we have again a block structure.Checking that [P, Q] = 0, we can employ the formal determinant trick to evaluate the determinant of the initial matrix.Evaluating this matrix, we obtain with the elements where we have already substituted the expression for α = (−3) q , q ∈ N.
Appendix B: Obtaining positive times for the DA schedule In this appendix, we will prove that we we can always find a DAQC schedule for simulating an arbitrary ATA two-body Hamiltonian with another one in which the analog block times are positive.For this, we will first modify the problem such that we rewrite it as a non-negative least squares (NNLS) problem.Then, we will employ the Algorithm NNLS for solving the modified problem, which has a proven convergence to the optimal solution [36].However, for proving that Algorithm NNLS will converge to a correct solution, we have to then prove that there exists at least one positive solution.

Algorithm NNLS
The problem we want to solve is similar to the one in Eq.A7 but for an arbitrary protocol M where the column vector ⃗ b ∈ R (9n(n−1)/2) with n the number of qubits.From now on, we will employ N = 9n(n − 1)/2 to denote the dimension of the problem.The vector b has all the information about both the target and the source Hamiltonians, and the simulation time.Within this subsection, we will assume that the matrix M allows for a positive solution for any ⃗ b, ⃗ t ≥ 0 ∀i.
The NNLS problem consist in the minimization task We can transform our problem in Eq.B1 to a NNLS by just substituting E → M , ⃗ x → ⃗ t and ⃗ f → ⃗ b.For solving our original problem we need to find a solution such that ∥M ⃗ t − ⃗ b∥ = 0.
For solving this problem, we will employ the Algorithm NNLS (see [36] for the details of the algorithm).A key characteristic of this algorithm is that it is proven that it converges to the optimal solution in a finite number of steps.Thus, it is direct to see that if there exist a solution to our original problem, there would also be a solution for its NNLS version with ∥M ⃗ t − ⃗ b∥ = 0.
We have run several numerical experiments for uniformly random problem vectors ⃗ b.We see that when employing this algorithm, the number of nonzero times in the output coincides with the number of coupling terms in the system.

Constructive method for obtaining a positive solution for every problem
The proof that the algorithm NNLS converges to a positive solution relies on the fact that such solution exists.In this subsection we will construct a general method for building positive solutions for this problem for all cases.With this we will prove that we can construct a DAQC protocol which flips the effective signs of the Hamiltonian terms such that the times of the analog blocks are always positive.
As a sketch of the proof, we will start by noting that all possible DAQC schedules generates up to 4 n different columns to choose from to build the matrix M .Then, we note that these columns corresponds to the vertices of a polytope with center of mass in the origin of coordinates.We will prove that we can find a sum of the coordinates of these vertices with positive coefficients.Finally, we will show that projecting the coordinates of a small hypersphere around the center of mass we can write any other point in the hyperspace with a positive sum, and thus we can solve any problem in the same manner.
a. Proof of the existence of a schedule with positive times Starting from the the general case of arbitrary twobody Hamiltonians, we need to find a protocol for simulating a a Hamiltonian consisting of N two-body terms employing the same number of terms.As we did for the new protocol, we can restrict ourselves to sandwiching each analog block only with Pauli gates.These gates plus the identity, {1, X, Y, Z}, generate a pool of 4 n different combinations.In turn, these combinations of gates generates the same number of possible columns for the matrix M , M = {M i } 4 n i=1 such that M i ∈ {±1} N .The rules to define a column M i given a selection of SQGs can be addressed qubit by qubit and coupling by coupling, employing the following relations Y XY = ZXZ = −X, XY X = ZY Z = −Y , XZX = Y ZY = −Z and µµµ = µ for µ = {1, X, Y, Z}.From these properties, one can note that each of the couplings σ µ i σ ν j can only change if we apply a gate, i.e. {X, Y, Z}, to at least one of the two qubits i or j.
Each selection of SQGs for the sandwiching will generate a new column M i which is linearly independent to every other column from the set M , M i ∦ M j ∀i < j ≤ 4 n .As we have proven in Appendix A, there is at least one combination of columns which forms a basis for a Ndimensional space.This assures that taking any other extra column, we can define a N -polytope.We define the convex N -polytope P as the volume with vertices in M i , i=1 α i ≤ 1, α i ≥ 0 ∀i}.Now we will employ a generalization of the theorem from Ref. [37], which states the following: Theorem 1 ( [38]) Let P be a d-plytope, p ∈ P , and k and n positive integers with kn ≥ d.Then, there are points p 1 , . . ., p n in the k-skeleton of P with barycenter p = 1 n (p 1 + • • • + p n ).For our proof, we will particularize this theorem to the 0-skeleton by taking the extreme points of 4 n edges of the 1-skeleton p 1 , . . ., p 4 n , such that these points exactly coincide with the 0-skeleton, {p 1 , . . ., p 4 n } = skel 0 (P).Now, we will prove that the barycenter of the 0-skeleton corresponds to the point ⃗ 0 = (0, . . ., 0), this is, the next step is to prove that (B2) We will start by focusing on a single row, the one corresponding of the Z 1 Z 2 coupling.As stated previously, this coupling will change in a way that only takes into account the gates applied to qubits 1 and 2. The combination of gates that flips the sign of this coupling is The SQGs for the rest of the qubits can be chosen arbitrarily, so we have a total of 8 • 4 n−2 different columns in which the sign flips.As this number is exactly half of the total number of columns, the sum in Eq.B2 for the row corresponding to the Z 1 Z 2 coupling is 0. This can be straightforwardly extended to all couplings repeating the same argument.Employing Th. 1 and Eq.B2, we find that the barycenter of skel 0 (P) is the point ⃗ 0 = 4 −n 4 n i=1 M i .Now, we will construct a hypersphere S with small radius r ≪ 4 −n centered in the point ⃗ 0. For this, we will slightly distort the sum with an extra term ⃗ ε = (ε 1 , . . ., ε 4 n ) such that this vector is in the surface of S, ⃗ s = 4 −n ⃗ 1 + ⃗ ε ∈ S with By definition of the hypersphere centered at the origin, any point ⃗ x can be obtained by projecting a point of the hypersphere ⃗ s, ∃!⃗ s ∈ S : ⃗ x = λ⃗ s, λ ≥ 0, ∀⃗ x ∈ R N .We can then write the original problem using this projection from the hypersphere to solve the problem in Eq.B1 with positive solutions, By construction, all the times of the analog blocks are positive, t i = λ(4 −n + ε i ) ≥ 0 ∀i.with this, we have proven that there exist at least one positive solution to the original problem, so that we can always converge to a positive solution by employing the Algorithm NNLS.■

FIG. 3 .
FIG. 3. Frobenius distance between the optimized circuit and the exact evolution vs the number of digital-analog blocks.(a)We solve the problem of the nearest-neighbour Hamiltonian for 6 qubits.We show two cases, one in which the couplings in the system Hamiltonian is homogeneous, and the other where the coupling strength are in a normal distribution around the values of the former.We also distinguish two versions for the optimization process, which fixes the length of the analog blocks or leaves them as a variables.As a baseline, we represent the distances obtained with first order Trotterization up to nT = 19 Trotter steps.The shown values indicate the mean Frobenius distance and the error bars show the interquartile range.The inset on top provides extended view in the coordinate axis for a higher number of blocks in logarithmic scale.(b) We repeat the procedure for a single run with a different classical simulation method, in which we employ a first order Trotter approximation for computing both the circuit and the target.
b b ã c c b b c c b c c ã b b c b c c b c b ã b c c b c c b b b ã

4 n
i=1 ε i = 0, | 4 n i=1 ε i M i | = r and |ε i | ≤ 4 −n ∀i.Since we are adding a small deviation around the barycenter, the points in the surface of S are inside the polytope, S ∈ P.