The following article is Open access

Efficient quantum circuits for diagonal unitaries without ancillas

, , and

Published 31 March 2014 © 2014 IOP Publishing Ltd and Deutsche Physikalische Gesellschaft
, , Citation Jonathan Welch et al 2014 New J. Phys. 16 033040 DOI 10.1088/1367-2630/16/3/033040

1367-2630/16/3/033040

Abstract

The accurate evaluation of diagonal unitary operators is often the most resource-intensive element of quantum algorithms such as real-space quantum simulation and Grover search. Efficient circuits have been demonstrated in some cases but generally require ancilla registers, which can dominate the qubit resources. In this paper, we give a simple way to construct efficient circuits for diagonal unitaries without ancillas, using a correspondence between Walsh functions and a basis for diagonal operators. This correspondence reduces the problem of constructing the minimal-depth circuit within a given error tolerance, for an arbitrary diagonal unitary ${{e}^{if\left( \hat{x}\, \right)}}$ in the $\left| x \right\rangle$ basis, to that of finding the minimal-length Walsh-series approximation to the function f(x). We apply this approach to the quantum simulation of the classical Eckart barrier problem of quantum chemistry, demonstrating that high-fidelity quantum simulations can be achieved with few qubits and low depth.

Export citation and abstract BibTeX RIS

Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.

Quantum computation within the circuit model relies on the ability to construct efficient sequences of elementary quantum operations, or gates, that produce a faithful representation of the unitary operators appearing in quantum algorithms. We consider the situation where the unitary of interest is diagonal. Some important algorithms where this applies are quantum simulation of quantum dynamics [14], quantum optimization [5], and Grover search [6]. For example, optimization—finding the maximum of a function g(x)—can be reformulated as the problem of finding the ground state of the diagonal Hamiltonian, $\hat{H}\,=-{{\mathop{\sum }^{}}_{x}}g\left( x \right)\left| x \right\rangle\left\langle x \right|$, which requires implementing ${{e}^{-i\hat{H}\,t}}={{e}^{itg\left( \hat{x}\, \right)}}$.

To implement an n-qubit diagonal unitary exactly on a quantum computer generally requires ${{2}^{n+1}}-3$ one- and two-qubit gates [7]. However, one is usually interested in circuits that approximate the unitary to within some error tolerance, ε. In order to be of practical value, such a circuit must be efficient—the number of one- and two-qubit gates should scale no worse than $O\left( \text{poly}\left( n,1/\epsilon \right) \right)$ [8]. Efficient circuits for diagonal unitaries have been demonstrated, but with the requirement of ancilla qubits. In the real-space quantum simulation algorithm [1, 2], for example, studies indicate that ancilla registers often dominate the qubit resources [3, 9]. Due to limitations in the coherence time and number of qubits in any future practical implementation of quantum computing, it is desirable to decrease these resources as much as possible.

In this paper, we provide a constructive algorithm that significantly reduces the qubit resources through the use of a correspondence between Walsh functions [10] and a basis for diagonal operators. Our construction builds on earlier work that established a connection between the Walsh–Hadamard transform and the circuit required to implement a diagonal unitary [11, 12]. These authors showed that an n-qubit diagonal unitary ${{e}^{if\left( \hat{x}\, \right)}}$ can be implemented exactly using a circuit with ${{2}^{n}}-1$ z-axis rotation operators with rotation angles proportional to the discrete Walsh transform coefficients of f (x). The circuit depth 3 was found to be ${{2}^{n+1}}-3$ [12]. In this analysis f (x) was a real-valued function of an n-bit string, taking ${{2}^{n}}$ discrete values.

Here, we are concerned with approximate implementation of diagonal unitaries, as described above. In particular, we are interested in the important case where f(x) is a real-valued function of a continuous variable x, rather than an n-bit string. We show that this can be accomplished using circuits of a similar type to those in [11, 12]. By identifying elementary operators whose eigenvalues in the x-basis are Walsh functions, we show that an arbitrary diagonal unitary may be approximated efficiently on a finite register by using a Walsh–Fourier series approximation for f(x). Since the Walsh basis is the only basis with this property, it follows that it is the natural basis for representing arbitrary diagonal unitaries. In this paper, we quantify the error resulting from such approximations, and describe how to do them optimally.

We first consider approximating f(x) with a partial Walsh–Fourier series containing ${{2}^{k}}$ terms, with $k\leqslant n$, where n is the number of qubits. Since the bound on the error in this approximation is inversely proportional to the number of terms [13], the resulting gate sequence is efficient. Next, we address the problem of finding the shortest possible gate sequence that approximates the diagonal unitary ${{e}^{if\left( \hat{x}\, \right)}}$ with error ε. This problem reduces to finding the minimal-length Walsh series ${{f}_{s}}\left( x \right)$ satisfying $\left| {{f}_{s}}\left( x \right)-f\left( x \right) \right|\leqslant \epsilon $. This is in general an integer programming problem [14], but its solution can be found to a good approximation by throwing away the coefficients of the Walsh–Fourier series for f that fall below a certain bound [1315]. This can lead to a significant reduction in circuit depth beyond the partial series approximation.

