Log In Sign Up

Circuit encapsulation for efficient quantum computing based on controlled many-body dynamics

Controlling the time evolution of interacting spin systems is an important approach of implementing quantum computing. Different from the approaches by compiling the circuits into the product of multiple elementary gates, we here propose the quantum circuit encapsulation (QCE), where we encapsulate the circuits into different parts, and optimize the magnetic fields to realize the unitary transformation of each part by the time evolution. The QCE is demonstrated to possess well-controlled error and time cost, which avoids the error accumulations by aiming at finding the shortest path directly to the target unitary. We test four different encapsulation ways to realize the multi-qubit quantum Fourier transformations by controlling the time evolution of the quantum Ising chain. The scaling behaviors of the time costs and errors against the number of two-qubit controlled gates are demonstrated. The QCE provides an alternative compiling scheme that translates the circuits into a physically-executable form based on the quantum many-body dynamics, where the key issue becomes the encapsulation way to balance between the efficiency and flexibility.


page 1

page 2

page 3

page 4


An efficient quantum circuits optimizing scheme compared with QISKit

Recently, the development of quantum chips has made great progress-- the...

Efficient decomposition of unitary matrices in quantum circuit compilers

Unitary decomposition is a widely used method to map quantum algorithms ...

Algebraic Compression of Quantum Circuits for Hamiltonian Evolution

Unitary evolution under a time dependent Hamiltonian is a key component ...

Sample Complexity of Learning Quantum Circuits

Quantum computers hold unprecedented potentials for machine learning app...

Constant-cost implementations of Clifford operations and multiply controlled gates using global interactions

We consider quantum circuits composed of single-qubit operations and glo...

Optimizing Variational Quantum Circuits using Evolution Strategies

This version withdrawn by arXiv administrators because the submitter did...

I Introduction

Quantum computing is recognized as a promising scheme being superior to the classical computing for its exponential speed-up by executing multiple computational tasks parallelly in different quantum channels [1, 2, 3]. With the fast growth of the number of controllable qubits, efficient compiling of the quantum algorithms to the physically-executable forms becomes increasingly important. A mainstream compiling scheme is to transform the circuit into the product of executable elementary gates, which are the quantum version of the instruction set [4, 5, 6, 7, 8]. The instruction set should be constructed according to the physical mechanism of the hardware. For instance, a quantum computer formed by the superconducting circuits can use the QuMIS [9] as the instructive set. For the quantum photonic circuits, the elementary gates represent certain basic operations on single photons [10, 11]. The efficiency of compiling a given quantum algorithm with a chosen instruction set can be characterized by the depth of the compiled circuit.

Another important approach of quantum computing is by controlling the dynamics of quantum systems. A representative platform is the nuclear magnetic resonance system, where quantum gates or algorithms [12, 13, 14, 15], such as the quantum factoring [16] and search [17, 18, 19] algorithms, have been realized by the radio-frequency pulse sequences. The efficiency can be characterized by the time cost for the controlling. For the two-qubit gates, such as the controlled-not (CNOT) gate, the time costs with optimal control have theoretically given bounds [20, 21, 22]. For the -qubit gates with

, such bounds are not rigorously given in most cases, and variational methods including the machine learning (ML) techniques are used in the optimal-control problems 

[23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]. Besides, the quantum many-body systems have also been used to implement the measurement-based quantum computation [34, 35, 36, 37, 38, 39, 40]. However, the utilizations of the many-body dynamics for quantum computing [25, 28, 29] are much less explored, where more valid schemes are desired.

For all known quantum computing platforms, severe challenges are caused by the inevitable noises. The noises might induce computational errors, making the results unstable or unreliable. One way of fighting against the errors is to add the error correction codes [41], such as Toric codes [42], which will further increase the complexity of the circuits. Noises will also lead to decoherence, meaning that the qubits will gradually become less entangled and lose the superiority over the classical computing. Prolonging the coherence time and reducing the time cost so that the quantum computing is executed within the coherence duration belong to the significant and challenging issues for quantum computing (see, e.g., Refs. [43, 44, 45, 46]).