As a simple yet practical demonstration of these ideas, we describe a 1D implementation of the real-space quantum simulation algorithm for a single particle tunneling through an Eckart barrier [16]. This problem is a benchmark in classical computational methods of quantum chemistry for simulating quantum dynamics. This example illustrates that high-fidelity quantum simulations without ancillas can be achieved with few qubits and low depth.

1. Walsh functions and operators

In this section we identify the mapping between Walsh functions and a basis for diagonal operators. We begin with some definitions.

1.1. Walsh functions

The Paley-ordered Walsh functions are defined on the continuous interval $0\leqslant x<1$ as [13]

Equation (1)

for integer $j=0,1,2,\ldots ,\infty $. They form a complete and orthonormal set, $\mathop{\int }^{}_{0}^{1}{{w}_{j}}\left( x \right){{w}_{l}}\left( x \right)dx={{\delta }_{jl}}$. This definition may be extended to the entire real line by periodic repetition. Here ${{j}_{i}}$ is the ith bit in the binary expansion, $j=\underset{n}{\overset{i=1}{\mathop{\mathop{\sum }^{}}}}\,\;{{j}_{i}}{{2}^{\left( i-1 \right)}}$, and ${{x}_{i}}$ is the ith bit in the dyadic expansion, $x=\underset{\infty }{\overset{i=1}{\mathop{\mathop{\sum }^{}}}}\,{{x}_{i}}/{{2}^{i}}$, where n is the index of the most significant non-zero bit of j. In standard binary notation, therefore, we have $j=\left( {{j}_{n}}{{j}_{n-1}}\ldots {{j}_{1}} \right)$ and $x=\left( {{x}_{1}}{{x}_{2}}\ldots {{x}_{n}} \right)$, where the most significant bit is on the left.

The ${{w}_{j}}$ with indices that are powers of two, $j={{2}^{n}}$, $n=1,\ldots ,\infty $ are square waves known as Rademacher functions. The Rademacher function of order n is denoted ${{R}_{n}}\left( x \right)={{\left( -1 \right)}^{{{x}_{n}}}}$. The first eight Walsh functions are plotted in figure 1. Rademacher functions are in red.

Figure 1.

Figure 1. First eight Walsh functions, in Paley order. Rademacher functions are in red.

Standard image High-resolution image

Like trigonometric functions, Walsh functions can be used as a basis for orthonormal expansion. For discretely sampled functions this is accomplished by a discrete Walsh–Fourier transform. For arbitrary n, let us discretize the interval $\left[ 0,1 \right)$ into $N={{2}^{n}}$ points, ${{x}_{k}}=k/N$, $k=0,\ldots ,N-1$. We define discrete Walsh functions as ${{w}_{jk}}={{w}_{j}}\left( {{x}_{k}} \right)$. In terms of the bits of j, k, and x, we have

Equation (2)

where ${{k}_{i}}$ is the ith bit in the dyadic expansion, $k=\underset{n}{\overset{i=1}{\mathop{\mathop{\sum }^{}}}}\,{{k}_{i}}{{2}^{\left( n-i \right)}}$. The second equality shows that the functional form is the same whether x is continuous or discrete, the only difference being the number of bits in the expansion of x. This makes Walsh series useful for representing discretely sampled continuous functions.

The orthonormality and completeness properties in the discrete case are $\frac{1}{N}\underset{N-1}{\overset{k=0}{\mathop{\mathop{\sum }^{}}}}\,{{w}_{jk}}{{w}_{lk}}={{\delta }_{jl}}$ and $\frac{1}{N}\underset{N-1}{\overset{j=0}{\mathop{\mathop{\sum }^{}}}}\,{{w}_{jk}}{{w}_{jl}}={{\delta }_{kl}}$, respectively. The discrete Walsh–Fourier transform ${{a}_{j}}$ of a function ${{f}_{k}}=f\left( {{x}_{k}} \right)$ is

Equation (3)

Equation (4)

To complete the analogy with Fourier series, we recall that orthonormal functions arise as the irreducible representations of symmetry groups [17]. For trigonometric functions, the relevant group is that of translations. For Walsh functions up to order ${{2}^{n}}$, it is the group $\mathbb{Z}_{2}^{\otimes n}$, which is formed by a basis for diagonal operators on n qubits. These are the Walsh operators introduced below.

1.2. Walsh operators

The state of an n-qubit register in a quantum computer is typically expressed as a superposition, $\left| \psi \right\rangle=\underset{N-1}{\overset{k=0}{\mathop{\mathop{\sum }^{}}}}\,{{c}_{k}}\left| k \right\rangle$, of $N={{2}^{n}}$ states in the computational basis [6], defined as

Equation (5)

Here $k=0,1,\ldots ,N-1$ is represented as an n-bit dyadic expansion, as above, $k=\underset{n}{\overset{i=1}{\mathop{\mathop{\sum }^{}}}}\,{{k}_{i}}{{2}^{\left( n-i \right)}}$. The bits ${{k}_{i}}=0$ or 1 denote the state of the ith qubit. A unitary operator $\hat{U}\,={{e}^{i\hat{f}\,}}$ that is diagonal in this basis is given in terms of its eigenvalues as $\hat{f}\,\left| k \right\rangle ={{f}_{k}}\left| k \right\rangle $. Functions f(x) of a continuous variable, $x\in \left[ 0,L \right)$, may be represented in this way if they are discretely sampled. Here we will assume a constant sampling interval, and define the sampling (grid) points as ${{x}_{k}}=kL/N$, so that ${{f}_{k}} \equiv f\left( {{x}_{k}} \right)$. To simplify the discussion, we use units such that L = 1 to restrict the variable ${{x}_{k}}$ to the interval $\left[ 0,1 \right)$ where Walsh functions are defined. The results for general L are obtained by replacing w(x) by $w\left( x/L \right)$. We will also use the notation $\left| k \right\rangle$, $\left| {{x}_{k}} \right\rangle$, and $\left| x \right\rangle$ interchangably, dropping the subscript k on x when there is no loss of clarity.

Let ${{\hat{Z}\,}_{i}}$ denote the Pauli Z operator acting on the ith qubit, ${{\hat{Z}\,}_{i}}\left| {{k}_{1}},\ldots ,{{k}_{n}} \right\rangle={{\left( -1 \right)}^{{{k}_{i}}}}\left| {{k}_{1}},\ldots ,{{k}_{n}} \right\rangle$. We define the Walsh operator of order j on n qubits as

Equation (6)

where $j=1,\ldots ,{{2}^{n}}$, and ${{j}_{i}}$ is the $i\text{th}$ bit in the binary expansion, $j=\underset{n}{\overset{i=1}{\mathop{\mathop{\sum }^{}}}}\,\;{{j}_{i}}{{2}^{\left( i-1 \right)}}$. Powers of ${{\hat{Z}\,}_{i}}$ are defined as ${{\left( {{\hat{Z}\,}_{i}} \right)}^{1}} \equiv {{\hat{Z}\,}_{i}}$ and ${{\left( {{\hat{Z}\,}_{i}} \right)}^{0}} \equiv \hat{1}\,$. The set of all Walsh operators $j=1,\ldots ,{{2}^{n}}$ forms a basis for diagonal operators on n qubits, given by all possible tensor products of single-qubit Pauli Z gates. Their eigenvalues in the computational basis $\left| x \right\rangle$, $x\in \left[ 0,1 \right)$, are Walsh functions with index j and independent variable x: ${{\hat{w}\,}_{j}}\left| x \right\rangle=\otimes _{i=1}^{n}{{\left( {{\hat{Z}\,}_{i}} \right)}^{{{j}_{i}}}}\left| k \right\rangle\;=\mathop{\prod }^{}_{i=1}^{n}{{\left( -1 \right)}^{{{j}_{i}}{{k}_{i}}}}\left| {{k}_{1}},\ldots ,{{k}_{n}} \right\rangle={{w}_{jk}}\left| k \right\rangle={{w}_{j}}\left( x \right)\left| x \right\rangle$. For the case of Rademacher functions, this relationship was pointed out by Sornborger [18], who observed that the eigenvalue of a single Pauli Z gate acting on the ith qubit in (5) is a binary-valued function of x with period $1/{{2}^{\left( i-1 \right)}}$.

The locations of the $\hat{Z}\,$ operators in ${{\hat{w}\,}_{j}}$ correspond to the positions of the 1's in the bit-reversed binary string for j. For example, the Walsh operator with j = 6 on n = 3 qubits is ${{\hat{w}\,}_{6}}=1\otimes \hat{Z}\,\otimes \hat{Z}\,$, since j = 6 in binary is $\left( {{j}_{3}}{{j}_{2}}{{j}_{1}} \right)=\left( 110 \right)$. The gate representation of ${{w}_{6}}$ is shown in figure 2. The general Walsh operator requires O(n) gates for its implementation: a single Z gate and up to $2n$ controlled NOTs.

Figure 2.

Figure 2.  ${{\hat{w}\,}_{6}}=1\otimes Z\otimes Z$.

Standard image High-resolution image

Using (4), any diagonal operator on n qubits may be expanded as a sum of $N={{2}^{n}}$ Walsh operators, $\hat{f}\,=\underset{N-1}{\overset{j=0}{\mathop{\mathop{\sum }^{}}}}\,{{a}_{j}}{{\hat{w}\,}_{j}}$. Walsh operators commute. Therefore any diagonal unitary may be written as a product of exponentials of Walsh operators,

Equation (7)

Each term in the product, ${{\hat{U}\,}_{j}}={{e}^{i{{a}_{j}}{{\hat{w}\,}_{j}}}}$, is of the form $\exp \left( -i\frac{{{\theta }_{j}}}{2}{{\otimes }_{i}}{{\left( {{\hat{Z}\,}_{i}} \right)}^{{{j}_{i}}}} \right)$, where ${{\theta }_{j}}=-2{{a}_{j}}$. Hence the circuit for ${{\hat{U}\,}_{j}}$ is identical to that for ${{\hat{w}\,}_{j}}$, except the Z-gate is replaced by a Z-rotation, ${{R}_{z}}\left( -2{{a}_{j}} \right)$, where ${{R}_{z}}\left( \theta \right) \equiv {{e}^{-iZ\theta /2}}$. The circuit for $\hat{U}\,$ is given by successively applying the circuits for ${{\hat{U}\,}_{j}}$.