Concerning the quantum computing based on the controlled many-body dynamics, we here propose the quantum circuit encapsulation (QCE) to optimize the magnetic fields for efficient implementation of quantum circuits. Considering a target unitary (dubbed as quantum capsule, Q-cap in short) that might be formed by one or multiple gates, the idea is to optimize the magnetic fields so that the time-evolution operator realizes the unitary. In the QCE, a quantum circuit can be considered as one Q-cap or divided into multiple Q-caps, corresponding to different encapsulation ways. As the intermediate processes given by the gates within a Q-cap will not appear in the time evolution, different encapsulation ways result in different flexibilities. A key issue in the QCE is thus the balance between the efficiency and flexibility.

We compare four different ways of encapsulation for the realization of the -qubit quantum Fourier transformation (QFT) [47, 48, 49], and demonstrate the scaling behaviors of the errors and time costs against the number of controlled gates. Specifically, we show a slow linear growth of the time cost with well-controlled errors up to , by considering the whole circuit as one Q-cap. For lager ’s, the block-wise encapsulation is speculated to be a proper choice, where we expect moderate linear growths of the time costs and errors.

Ii Quantum circuit encapsulation

Consider a quantum circuit that consists of gates () with . We here propose to find the time-dependent Hamiltonian , and its evolution operator for the time duration optimally gives the unitary transformation of the target circuit , i.e.,


We take the Plank constant for simplicity.

We constrain that the adjustable parameters of the Hamiltonian only concerns the one-body terms, i.e., the magnetic fields. Specifically, we take the quantum Ising model as an example, where the Hamiltonian reads


with the spin operator in the direction (), the coupling strength between the -th and -th spins, and the magnetic field along the direction on the -th spin at the time . We assume to be constant and to be adjustable with time.

The goal becomes optimizing the magnetic fields to minimize the difference between the time-evolution operator and the target unitary

. To this end, a simplest choice is to minimize the following loss function defined as


The magnetic fields are optimized using the gradient descent as


with the gradient step or learning rate. Since such an optimization cares about the distance between the unitary given by the whole circuit and the evolution operator at the final time , the evolution at will not give any intermediate results from the gates within the circuit. We dub such a circuit encapsulation (CE) way as all-CE.

In the numerical simulation, we take the Trotter-Suzuki form [50, 51] and discretize the total time to identical slices. The evolution operator can be approximated as


with that controls the Trotter-Suzuki error. For varying the magnetic fields, we introduce with a positive integer, and assume to take the constant value during the time of (with and ). In other words, the magnetic fields are allowed to change for times. The magnetic fields are updated as


where the gradients

are obtained by the automatic differentiation in Pytorch 

[52]. We use the optimizer Adam [53] to dynamically control the learning rate .

We employ two algorithms to implement the optimizations, namely the global time optimization (GTO) and fine-grained time optimization (FGTO) [32]. GTO is a simple gradient-descent method, where the strengths of the magnetic fields for all time slices are updated simultaneously by Eq. (6). For the simple cases such as the two-qubit unitaries, GTO shows high accuracy. However, for more complicated cases such as the -qubit QFT with a large , GTO could be trapped in a local minimum. The FGTO is thus employed, where the key idea is to asymptotically fine-grain the time discretization (characterized by ) to avoid the possible local minimums. See more details in Ref. [32].

The way of encapsulation is flexible. In general, we consider to separate the gates in the circuit into groups as


The unitary consists of gates from the target circuit and is named as a quantum capsule (Q-cap). We have . We optimize the magnetic fields independently for each Q-cap, where we define the loss function for as


wth the evolution duration for realizing and the total time . The magnetic fields during are optmized by minimizing .

As a natural encapsulation way, the main advantage of the all-CE (meaning to treat the whole circuit as one Q-cap) is straightforward, which is to reduce the time cost and error by directly finding the path to the final unitary. One may compare, for instance, with a naive way by considering each gate in the circuit as a Q-cap (naive-CE). First, the errors of sequentially realizing each gate would in general accumulate. We expect much less errors by directly minimizing the difference between the target and the final evolution operator in the all-CE, which is similar to the end-to-end optimization strategy widely used in the field of ML and ML-assisted physical approaches (see, e.g., Ref. [27]).