Figure 3 shows two equivalent ways of implementing one such term, specifically ${{\hat{U}\,}_{7}}$. As seen in this figure, the gate configuration is not unique. We adopt the convention in figure 3(b) where the CNOTs are always targeted on the highest order qubit possible. Then a precise rule for constructing the circuit for ${{\hat{U}\,}_{j}}$ can be given in terms of the binary expansion of j: a rotation gate, ${{R}_{z}}\left( -2{{a}_{j}} \right)$, is placed on the qubit corresponding to the most significant non-zero bit (MSB) of j. Then CNOTs are placed on either side, targeted on the same qubit as the rotation gate, and controlled on the qubits corresponding to the 1's other than the MSB in the binary expansion of j. This rule will be used in the next section to construct an optimal circuit for $\hat{U}\,$.

Figure 3.

Figure 3. For n = 3 qubits, equivalent circuits for implementing the operator ${{\hat{U}\,}_{7}}=\exp \left( i{{a}_{7}}\left( Z\otimes Z\otimes Z \right) \right)$ in (7). We use the compact notation ${{R}_{j}} \equiv {{R}_{z}}\left( -2{{a}_{j}} \right)$. We follow the convention in (b) where the CNOTs are always targeted on the highest order qubit possible.

Standard image High-resolution image

Equation (7) easily generalizes to more than one dimension. For a d-dimensional system represented by d registers of n qubits each, the single Walsh operators will be replaced by tensor products of up to d Walsh operators over the different registers. The exact number depends on the number of variables in the function f. For applications to quantum simulation, this does not significantly increase the gate complexity as interaction potentials are generally few-body. Since products of Walsh operators are also Walsh operators, the expansions have the same form as (7) with $N={{2}^{dn}}$.

The utility of (7) is that it relates the circuit depth of $\hat{U}\,$ to the number of coefficients in the Walsh series for f. If some of these coefficients are zero or may be neglected, this leads to a reduction in the circuit depth for implementing $\hat{U}\,$. We will examine such cases below, but first we discuss methods to find optimal-depth circuits given a Walsh series for f, as well as to calculate the circuit depth based on the number of non-zero coefficients ${{a}_{j}}$.

2. Optimal circuit constructions

Implementing all ${{2}^{n}}-1$ Walsh functions (ignoring ${{\hat{w}\,}_{0}}={{I}^{\oplus n}}$ as it will only contribute a global phase, and hence will not affect the final result of any algorithm), for the unitary in (7) by concatenation of the individual circuits for each Paley-ordered Walsh operator gives an elementary gate count that scales as $O\left( n{{2}^{n}} \right)$. Each operator for a given ${{\hat{w}\,}_{j}}$ will require $2\left( {{h}_{j}}-1 \right)$ CNOTs where ${{h}_{j}}$ is the Hamming weight of index j, and one ${{R}_{z}}\left( \theta \right)$ gate. Therefore to implement all ${{2}^{n}}-1$ Walsh operators in the expansion would require

Equation (8)

CNOTs and ${{2}^{n}}-1$ single qubit rotation gates, which gives $1+{{2}^{n}}\left( n-1 \right)=O\left( n{{2}^{n}} \right)$. For n = 3 qubits, the general circuit found in this way is shown in figure 4, with vertical dashed lines separating the different Walsh operators. However, as Bullock and Markov have shown [7], this circuit construction is not optimal. They find that it is possible to reduce the gate count to ${{2}^{n+1}}-3$ and prove that this is optimal within a factor of two. In this section, we show that putting the Walsh operators in sequency order automatically produces the optimal circuit. In addition, we describe how to calculate the gate count for an arbitrary number of Walsh functions $N\prime <N$, where $N={{2}^{n}}$. This gate count scales as $O\left( N\prime \right)$.

Figure 4.

Figure 4. Non-optimal circuit implementing the Paley-ordered Walsh operators ${{\hat{w}\,}_{1}}$ through ${{\hat{w}\,}_{7}}$. Dashed lines separate the sub circuits for each of the individual Walsh functions. The rotation gates are ${{R}_{j}} \equiv {{R}_{z}}\left( -2{{a}_{j}} \right)$.

Standard image High-resolution image

We begin by recalling the relationship between the gate sequence for a Walsh operator ${{\hat{w}\,}_{j}}$ and the binary expansion of its index, j. This gate sequence is given by placing a rotation gate, ${{R}_{z}}\left( -2{{a}_{j}} \right)$, on the qubit corresponding to the most significant bit of j, and CNOTs on either side targeted on the same qubit and controlled on the qubits corresponding to the other non-zero bits of j. Since two identical CNOTs (CNOTs with the same targets and controls) cancel, it follows that the CNOTs between the rotation gates in adjacent Walsh operators are controlled on the non-zero bits of the bitwise XOR between their indices. For example, given a circuit with ${{\hat{w}\,}_{6}}$ followed by ${{\hat{w}\,}_{7}}$, the bitwise XOR of their indices is $6\oplus 7=\left( 110 \right)\oplus \left( 111 \right)=001$. Thus there will be a single CNOT controlled on qubit 1, located between the ${{R}_{z}}\left( -2{{a}_{6}} \right)$ and ${{R}_{z}}\left( -2{{a}_{7}} \right)$ gates on qubit 3. The target of this CNOT is qubit 3, the common MSB of the two Walsh function indices.

In order to minimize the number of CNOTs between rotation gates in a circuit containing all ${{2}^{n}}-1$ Walsh operators, the operators must be ordered in such a way that adjacent indices have the minimal number of binary transitions between them. Such an ordering is given by the Gray code [19], where the number of binary transitions between adjacent indices is exactly one. Walsh functions sorted in this way are called sequency ordered [19]. This is also the order of increasing number of zero crossings. For consistency with the rest of the paper, we keep the indices of Walsh functions and operators in Paley order, and do not relabel them in sequency order. In addition, we partition the Walsh functions according to their common MSBs. For $i>1$, the circuit for the ith partition, corresponding to MSB ${{j}_{i}}$, contains ${{2}^{\left( i-1 \right)}}$ rotation gates and ${{2}^{\left( i-1 \right)}}$ CNOTs, for a total of ${{2}^{i}}$ gates. When i = 1, there is only a single rotation gate. For an n qubit system the total number of gates is then $1+\underset{n}{\overset{i=2}{\mathop{\mathop{\sum }^{}}}}\,{{2}^{i}}={{2}^{n+1}}-3,$ which is the optimal gate count found by Bullock and Markov [7].

To illustrate the procedure, we give an example with n = 3 qubits. First we reorder the binary strings corresponding to the indices j (except j = 0) in Gray code. This is given by $\left\{ {{j}_{3}}{{j}_{2}}{{j}_{1}} \right\}=\left\{ 001,011,010,110,111,101,100 \right\}=\left\{ 1,3,2,6,7,5,4 \right\}$. Next, this set is partitioned into subsets with a common MSB: ${{G}_{1}}=\left\{ 001 \right\}=\left\{ 1 \right\}$, ${{G}_{2}}=\left\{ 011,010 \right\}=\left\{ 3,2 \right\}$, ${{G}_{3}}=\left\{ 110,111,101,100 \right\}=\left\{ 6,7,5,4 \right\}$. Each partition ${{G}_{i}}$ corresponds to a set of operators with rotation gates on, and CNOTs targeted on, qubit i. Finally, adjacent entries in each ${{G}_{i}}$ are XOR'ed to give the qubits containing the controls of the CNOTs. Since the last entry of each partition is always a single 1 in the ith place, this approach extends formally to the left-most CNOT in the corresponding circuit by taking an XOR between the first and last element of ${{G}_{i}}$. For example, the sub circuit corresponding to ${{G}_{3}}$ is found by evaluating

Equation (9)

From top to bottom, this gives CNOTs controlled on qubits 2, 3, 2, and 3, respectively. These go to the left of each rotation gate. In this way, we reduce the initial non-optimal circuit in figure 4 to the optimal circuit in figure 5.

Figure 5.

Figure 5. Optimal circuit implementing all 7 Walsh operators on 3 qubits. The Walsh operators are first reordered in sequency order (but keeping the Paley indices). Then all but one CNOT in between adjacent rotation gates cancels. This circuit is equivalent to the one in figure 4. The rotation gates are ${{R}_{j}} \equiv {{R}_{z}}\left( -2{{a}_{j}} \right)$.

Standard image High-resolution image

While this method can be used to generate the optimal circuit containing all $N-1={{2}^{n}}-1$ Walsh functions, it is not optimal when applied directly to the case of $N\prime <N-1$ Walsh functions, since adjacent elements in the sets ${{G}_{i}}$ will now contain multiple binary transitions. In this case, we can use the following commutation relations between CNOTs to simplify the circuit further. Letting $C_{j}^{i}$ denote a CNOT with control i and target j,

Equation (10)

Equation (11)

Equation (12)

Equation (13)

The first equation states that a Z gate commutes with the control of any CNOT. The second and third equations state that CNOTs with common targets but different controls, or common controls but different targets, commute. The final equation describes the case when the target of one CNOT is the control of another. Then commuting the two introduces an additional CNOT that is controlled by same qubit as the first and targeted on the same qubit as the second:

Equation (14)

Using these rules, we find that in most cases the gate count for a circuit with $N\prime <N$ Walsh operators on $n={{\log }_{2}}\left( N \right)$ qubits can be reduced to $O\left( N\prime \right)$ gates.

3. Efficient circuits for diagonal unitaries

In this section, we consider approximating f(x) with a partial Walsh–Fourier series. If n is fixed, this leads to an efficient circuit for $\hat{U}\,$. Otherwise it gives the minimum n necessary to represent $\hat{U}\,$ within the given error, ε.

Following [6], we define the error in implementing the operator $\hat{V}\,$ instead of $\hat{U}\,$ as $E\left( \hat{U}\,,\hat{V}\, \right) \equiv \| \hat{U}\,-\hat{V}\|\,$, where $\|\hat{A}\| \equiv \,{{\max }_{\left| \psi \right\rangle}}\left| \hat{A}\,\left| \psi \right\rangle \right|$ is the spectral norm of the operator $\hat{A}\,$. The maximum is taken over all normalized wavefunctions $\| \left| \psi \right\rangle | =\sqrt{\langle\psi \left| \psi \right\rangle}=1$. Letting ${{\hat{U}\,}_{\epsilon }}={{e}^{i{{f}_{\epsilon }}\left( \hat{x}\, \right)}}$, it follows from these definitions that $E\left( {{\hat{U}\,}_{\epsilon }},\hat{U}\, \right) \leqslant \epsilon $ iff $\left| {{f}_{\epsilon }}\left( x \right)-f\left( x \right) \right|\leqslant \epsilon ,\ \forall \ x$.