Second, a unitary can be compiled into different circuits by applying different quantum instruction sets. One may use the depth of the circuit to characterize the efficiency of the compilation. The depth would usually change if one turns to a different instruction set. From the perspective of QCE, the efficiency should be characterized by the total time cost for reaching the preset error. An obvious drawback of all-CE is that one cannot extract the relevant information of the intermediate process from the gates within the circuit (i.e., Q-cap). Therefore, a proper encapsulation should balance between the efficiency and the ability of extracting the intermediate information, according to the specific computational tasks or purposes. For example, the frequently-use circuits, such as the QFT applied in many quantum algorithms including Shor’s [54] and Grover search [55] algorithms, can be encapsulated into Q-caps for the convenience of the future use.

Iii Results of quantum circuit encapsulation

Below, we take Hamiltonian for the time evolution as the nearest-neighbor Ising chain, where the coupling constants satisfy


We set the magnetic fields along the spin-z direction as zero, and allow to adjust the fields only along the spin-x and y directions. Such a restriction often appears in the controlling by the radio-frequency pulses [56].

Figure 1: (Color online) The time-dependent error versus the time . The dashed lines and the solid lines with triangles show the by the decomp-CE and all-CE, respectively. The colored shadows indicate the time costs for realizing the the gates in the right-hand-side of Eq. (11) (decomp-CE).

As a simple example, we consider the two-qubit controlled-R (CR) gate that satisfies


with the factor of phase shift. A normal treatment is to decompose a CR into the product of single-qubit rotations and CNOT as


satisfying  [57] and a phase factor.

Taking , and , Fig. 2 compares the error [ in Eq. (3)] by encapsulating the CR (all-CE) and that by encapsulating gate by gate after decomposing it into the elementary gates [Eq. (11)] (named as the decomposed CE, decomp-CE in short). Since only the two-qubit gates are involved, we choose GTO to optimize the magnetic fields. The dashed lines (decomp-CE) and solid lines with triangles (all-CE) show the time-dependent error . Note in all cases, the magnetic fields are always optimized according to the definitions of the Q-caps. The time costs of realizing different elementary gates in the decomp-CE are illustrated by the colored shadows. The time cost of the all-CE is indicated by the x-coordinate of the last triangle, which is about five times shorter than the decomp-CE. For a single-qubit rotation , it can be written as the one-body evolution operator with the magnetic field along the corresponding direction, i.e.,


Therefore, the time cost of

is estimated as

. Without losing generality, we here take to estimate the time costs of the single-qubit rotations.

An important observation is that even the time cost of a single CNOT is larger than that of the CR by the all-CE. The all-CE of CR also leads to much lower errors with . For the decomp-CE, the error accumulates and finally reaches that is about ten times larger than that by the all-CE. Therefore, from the perspective of QCE, it is not a wise choice to decompose the CR into the product of CNOT and the single-qubit rotations.

Figure 2: (Color online) The error [Eq. (3)] with different total evolution duration for the CNOT and CR() (with ) by the all-CE.

Fig. 2 shows how the error varies with the total evolution duration for realizing the CNOT and CR() by the all-CE. In all cases, decreases with as expected, meaning that higher accuracy can be reached by increasing the evolution time. Below, the time cost of a Q-cap is determined by the when the reaches about . Again, we show that CR() requires much shorter time than CNOT to obtain a similar accuracy. For the CR(), the time cost increases with for all ’s.

Figure 3: (Color online) (a) The error [Eq. (3)] with different total evolution duration for the -qubit QFT with by the all-CE. The inset illustrates the circuit of the -qubit QFT. In (b) and (c), we show the errors and time costs using the all-CE, block-CE, naive-CE, and decomp-CE against the number of CR gates . The errors from the all-CE are controlled to be about . The solid lines in (b) show the linear fittings of for the block-CE, naive-CE, and decomp-CE, with the coefficient of determinant , , and , respectively. The solid lines in (c) show the linear fittings of for the all-CE, block-CE, naive-CE, and decomp-CE with , , , and , respectively.

Fig. 3(a) demonstrates the error [Eq. (3)] of realizing the -qubit QFT by all-CE with different total time duration , for . The inset illustrates the circuit with as an example. In general, one can obtain lower by increasing . Longer evolution time is required to reach a preset error if increases.