As discussed in the introduction, the circuit ${{\hat{U}\,}_{\epsilon }}$ approximating the operator $\hat{U}\,$ with error ε is efficient if it can be implemented using $O\left( \text{poly}\left( n,1/\epsilon \right) \right)$ one- and two-qubit gates. Our approach is to resample f at a rate ${{2}^{k}}\leqslant {{2}^{n}}$, with k the smallest integer possible resulting in a sampling error ${{\epsilon }_{k}}\leqslant\epsilon $. The resampled function may be written in terms of a ${{2}^{k}}$-term partial Walsh–Fourier series as ${{f}_{k}}\left( x \right)=\underset{{{2}^{k}}-1}{\overset{i=0}{\mathop{\mathop{\sum }^{}}}}\,{{a}_{i}}{{w}_{i}}\left( x \right)$. (x can be discrete or continuous.) For a continuously differentiable function f(x), the absolute error, ${{\epsilon }_{k}}={{\sup }_{x}}\;\left| {{f}_{k}}\left( x \right)-f\left( x \right) \right|$, satisfies ${{\epsilon }_{k}}\leqslant {{\sup }_{x}}\left| f\prime \left( x \right) \right|/{{2}^{k}}$ [13, 14]. (This expression works for discrete x as well, by interpreting $f\prime \left( x \right)$ as a finite difference.) Since the number of terms in the series ${{f}_{k}}$ is ${{2}^{k}}$, this implies that the number of Walsh functions necessary to approximate f(x) with absolute error ${{\epsilon }_{k}}\leqslant\epsilon $ is $O\left( 1/\epsilon \right)$. The number of gates in the corresponding unitary operator ${{U}_{\epsilon }}$ is ${{2}^{k+1}}-3$ [7], which is also $O\left( 1/\epsilon \right)$ and is a constant independent of n as long as $k\leqslant n$. This proves that the operator ${{e}^{i{{f}_{k}}\left( \hat{x}\, \right)}}$ is an efficient gate sequence for ${{e}^{if\left( \hat{x}\, \right)}}$ for any $nk$.

Although efficient circuits for diagonal unitaries can be constructed using partial Walsh–Fourier series, the circuit depth can often be reduced further by minimizing the number of Walsh functions used in the series for f(x). To be precise, consider the problem of finding a Walsh series ${{f}_{s}}\left( x \right)$ that satisfies $\left| {{f}_{s}}\left( x \right)-f\left( x \right) \right|\leqslant\epsilon $ with the smallest possible number of Walsh coefficients. This is an integer programming problem, whose solution can be found numerically given f(x) and ε. However, Yuen has shown that simply throwing away the terms of the Walsh–Fourier series for f(x) below an appropriate bound gives close to optimal results [14]. This is a much simpler procedure, and we apply it in the example in the next section. The solution gives the non-zero Walsh coefficients ${{a}_{j}}$ as well as the minimum number of grid points, ${{2}^{n}}$, needed to represent the resulting function. This information can then be combined with the circuit optimization methods described in the previous section to obtain a minimal-depth and minimal-width circuit for $\hat{U}\,$.

4. Quantum simulation example: eckart barrier

As a practical example of the ideas above, we analyze the quantum simulation of tunneling through an Eckart barrier by numerically implementing the real-space algorithm of Wiesner and Zalka [1, 2]. The Eckart barrier problem is a benchmark in classical computational methods of quantum chemistry for simulating quantum dynamics and transition states of chemical reactions. The solution to the scattering problem can be used for calculating chemical reaction rates [3].

4.1. Real-space algorithm

We evaluate the time evolution of a quantum system,

Equation (15)

using the real-space, or first quantized, representation of the wavefunction in terms of position eigenstates, $\left| \psi \left( t \right) \right\rangle = \int \left| \mathbf{x} \right\rangle\left\langle\mathbf{x}| \psi \left( t \right) \right\rangle d \mathbf{x}$. For a d-dimensional system ($d=3\;m$ for m particles), $\left| \mathbf{x} \right\rangle=\left| {{x}^{1}} \right\rangle\ldots \left| {{x}^{d}} \right\rangle$, and $d\mathbf{x} \equiv {{d}^{d}}x$. Each ${{x}^{i}}$ is discretized, and represented on the quantum computer in the computational basis as in (5). Using d registers of n qubits each, the basis states corresponding to a grid of ${{2}^{dn}}$ points can be represented.

Equation (15) is evaluated using the first-order Trotter formula [1, 3, 20, 21]. Assuming a time-independent Hamiltonian $\hat{H}\,=K\left( \hat{p}\, \right)+V\left( \hat{x}\, \right)$, where $\left[ \hat{K}\,,\hat{V}\, \right]\ne 0$, the quantum algorithm for evaluating (15) is

Equation (16)

where $t/\delta t$ is an integer called the Trotter number. The $\hat{f}\,$ operators are quantum Fourier transforms (QFTs) and are inserted to diagonalize the kinetic energy operators $\hat{K}\,$. The potential energy $\hat{V}\,$ is already diagonal in the position representation.

4.2. Error analysis

It is generally not possible to evaluate the diagonal unitary kinetic and potential propagators in (16) exactly. At the very least, there will be sampling error in going from the continuous $\left| x \right\rangle$ to the discrete $\left| {{x}_{k}} \right\rangle$ representation. This contribution to the total error is in addition to the Trotter error from splitting the propagator into non-commuting parts. Letting $\hat{U}\,$ denote the operator on the right-hand side of (16), the total simulation error satisfies $E\left( \hat{U}\,,{{e}^{-i\hat{H}\,t}} \right) \equiv \| \hat{U}\,-{{e}^{-i\hat{H}\,t}} \| \leqslant \alpha t\delta t+{{E}_{G}}$, where ${{E}_{G}}$ denotes the gate error in evaluating the kinetic and potential propagators, $\alpha t\delta t$ is the first order Trotter error, and $\alpha =\|\left[ \hat{V}\,,\hat{K}\, \right]\|$ is a problem-specific constant.

As we have seen, the gate error in evaluating a diagonal unitary is equal to the absolute error in the exponent. For the potential energy propagator, approximating V(x) with a function ${{V}_{\epsilon }}\left( x \right)$ satisfying $\;{{\sup }_{x}}\;\left| {{V}_{\epsilon }}\left( x \right)-V\left( x \right) \right|\leqslant\epsilon $, results in an error $E\left( {{e}^{-i{{\hat{V}\,}_{\epsilon }}\delta t}},{{e}^{-i\hat{V}\,\delta t}} \right) \leqslant \epsilon \delta t$. Letting ${{\epsilon }_{V}}$ be the error in V(x) and ${{\epsilon }_{K}}$ be the error in K(p), the total gate error for the algorithm satisfies ${{E}_{G}}\leqslant {{\epsilon }_{V}}t+{{\epsilon }_{K}}t$. The total error in evaluating $\hat{U}\,$ therefore satisfies

Equation (17)

Since the diagonal unitaries can be implemented efficiently, and the QFT requires $\text{poly}\left( n \right)$ gates, the entire algorithm is efficient, and requires $O\left( \text{poly}\left( n \right),1/{{\epsilon }_{V}},1/{{\epsilon }_{K}},t/\delta t \right)$ gates.

The parameters $\delta t$, ${{\epsilon }_{V}}$, and ${{\epsilon }_{K}}$ may be varied to obtain the shortest gate sequence for the simulation given a combined total error tolerance. Here, we only consider the problem of finding the shortest gate sequence for a single Trotter step. This corresponds to finding the shortest Walsh series for the approximate potential and kinetic energies given ${{\epsilon }_{V}}$ and ${{\epsilon }_{K}}$.

4.3. Simulation

The Eckart barrier is defined as $A\;\text{sech}\left( a\;x \right)$ [16], and is plotted in figure 6 for A = 1, a = 0.05. Also shown is a plot of a 19-term Walsh series for this potential that is accurate to 10%. This series was constructed by including a subset of coefficients from the full Walsh–Fourier series starting from the largest, then the next largest, etc until the function was reproduced within the required 10% accuracy. We used a ${{2}^{n}}$-term Walsh–Fourier transform with n = 13 to approximate the infinite series. This introduces a discretization error of about $0.1%$. The 19 largest coefficients included in the approximate Walsh series are those with Paley indices: 1, 2, 4, 7, 8, 11, 13, 14, 16, 19, 21, 22, 25, 32, 35, 37, 38, 64, and 67. The smallest power of 2 that is greater or equal to every index is ${{2}^{7}}=128$, which means that 7 qubits are necessary to represent the series.

Figure 6.

Figure 6. Eckart barrier, $A\;\text{sech}\left( a\;x \right)$, with A = 1, a = 0.05. In blue is the exact function and in green is a 19-term partial Walsh–Fourier series, which is accurate to 10%. The largest Paley index of these terms is 67. Therefore at least seven qubits are needed to implement this approximation.

Standard image High-resolution image

This approach gives the minimal set of Walsh–Fourier coefficients, and is usually very close to the fully optimized solution found when the magnitudes of the coefficients are allowed to vary [14]. We find that only 7 qubits are necessary to represent the potential to 10% accuracy, with the given set of parameters. If $n>7$, only the qubits corresponding to the seven most significant digits in the register will be used. This illustrates the resource savings possible if n is large. Although useful for illustrating the approach, the classical algorithm we described for finding best subset of Walsh–Fourier coefficients to approximate a function is not efficient since it requires first calculating a high-dimensional Walsh–Fourier transform. In fact it is not necessary to do this. For a given k, efficient methods exist for finding the best k-term Walsh–Fourier series approximation to a given function without calculating the entire transform [22].

Had we opted to use a partial Walsh–Fourier series (keeping all ${{2}^{n}}$ coefficients for some integer n) to approximate the Eckart barrier, we would also find that $n7$ is required to obtain better than 10% accuracy. (The discretization error with n = 7 is $7.8%$, and with n = 6 is $15.6%$.) The efficient circuit produced in this way requires a total of ${{2}^{7}}-3=125$ gates, of which ${{2}^{6}}=64$ are rotation gates. (The Eckart barrier is an even function. Therefore half the Walsh coefficients are zero.) In contrast, the truncation described in the previous paragraph gives a circuit with a total of approximately 50 gates, of which 19 are rotation gates. This is more than a factor of two improvement.