We further compare the errors () and the corresponding time costs () using different encapsulation ways. The block-CE of the QFT circuit is illustrated by the dashed hollow squares in the inset of Fig. 3(a). The circuit is divided into several blocks according to the positions of the Hadamard gates . Each block is treated as a Q-cap for optimizing the magnetic fields. The block-CE possesses certain flexibility. For instance, the last () blocks form the circuit of the -qubit QFT. We also try the naive-CE, where we treat each gate in the QFT circuit as a Q-cap for the optimization of the magnetic fields. For the decomp-CE, we decompose each CR gate to the product of the CNOT and single-qubit rotations following Eq. (11), and then treat each gate as a Q-cap for optimization.

There is an important detail we shall stress. For the -qubit QFT, if a Q-cap only concerns qubits with , we use the quantum Ising model of just the qubits to implement the time evolution. It means that the irrelevant couplings outside such a -qubit quantum Ising model are turned off. Surely we can keep all the couplings in the -qubit system and find the optimal magnetic fields to realize the unitary acting on the -qubit subsystem. This, however, will lead to much lower accuracies than those by turning off the irrelevant couplings. We therefore choose to turn off the irrelevant couplings in the block-CE, naive-CE, and decomp-CE, as the baselines compared with the all-CE.

Fig. 3(b) shows how the error of realizing the QFT increases with the number of the CR gates using different encapsulation ways. As we require [Eq. (8)] for the optimization of each Q-cap, we have for the all-CE as there is only one Q-cap [red squares in Fig. 3(b)]. For other encapsulation ways, there exist multiple Q-caps, where the errors accumulate. Consequently, we observe that increases linearly with as


with the slope , , and for the block-CE, naive-CE, and decomp-CE, respectively. We have the coefficient of the determinant that characterizes the error of a linear fitting as , , and , respectively.

The corresponding time costs for reaching the errors in Fig. 3(b) are given in Fig. 3(c). The linear dependence of on is observed for all four kinds of encapsulation ways with


The naive-CE gives the smallest slope with with . This is possibly because we allow to turn off the irrelevant couplings, then only need to deal with two-qubit evolution gates as the Q-caps in the naive-CE. If partially turning off the couplings in the evolution is not possible in the experimental setting, the all-CE obviously give the best results with (). The slopes from the block-CE and decomp-CE are close to each other with () and (), respectively, which are obviously larger than that of the all-CE. By considering both and , as well as the possible restrictions on the controlling of the couplings, we conclude that the all-CE provides the most proper way to realize the -qubit QFT for , where the error remains approximately constant and the time cost increases linearly in a moderate speed with .

We speculate that the above conclusions will hold if we further increase . But be aware that one loses flexibility when encapsulating larger circuits into Q-caps. A natural choice for a larger circuit is to use the block-CE, where we may restrict the number of qubits in each Q-cap to be maximally with, say, . The proper value of for different kinds of circuits or algorithms is to be explored in the future. Considering the computational cost of the FGTO algorithm increases exponentially with

, tensor network methods 

[58, 59, 60, 61] can be applied to lower the exponential cost to be polynomial in order to access larger ’s.

Iv Summary

We have proposed the quantum circuit encapsulation (QCE) for the efficient quantum computing based on the dynamics of the interacting spin systems controlled by magnetic fields. The key idea of QCE is to define the quantum capsule (Q-cap) formed by multiple gates (e.g., the whole circuit or a part of it), where we ignore the intermediate processes therein but optimize the magnetic fields by directly targeting on the unitary represented by the Q-cap. Well-controlled errors and time costs are demonstrated by taking the -qubit quantum Fourier transformation as an example. Besides the conventional compiling ways using the elementary gates, QCE provides an alternative of translating the quantum circuits into a physically-executable form, and brings new prospects on the quantum computing on the interacting spin systems.


This work was supported by NSFC (Grant No. 12004266, No. 11834014, No. 12075159, and No. 12171044), Beijing Natural Science Foundation (No. Z180013 and No. Z190005), Foundation of Beijing Education Committees (No. KM202010028013), the key research project of Academy for Multidisciplinary Studies, Capital Normal University, Shenzhen Institute for Quantum Science and Engineering, Southern University of Science and Technology (Grant No. SIQSE202001), and the Academician Innovation Platform of Hainan Province.