We performed numerical simulations of equation (16) for the Eckart barrier with multiple error tolerances on the potential. The wavefunction was initialized to a Gaussian wavepacket traveling towards the barrier. Since there is a known polynomial-time algorithm for the kinetic energy propagator, ${{e}^{i{{\hat{p}\,}^{2}}/2}}$ [23], we evaluated it with maximum resolution. The time-evolution of the wavefunction is shown in figure 7. One can see from these figures that relatively few Walsh functions are needed for an accurate simulation. Even the lowest fidelity simulation reproduces the important features of the quantum scattering problem, including interference fringes. (Although here the fringes are due to periodic boundary conditions and are not physical.)

Figure 7.

Figure 7. Plots of ${{\left| \psi \left( x,t \right) \right|}^{2}}$ for the Eckart barrier simulation with different error tolerances on the potential. Time t is on the horizontal axis, consisting of a total evolution time of 0.6 divided into 1000 time steps (which gives a negligible Trotter error of less than 1% for the simulation parameters given below). The vertical axis contains ${{2}^{n}}$ grid points, with n different for each figure and $-5 \leqslant x<5$. The initial state $\psi \left( x,0 \right)$ is a Gaussian wave packet given by $\psi \left( x,0 \right)\propto \exp \left\{ -{{\left( x-{{x}_{0}} \right)}^{2}}/2{{\sigma }^{2}}+i\left[ {{p}_{0}}\left( x-{{x}_{0}} \right) \right] \right\}$ in units such that $\hbar =m=1$. The parameter values are ${{x}_{0}}=-3$, ${{p}_{0}}=15$, $\sigma =0.5$. The Eckart barrier potential is $V\left( x \right)=A\;\text{sech}\left( a\;x \right)$ with A = 100, a = 0.5. The number of qubits n, errors in the potential and kinetic energies, number of Walsh functions ${{n}_{W}}$, and fidelity of the final state compared to a 10-qubit simulation with maximal resolution (1% discretization error in the potential energy and $0.4%$ in the kinetic energy) are (a) n = 10, ${{\epsilon }_{V}}=1%$, ${{\epsilon }_{K}}=0.4%$, ${{n}_{W}}=512$ ('exact'), F = 1, (b) n = 8, ${{\epsilon }_{V}}=5%$, ${{\epsilon }_{K}}=1.6%$, ${{n}_{W}}=30$, F = 0.9794, (c) n = 7, ${{\epsilon }_{V}}=10%$, ${{\epsilon }_{K}}=3.1%$, ${{n}_{W}}=19$, F = 0.9105, and (d) n = 6, ${{\epsilon }_{V}}=15%$, ${{\epsilon }_{K}}=6.25%$, ${{n}_{W}}=14$, F = 0.6507.

Standard image High-resolution image

For the present example, (17) drastically overestimates the total error, since it is a bound over all wavefunctions. To quantify the error in the simulation for the particular initial states under consideration, we found it more convenient to use the fidelity, defined as $F=\left|\left\langle\psi\left(t\right)|{{\psi }_{0}}\left( t \right)\right\rangle \right|$, where $\left| {{\psi }_{0}}\left( t \right) \right\rangle$ is the exact final wavefunction. The fidelity is related to the simulation error defined previously as $E={{\sup }_{\left| \psi \right\rangle}}\sqrt{2\left( 1-F \right)}$. As a proxy for $\left| {{\psi }_{0}}\left( t \right) \right\rangle$, we used a 10-qubit simulation with maximum possible resolution (including all Walsh operators) and 1000 time steps. By numerically analyzing the scaling of the error with the number of time steps, we found this number of time steps gives a Trotter error of less than 1%.

5. Conclusion

We showed that Walsh functions correspond to a basis for diagonal operators, and used this Walsh operator basis to prove that efficient circuits can be constructed for diagonal unitaries. We also described how the truncated Walsh–Fourier series for a function f(x) leads to an approximately minimal-depth circuit for the diagonal unitary ${{e}^{if\left( \hat{x}\, \right)}}$ given an error tolerance on f. This circuit has a gate count that scales proportionally to the number of Walsh functions in the series for f(x). We applied this approach to the quantum simulation of tunneling through an Eckart barrier, demonstrating that high-fidelity quantum simulations without ancillas can be achieved with few qubits and low depth.

Acknowledgments

We would like to acknowledge Michael Biercuk for his insightful discussions on the Walsh system, Venkat Chandar, for discussing sparse Walsh–Fourier approximation and pointing out Reference [22], Alexandre Cooper-Roy for the insightful technical discussions on the Walsh system and its applications, Michael Burns for his helpful discussions on digital function approximation, and Juan Bermejo Vega, for pointing out that Walsh functions are the characters of $\mathbb{Z}_{2}^{\otimes n}$. We also thank John Chiaverini and Jeremy Sage for helpful comments and suggestions. This work was sponsored by the Assistant Secretary of Defense for Research and Engineering under Air Force Contract number FA8721-05-C-0002, and by NSF CCI under award 1037992-CHE. JW and SM are supported by the Air Force Office of Scientific Research under award number FA9550-12-1-0046. Sponsored by United States Department of Defense. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressly or implied, of the Government.

Footnotes

  • 3  

    In this paper, we use the term circuit depth synonymously with the number of elementary gates. Generally the two terms differ, circuit depth meaning the number of time steps. We do not consider the number of time steps here since it differs from the gate count by at most a factor of two.

Please wait… references are loading.