Skip to main content
Nature Communications logoLink to Nature Communications
. 2024 Jul 13;15:5886. doi: 10.1038/s41467-024-50065-x

Polylogarithmic-depth controlled-NOT gates without ancilla qubits

Baptiste Claudon 1,2,✉, Julien Zylberman 3, César Feniou 1,2, Fabrice Debbasch 3, Alberto Peruzzo 1, Jean-Philip Piquemal 1,2,✉
PMCID: PMC11246449  PMID: 39003276

Abstract

Controlled operations are fundamental building blocks of quantum algorithms. Decomposing n-control-NOT gates (Cn(X)) into arbitrary single-qubit and CNOT gates, is a crucial but non-trivial task. This study introduces Cn(X) circuits outperforming previous methods in the asymptotic and non-asymptotic regimes. Three distinct decompositions are presented: an exact one using one borrowed ancilla with a circuit depth Θ(log(n)3), an approximating one without ancilla qubits with a circuit depth O(log(n)3log(1/ϵ)) and an exact one with an adjustable-depth circuit which decreases with the number m≤n of ancilla qubits available as O(log(n/⌊m/2⌋)3+log(⌊m/2⌋)). The resulting exponential speedup is likely to have a substantial impact on fault-tolerant quantum computing by improving the complexities of countless quantum algorithms with applications ranging from quantum chemistry to physics, finance and quantum machine learning.

Subject terms: Quantum information, Quantum physics


Multi-controlled operations are very common in quantum algorithms applications. Here, the authors propose three schemes for decomposing n-control-NOT gates into single-qubit and CNOT gates, which have polylog overhead as opposed to current linear schemes.

Introduction

In the past three decades, quantum algorithms promising an exponential speedup over their classical counterparts have been designed1–3. The advantages of these algorithms stem from the peculiar properties of superposition and entanglement of the quantum bits (qubits). These properties enable the manipulation of a vast vector of qubit states using basic operations that act on either one or two qubits3. The question of decomposing efficiently any n-qubit operation into a reasonable number of primitive single- and two-qubit operations is one of the major challenges in quantum computing4. In this context, multi-controlled operations act as building blocks of many prevalent quantum algorithms such as qubitisation5 within the quantum singular value transformation6, which have immediate repercussions on Hamiltonian simulation7, quantum search6 and quantum phase estimation methods8. For this reason, achieving more effective decompositions of multi-controlled operations has the potential to bring about significant enhancements in quantum algorithms, impacting various fields such as quantum chemistry, specifically in estimating ground state energy9, physics for the simulation of quantum systems10, engineering for solving partial differential equations11,12, quantum machine learning13, and finance14.

This non-trivial challenge and the quest for optimal solutions have been an active and ongoing research focus for decades. In 1995, Barenco et al.15 proposed several linear depth constructions of multi-controlled NOT (MCX) gates (also known as n-Toffoli gates, multi-controlled Toffoli, generalised-Toffoli gates, multi-controlled X or n-controlled NOT gates). All these linear depth constructions used ancilla qubits or relied on an efficient approximation, while the first ancilla-free exact decomposition has a quadratic depth.

Years later, exact implementations of multi-controlled NOT gates with linear depth and quadratic size were proposed16,17. It was only in 2015 that Craig Gidney published a pedagogical blog post describing an exact linear size decomposition without ancilla qubits18. Even though his method was linear, its depth leading coefficient is large compared to that of other methods. Still, this one-of-a-kind method was used in subsequent work19–21. In 2017, a logarithmic-depth multi-controlled NOT gate using as many zeroed ancilla qubits as control qubits was presented22. Such a finding motivated the search for a trade-off between the number of ancillae and the circuit depth. Computational approaches have been implemented23, suggesting that any zeroed ancilla qubit could be used to reduce the circuit depth of controlled operations. Recently, Orts et al.24 provided a review of the 2022 state-of-the-art methods for MCX.

Every multi-controlled NOT decomposition method aims at optimising certain metrics such as circuit size, circuit depth, or ancilla count. This article considers only the case of n-controlled NOT gates with n > 2 (he particular problem of decomposing the 2-controlled NOT gate, i.e., the Toffoli gate, possesses distinct optimal solutions for various metrics concerning both single- and two-qubit gates25,26). The attention is directed towards circuit depth, the metric associated with quantum algorithmic runtime, circuit size, the total number of primitive quantum gates (computed on the basis of arbitrary single-qubit and CNOT gates), and ancilla qubit count, which corresponds to the amount of available qubits during the computation. A precise distinction is made between borrowed ancilla qubits (qubits in any state beforehand which are restored afterwards) and zeroed ancilla qubits (which are in state 0 initially and reset to 0 at the end of the computation). Zeroed ancilla qubits are efficient to use since they are initially in a well-known state. Borrowed ancilla qubits are more constraining but have the advantage of being available more often during computations: operations that do not impact the entire system can utilise unaffected wires as borrowed qubits.

This article introduces three circuit identities to build a n-controlled NOT gate Cn(X). They display the following depth complexities.

  1. Polylogarithmic-depth circuit with a single borrowed ancilla (Proposition 1).

  2. Polylogarithmic-depth approximate circuit without ancilla (Proposition 2).

  3. Adjustable depth circuit using an arbitrary number m ≤ n of ancillae (Proposition 3).

The first one is an exact decomposition whose depth is affine in the depth of a quadratically smaller controlled operation Cn(X). The global decomposition takes advantage of a single borrowed ancilla qubit, and each of the smaller controlled operations can be associated with a locally borrowed ancilla. As a consequence, a recursive construction of the multi-controlled NOT gate emerges with an overall polylogarithmic circuit depth in the number of control qubits Θ(log(n)3) and a circuit size O(nlog(n)4). The second method approximates a Cn(X) without ancilla qubits up to an error ϵ > 0 with a circuit depth O(log(n)3log(1/ϵ)) and a circuit size O(nlog(n)4log(1/ϵ)). It makes use of the decomposition of a n-controlled X gate into (n − 1)-controlled unitaries, generating borrowed ancilla qubits that facilitate the application of the first method up to an error ϵ. The last method provides an adjustable-depth quantum circuit which implements exactly a Cn(X) for any given number m ≤ n of zeroed ancilla qubits. The depth decreases with m from a polylogarithmic-with-n scaling to a logarithmic one as O(log(n/⌊m/2⌋)3+log(⌊m/2⌋)). To the best of our knowledge, these methods stand out as the only approaches achieving such depth complexities. In particular, they demonstrate an exponential speedup over previous state-of-the-art (or, more formally, a superpolynomial speedup27) and readily improve a wide range of quantum algorithms.

Results

This section is subdivided into three parts. The first subsection details the logical steps towards achieving method 1. This includes a detailed study of the single-zeroed-ancilla case, how it can be turned into a borrowed one and where the recursive decomposition can stem from to yield the polylogarithmic-depth controlled-NOT circuit with a single borrowed ancilla. The methods 2 and 3 are described respectively in IIB and IIC.

Notations

This paragraph gathers the most important definitions that will be used throughout the article. Let n ≥ 1 and let {x}x=02n−1 be the computational basis of an n-qubit register R and T be a one-qubit register, the so-called target register. The Cn(X) controlled by R with target T is the gate defined by equation (1):

Cn(X)=(IR−2n−12n−1)⊗IT+2n−12n−1⊗X, 1

where IR and IT are the identities on register R and T. The symbol X denotes the Pauli matrix X=01+10. More generally, a Cn(U) gate will denote a controlled U gate. If the register R is in state 2n−1, it will be termed as active. When one wants to emphasise the control and target registers, one will note CRT. If R′ is a second qubit register, define the (partial) white control CR¯∪R′T≡(∏q∈RXq)CR∪R′T(∏q∈RXq), where Xq denotes an X gate on white control qubit q. The support of a quantum circuit is the set of qubits on which it does not act like the identity. Ancilla qubits are qubits outside the support of U which may be used during the computation. From now, the function log signifies the logarithm in base 2. All circuit sizes and depths are computed on the basis of arbitrary single-qubit and CNOT gates.

Polylogarithmic-depth gate using one borrowed ancilla

The decomposition uses a single zeroed ancilla to reduce the global MCX gate to five layers, each exhibiting the depth of a quadratically smaller operation. The n-control-qubit register R = {q0, …, qn−1} is first divided into subregisters. Let p=⌊n⌋. The control register R can then be written as the disjoint union R=⋃i=0bRi where subregister R0 = {q0, …, q2p−1} is a subregister of size 2p and subregister Ri is of size at most p, for each i ∈ {1, …, p}. More precisely, let Ri={qj}j=(1+i)p(2+i)p−1 for each i ∈ {1, …, p}. Let b=∣{i∈{1,…,p}:Ri≠∅}∣ be the number of non-empty registers of positive index. Moreover, the first register R0 is further divided into R0*={qi}i=0b−1 containing the first b qubits and R0′=R0\R0*.

The circuit in Fig. 1 illustrates a decomposition of the controlled-NOT operation CRt using a single zeroed ancilla. Note that qubit qi is positioned between registers Ri and Ri+1. The unitary associated with the circuit is given by

U0≡CR0aCCR0a, 2

where

C≡∏i=1bCRiqi−1CR0*¯∪at∏i=1bCRiqi−1. 3

The first operation CR0a sets the zeroed ancilla to 1 if and only if R0 is active. Now, consider the operation C: for CR0*¯∪at to apply an X gate to the target, all the qubits from R0* must be in state 0, and the ancilla a must be in state 1. Now, notice that for each qubit qi∈R0*, qi is in state 0 when applying CR0*¯∪at if and only if it was in the same activation state as Ri+1 right before applying C. Therefore, C is a multi-controlled-X gate conditioned on:

  • the ancilla a being in state 1 and

  • for each index i ∈ {0, …, b − 1}: qi being in the same activation state as Ri+1.

By inspection, in the circuit in Fig. 1, these conditions are fulfilled if and only if the register R of interest is active. Therefore, the target t is flipped under exactly the right hypothesis. The operations following the potential flip of qubit t leave it unchanged and reset both the qubits from R0* and the ancilla to their initial state. The overall operation is the desired CRt gate. A more formal proof is given in Supplementary Note 1.

Fig. 1. n controlled CRt using the zeroed ancilla a, where p=⌊n⌋ and Ri is a register of at most p qubits for each i ∈ {1, …, b}.

Fig. 1

r is the remainder of the euclidean division of R\R0=n−2p by p,r=Rb.

This subsection discusses how the above zeroed ancilla is transformed into a borrowed ancilla. The construction is displayed in the circuit in Fig. 2, which is formally defined by the unitary operation

U≡CCR0aCCR0a=CU0. 4

Notice that U0 and C both leave the control qubits and the ancilla unchanged. As a consequence, one only needs to focus on what happens to the target t. If the ancilla starts in state 0, the last C does not affect t and U overall acts as the desired CRt gate. It is now sufficient to focus on the case where qubit a arrives in state 1 and to repeat the above analysis: U0 flips the target if both R0 is inactive and for each i ∈ {0, …, b − 1}, qubit qi is in the same activation state as Ri+1. Refer to this flip as the first flip. Then, C flips the target if and only if for each i ∈ {0, …, b − 1}, qubit qi is in the same activation state as Ri+1. Refer to this flip as the second flip. Summarising, if R is active only the second flip occurs. If R is inactive, there are two cases: R0 is either inactive or active. If R0 is inactive, both flip 1 and flip 2 occur, resulting in no flip at all. If R0 is active, the second condition cannot be verified. Therefore, none of the two flips occurs. In any case, the circuit applies the CRt gate and leaves the ancilla unaffected. A more thorough proof is given in Supplementary Note 1.

Fig. 2. n controlled CRt using the borrowed ancilla a, where p=⌊n⌋ and Ri is a register of at most p qubits for each i ∈ {1, …, b}.

Fig. 2

r is the remainder of the euclidean division of R\R0=n−2p by p,r=Rb.

It is now possible to use a borrowed ancilla to implement any Cn(X) using smaller C2p(X), Cp+1 and Cp(X) gates. This section details how a qubit can be borrowed to compute each of the smaller MCX operations. This allows the setting up of a recursive construction, keeping the number of ancillae to one and achieving the polylogarithmic depth decomposition of n-MCX.

In Fig. 2, the block ∏i=1bCRiqi−1 has the same depth as a single controlled-NOT gate with p control qubits since it is the product of b unitaries with disjoint support. The depth of a controlled operation containing white controls is the same as that of standard controlled-NOT plus that of two additional layers of X gates acting on qubits whose control colour is white. One may want to apply the decomposition from the circuit in Fig. 2 to each Cp(X) gate. In order to do so, each block must have a borrowed ancilla qubit at its disposal.

There are more available borrowed qubits in the register R0′ than operations to perform in parallel: R0′≥R0* (see Supplementary Note 1). Hence, there are sufficiently many borrowed ancilla qubits to construct the smaller operations recursively. The recursion gives the following equality for the depth Dn of a Cn(X) gate.

Dn=2D2p+4Dp+2Db+1+4, 5

with p=⌊n⌋ and p − 2≤b≤p. The asymptotic behaviour of the depth can be studied as follow: let (D(k))k∈N≡(D2k+2)k∈N be the circuit depth of C2k+2(X) gates. Equation (5) implies:

D(k)≤8D(k/2)+4. 6

The Master Theorem, recalled in Supplementary Note 2, implies that D(k)∈O(k3). In terms of n, the circuit depth of a Cn(X) gate using one borrowed ancilla qubit is Dn∈O(log(n)3). Now, a lower bound is derived by defining (D~(k))k∈N≡(D2k)k∈N such that D~(k)≥8D~(k/2)+4. Similarly, this inequality leads to Dn∈Ω(log(n)3). The scaling of the size is computed similarly to the scaling of the depth, i.e., by solving the corresponding recursive equation. Details are given in Supplementary Note 3. The following proposition gathers these statements.

Proposition 1

A controlled-NOT gate with n control qubits is implementable with a circuit of depth Θ(log(n)3), size O(nlog(n)4) and using a single borrowed ancilla qubit through the recursive use of the circuit in Fig. 2.

A first application improved by Proposition 1 affects the decomposition of multi-controlled unitary Cn(U) using one zeroed ancilla. The zeroed ancilla allows the decomposed Cn(U) gate into two Cn(X) gates and one C1(U) using the circuit identity in Fig. 3 (Lemma 7.11 from15).

Fig. 3. Controlling arbitrary unitary operation with a zeroed ancilla qubit.

Fig. 3

U is the unitary to control, V is a square root of U and n is the number of control qubits.

The following corollary gives the complexity to implement a Cn(U) gate.

Corollary 1

Let U be a unitary of size S in the basis of single-qubit gates and CNOT gates. A controlled U gate with n control qubits is implementable with depth O(S+log(n)3), size O(S+nlog(n)4) and one zeroed ancilla qubit through the circuit in Fig. 3.

It is also straightforward to implement any special unitary single-qubit gate W∈SU(2) with polylogarithmic complexity and without ancilla. This can be done with the help of Lemma 7.9 in ref. 15, illustrated in Fig. 4.

Fig. 4. Controlling arbitrary special unitary operation W.

Fig. 4

Without loss of generality, W = AXBXC for some matrices A,B,C∈SU(2) such that ABC = I.

Corollary 2

Let W be a special unitary single-qubit gate. A Cn(W) operation can be implemented with a circuit of depth O(log(n)3) and size O(nlog(n)4) without ancilla qubits.

Polylogarithmic-depth and ancilla-free approximate gate

This section outlines how to make use of Proposition 1 to control single-qubit unitaries in the absence of ancilla qubits. The first step generates borrowed ancilla qubits by decomposing a n-controlled unitary into (n − 1)-controlled unitaries. More precisely, for any single-qubit unitary U whose square root is denoted by V, one can implement a Cn(U) gate from two Cn−1(X), a Cn−1(V) and two simple two-qubit gates using the circuit identity in Fig. 5 (Lemma 7.8 in ref. 15).

Fig. 5. Decomposition of a controlled unitary operation into controlled operations with fewer control qubits.

Fig. 5

U is the unitary to control, n is the number of control qubits and k is the number of qubits on which the gate U acts.

Applying this decomposition k times involves implementing the 2k-th root Vk of the original unitary. Performing this recursion n times leads to a linear depth quantum circuit18. To circumvent this issue, it is possible to neglect the (n − k)-controlled Vk gate, introducing an error exponentially small with k (Lemma 7.8 in ref. 15):

Cn−k(Vk)−Cn−k(I)≤π/2k. 7

Applying the recursion k=⌈log(π/ϵ)⌉ times gives an ϵ > 0 error on the implementation of the Cn(U) gates. This decomposition leads to 2k one-controlled-root of U and 2k multi-controlled NOT gates. Each MCX gate is controlled by a number j ∈ {1, …, n − 1} of qubits and, therefore, is implementable using one of the non-affected qubits as a borrowed ancilla through the first method 1 with a polylogarithmic depth. The following proposition summarises the complexity of the method.

Proposition 2

For any single-qubit unitary U∈U(2), a controlled-U gate with n control qubits is implementable up to an error ϵ > 0 (in spectral norm) with a circuit of depth O(log(n)3log(1/ϵ)), size O(nlog(n)4log(1/ϵ)) without ancilla qubits.

The size and depth of the quantum circuits are trivially bounded noticing that the computational cost of kj-MCX, j ≤n − 1, is bounded by the computational cost of kn-multi-controlled NOT gates.

This approximation proves highly effective for practical applications, as it is not needed to implement gates with exponentially small phases. The error ϵ > 0 can be selected to align with the intrinsic hardware error, providing a level of flexibility that exact methods approaches may not offer.

Adjustable-depth method

This subsection explains how to implement a Cn(X) gate given 2 ≤ m ≤ n zeroed ancilla qubits. For simplicity, consider an even number of ancillae m and a number of control qubits n divisible by m/2. The method has three steps: a first one where m/2 controlled-NOT gates, each controlled by n/(m/2) qubits, are performed in parallel in order to store the activation of the subregisters into m/2 ancillae. A second step where a Cm/2(X) controlled by the first m/2 ancillae is implemented on the target qubit using the last m/2 zeroed ancillae. A last one to restore the ancilla qubits in state 0. The first step makes use of Proposition 1 to implement each Cn/(m/2)(X) with depth Θ(log(n/(m/2))3) using one zeroed ancilla of the last m/2 ancillae. The second step uses the logarithmic method from22 to implement the Cm/2(X) with depth O(log(m/2)) using m/2 ancillae. The circuit in Fig. 6 represents the three steps of the adjustable-depth method.

Fig. 6. Decomposition of a controlled-NOT gate into controlled operations with fewer control qubits using zeroed ancilla qubits.

Fig. 6

R is the control register of size n, Ri are subregisters of R. Ai are registers of zeroed ancilla qubits containing the qubits ai, i∈{0,,m−1}. t denotes the target qubit.

More generally, one can consider any value of n control qubits and m ancilla qubits such that 2 ≤ m ≤ n qubits. Let A = {a0, …, am−1} be the register of zeroed ancilla qubits, A0 = {a0, …, a⌊m/2⌋−1} and A1 = {a⌊m/2⌋, …, am−1} such that A = A0 ∪ A1 and let the control register R be divided into ⌊m/2⌋ balanced subregisters (Ri)i=0⌊m/2⌋−1. Let Π be the operation associated to the first step:

Π≡∏i=0⌊m/2⌋−1CRiai. 8

Each of the CRiai is implemented in parallel of the others using the circuit in Fig. 1 with one zeroed ancilla of register A1. Since all the CRiai’s are performed in parallel, the operation Π has the same depth as the maximum depth of the CRiai’s. After applying Π, one can implement CA0t using the method from22, which uses as many ancillae as control qubits to achieve a logarithmic depth. Therefore, one can implement CA0t with depth 16⌈log(⌊m/2⌋)⌉+12 using A1 as a register of zeroed ancilla qubits (Corollary 2 in22). Finally, one can repeat Π to fully reset the register A. Proposition 3 summarises the complexity of this new method.

Proposition 3

Let n ≥ 2 be the number of control qubits and 2 ≤ m ≤ n be the number of available zeroed ancillae. Then, there exists a decomposition of the Cn(X) into single-qubit gates and CNOT gates with depth complexity:

Olog(n/⌊m/2⌋)3+log(⌊m/2⌋). 9

Note that the depth decreases as the number of ancillae m increases, providing a method with adjustable depth. This is a valuable asset for aligning with the constraints of the hardware resources. Also, remark that the method from22 has been used only for the second part of the algorithm. Using it in the first part would require a number of ancilla qubits proportional to the number of blocks, thus be potentially large. Different combinations of methods did not seem to lead to particular improvements in terms of depth or size. Overall, this decomposition provides a range of logarithmic-depth methods using less than n ancillae, by considering m(n) = αn, with 0 < α < 1, improving the decomposition proposed in22.

Discussion

In non-asymptotic regimes, pre-factors play a crucial role. This section employs graphical comparisons and complexity tables to fairly evaluate the overall effectiveness of current MCX decomposition methods. The circuits are compiled on the basis of single-qubit and CNOT gates for the number of control qubits ranging from 102 to 107. The obtained depths are numerically fitted, giving useful estimates for each method. Since this section only aims to serve as a resource estimator, the linear depth decompositions are fitted with a first-order polynomial in the variable n and the depth of the decomposition from Proposition 1 is fitted with a first-order polynomial in the variable log(n)3.

In the case where only one zeroed borrowed ancilla qubit is available, a comparison is made with the one ancilla method from15 as well as Craig Gidney’s ancilla-free method, and illustrated in Fig. 7a. In practice, the recurrence from Proposition 1 must be initialised. For a number of control qubits n less than 30, the Cn(X) gate is implemented using Barenco et al.’s single-borrowed-ancilla method (the small gates can also be optimised via a brute-force approach). From there, the circuits and depths can be computed with a simple dynamic programming approach. This implementation provides a shallower circuit for any number of control qubits. In that case, the asymptotic advantage of Proposition 1 becomes evident early in the process, making the method applicable across various regimes.

Fig. 7. Numerical analysis of circuit depths.

Fig. 7

a Comparison of circuit depths for methods involving a single or no ancilla. b C100(X) depth as a function of the number of zeroed ancillae. c C105(X) depth as a function of the number of zeroed ancillae.

Next, in the absence of an ancilla qubit but allowing an approximation error ϵ > 0, a comparison is conducted against the state-of-the-art method outlined by Silva et al.28, as depicted in Fig. 7a. Proposition 2 yields a shallower circuit than the method28 as soon as n ≳ 105.

Finally, with a fixed number of control qubits set at n = 100, Fig. 7b illustrates the depth as a function of the number of ancillae. For a single ancilla, the use of the circuit in Fig. 1 already surpasses the state-of-the-art, and an increase in the number of zeroed ancillae rapidly reduces the overall circuit depth. Proposition 3 achieves the same depth as the previous best method but with a significantly lower number of ancillae, getting even larger as the number n of control qubits increases as depicted in Fig. 7b, c.

Table 1 compares the depth of various methods without employing any ancilla by fitting numerically the data from the implementations. Craig Gidney’s method stands out as the only exact method but results in a notably higher overall depth. The linear decomposition from28 achieves a leading coefficient of 48 at an approximation error of ϵ = 10−7, representing a significant improvement. Lastly, the implementation of Proposition 2 delivers a depth of ⌈log(π/ϵ)⌉(43log(n)3−1287) and emerges as the most efficient method for n ≳ 105 control qubits.

Table 1.

Circuit depth of ancilla-free methods

Method Circuit depth
Gidney18 494n − 1413
Silva (ϵ)28 64n + 1645 if (ϵ = 10−7)
Proposition 2 (ϵ) ⌈log(π/ϵ)⌉(86log(n)3−2564)

The depths are numerically fitted in the range from 102 to 107 control qubits.

In Table 2, various methods are compared when using a borrowed ancilla qubit. It is worth noting that employing such methods allows putting to use any qubit unaffected by the controlled operation for implementation, a situation frequently encountered in practice without the need for extra qubits. Notably, Proposition 1 is competitive across all control qubit numbers. The advantage becomes evident with over 102 control qubits, resulting in a significant decrease in circuit depth. From this table, it is also straightforward to compare the depth of controlled-SU(2) gates. Reference29 improved the base construction presented in ref. 15 to yield a depth of leading-order term 55n. Recently30, improved this result with a depth of 32n. Naively, the construction from Corollary 2 has a a leading order depth of two times the depth of a Cn−1(X) with borrowed ancilla qubit: 86log(n)3. By implementing the first Cn−1(X) with the decomposition shown in Fig. 2 (CCR0aCCR0a) and the second with its conjugate (CR0aCCR0aC), this depth can be reduced by 2×43log(n1/2)3 bringing a leading order of 76log(n)3.

Table 2.

Circuit depth of borrowed ancillae methods

Method Circuit depth Borrowed
Barenco 115 48n − 148 1
Barenco n − 215 24n − 43 n − 2
Proposition 1 43log(n)3−1287 1

The depths are numerically fitted in the range from 102 to 107 control qubits.

Finally, Table 3 compares the methods using additional zeroed ancilla qubits. For a given number of available zeroed ancillae, Proposition 3 achieves shallower circuits. When the number of ancilla qubits matches the number of control qubits, the method proves as effective as the previously shallowest method by He et al.22. However, note that similar performances can be reached with significantly less zeroed ancillae (see Fig. 7b and c).

Table 3.

Circuit depth of zeroed ancillae methods

Method Circuit depth Zeroed
Barenco 115 36n − 111 1
Barenco n − 215 12n − 12 n − 2
Proposition 1 27log(n)3−808 1
Proposition 3 27log(n/⌈m/2⌉)3+ 2 ≤ m ≤ n
16⌈log(⌊m/2⌋)⌉−808
He22 16⌈log(n)⌉+12 n

The depths are numerically fitted in the range from 102 to 107 control qubits.

This paragraph provides an overview of some standard quantum algorithm oracles where multi-controlled operations act as both building blocks and complexity drivers and where the improved decomposition reported in this paper readily provides the corresponding speedup. Quantum search31, quantum phase estimation8, and Hamiltonian simulation10 provide robust support for the claimed exponential quantum advantage. These algorithms can be seen as particular instances of the quantum singular value transformation (QSVT)6, which allows the embedding of any Hamiltonian H into an invariant subspace of the signal unitary, thereby enabling to compute a broad range of polynomials of H. The qubitisation5 is the central technique to the framework of QSVT. When qubitising the Hamiltonian expressed as a linear combination H=∑k=1sαkUk, with each Uk decomposable into a maximum of C native gates, the process exhibits optimal query complexity for the two following oracles. The PREPARE oracle consists of a quantum state preparation step. Formally, it involves preparing the state PREPARE from a set of coefficients {αk}k=1s such as :

PREPARE0⊗logs=∑k=1sαkλk,λ=∑k=1sαk 10

The CVO-QRAM algorithm32 performs an efficient task by proceeding s layers of n-controlled operations, where n represents the number of control qubits and s represents the number of non-zero amplitude in the target state. The resulting circuit exhibits a depth of O(sn) assuming the usual linear decomposition of multi-controlled operations. The Cn(X) gate decompositions provided in this paper readily improve the scaling to O(slog(n)3). The PREPARE operator finds application in a broader context beyond qubitisation, whenever there is a need to transfer classical data into the qubit register. The SELECT oracle consists of a block-diagonal operator and acts as follows :

SELECT≡∑k=1skk⊗Uk 11

It can be efficiently decomposed as s layers of log(s)-controlled-Uk operations, yielding a depth in Oslog(s)C with usual linear-depth decomposition of Clog(s)(U) gates. The decompositions presented in this paper readily reduce the SELECT operation complexity to O(slog(log(s))3C).

Considering an example application in ground-state quantum chemistry, the quantum phase estimation (QPE) stands as the standard fault-tolerant algorithm. The QPE performs a projection on an eigenstate of the Hamiltonian and provides an estimate of the associated eigenenergy. The overall complexity is determined by the preparation of an accurate initial state, and the implementation of the phase estimation circuit. A possible strategy involves using CVO-QRAM to initialise the quantum register to an accurate approximation of the ground state obtained with classical computational chemistry simulations33. Then, the phase estimation algorithm calls multiple times a controlled unitary U. The unitary U should be encoded so that its spectrum is related to the spectrum of the molecular Hamiltonian H. The qubitisation outlined above has become a standard for this task, for example, by implementing the quantum walk operator U=eiarccosH6. The polylogarithmic-depth Cn(X) operations presented in this paper directly reduce the depth of two building blocks in QPE, leading to corresponding improvements in the algorithm. The expected costs associated with achieving a quantum advantage in chemistry with QPE34–38 require a reconsideration incorporating the previous enhancements.

In summary, this paper introduced three methods for decomposing Cn(X) gates into arbitrary single-qubit and CNOT gates. Proposition 1 takes advantage of a single borrowed ancilla qubit to implement a Cn(X) gate with depth complexity Θ(log(n)3). Such polylogarithmic complexity significantly improves the present state-of-the-art which is set at a depth of Θ(n). Proposition 2 aims at the more general task of controlling arbitrary single-qubit unitaries. Introducing an approximation error ϵ > 0 and making use of the previous proposition, the task can be achieved with depth O(log(1/ϵ)log(n)3). With polylogarithmic dependence on both relevant parameters, this approach emerges as the most efficient in its category. When zeroed ancillae are available, Proposition 3 provides a strategy for enhancing the efficiency of a Cn(X) gate by optimising the utilisation of these ancillae. A glimpse into the potential applications of these enhanced Cn(X) implementations within the QSVT framework is presented.

While Propositions 1 and 2 offer a superpolynomial speedup in terms of depth, the size is increased by a polylogarithmic factor. The size of the circuit, especially the count of non-Clifford gates (T gates, Toffoli,...), can dominate the total execution time due to the necessity of preparing magic states through distillation39. This process is highly resource-intensive in terms of both runtime and ancilla count, and it does not always allow for efficient parallel execution. Therefore, the larger size resulting from the proposed decompositions could be seen as a drawback compared to methods that scale linearly in size. The key aim of these decompositions is to pioneer a novel approach to circuit design that prioritises minimising depth.

It is also important to note that, for a large number n of qubits (n ≥ 105), it is likely that an error lower than 2−n is experimentally hard to achieve on the parameters of the quantum gates, even in the context of fault-tolerant quantum computing with error correction. Therefore, depending on the wavefunctions that are manipulated in the QPU, it might be preferable to skip a large controlled operation (with more than 105 controls). Examples, where gates with exponentially small phases are omitted can be seen in the Approximate Quantum Fourier Transform40 or with Proposition 2. Conversely, removing a multi-controlled NOT gate could significantly impact the algorithm’s outcome in the case of sparse quantum state preparation for example33.

Further research could explore the potential benefits these enhanced multi-controlled NOT decompositions offer across various quantum algorithms. It could also aim to determine whether the new circuit design behind these decompositions can lead to other improved Oracle implementation strategies.

Supplementary information

Supplementary Information (267.7KB, pdf)
Peer Review File (848.4KB, pdf)

Author contributions

B.C., C.F., and J.Z. conceived and designed the experiments. B.C., C.F., and J.Z. performed the experiments. B.C., C.F., J.Z., F.D., A.P., and J.P.P. analyzed the data. B.C., C.F., and J.Z. contributed materials/analysis tools. B.C., C.F., J.Z., A.P., and J.P.P. wrote the paper. F.D., A.P., and J.P.P. supervised the work.

Peer review

Peer review information

Nature Communications thanks Craig Gidney and the other anonymous, reviewer(s) for their contribution to the peer review of this work. A peer review file is available.

Data availability

The data generated in this study have been deposited in the database under accession code41.

Code availability

The code generated in this study has been deposited in the following repository41.

Competing interests

JPP is a shareholder and co-founder of Qubit Pharmaceuticals. The remaining authors declare no other competing interests.

Footnotes

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Contributor Information

Baptiste Claudon, Email: baptiste.claudon@qubit-pharmaceuticals.com.

Jean-Philip Piquemal, Email: jean-philip.piquemal@sorbonne-universite.fr.

Supplementary information

The online version contains supplementary material available at 10.1038/s41467-024-50065-x.

References

  • 1.Shor PW. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput. 1997;26:1484–1509. doi: 10.1137/S0097539795293172. [DOI] [Google Scholar]
  • 2.Childs, A. M. et al. Exponential algorithmic speedup by a quantum walk. In Proceedings of the Thirty-Fifth Annual ACM Symposium on Theory of Computing, STOC03 (ACM, 2003).
  • 3.Nielsen, M. A. and Chuang, I. L. Quantum Computation and Quantum Information: 10th Anniversary Edition (Cambridge University Press, 2011).
  • 4.Maronese, M., Moro, L., Rocutto, L., and Prati, E. Quantum compiling, In Quantum Computing Environments, edited by Iyengar, S. S., Mastriani, M., and Kumar, K. L. (Springer International Publishing, Cham, 2022).
  • 5.Low GH, Chuang IL. Hamiltonian simulation by qubitization. Quantum. 2019;3:163. doi: 10.22331/q-2019-07-12-163. [DOI] [Google Scholar]
  • 6.Martyn JM, Rossi ZM, Tan AK, Chuang IL. Grand unification of quantum algorithms. PRX Quantum. 2021;2:040203. doi: 10.1103/PRXQuantum.2.040203. [DOI] [Google Scholar]
  • 7.Haah J, Hastings MB, Kothari R, Low GH. Quantum algorithm for simulating real time evolution of lattice hamiltonians. SIAM J. Comput. 2021;52:FOCS18. [Google Scholar]
  • 8.Kitaev, A. Y. Quantum Measurements and the Abelian Stabilizer Problem. Electronic Colloquium on Computational Complexity - Reports Series 1996 ECCC TR96-003 (ECCC, 1995).
  • 9.Bauer B, Bravyi S, Motta M, Chan GK-L. Quantum algorithms for quantum chemistry and quantum materials science. Chem. Rev. 2020;120:12685. doi: 10.1021/acs.chemrev.9b00829. [DOI] [PubMed] [Google Scholar]
  • 10.Georgescu I, Ashhab S, Nori F. Quantum simulation. Rev. Mod. Phys. 2014;86:153–185. doi: 10.1103/RevModPhys.86.153. [DOI] [Google Scholar]
  • 11.Harrow AW, Hassidim A, Lloyd S. Quantum algorithm for linear systems of equations. Phys. Rev. lett. 2009;103:150502. doi: 10.1103/PhysRevLett.103.150502. [DOI] [PubMed] [Google Scholar]
  • 12.Childs AM, Liu J-P, Ostrander A. High-precision quantum algorithms for partial differential equations. Quantum. 2021;5:574. doi: 10.22331/q-2021-11-10-574. [DOI] [Google Scholar]
  • 13.Peral-García D, Cruz-Benito J, García-Peñalvo FJ. Systematic literature review: Quantum machine learning and its applications. Comput. Sci. Rev. 2024;51:100619. doi: 10.1016/j.cosrev.2024.100619. [DOI] [Google Scholar]
  • 14.Herman D, et al. Quantum computing for finance. Nat. Rev. Phys. 2023;5:450. doi: 10.1038/s42254-023-00603-1. [DOI] [Google Scholar]
  • 15.Barenco A, et al. Elementary gates for quantum computation. Phys. Rev. A. 1995;52:3457–3467. doi: 10.1103/PhysRevA.52.3457. [DOI] [PubMed] [Google Scholar]
  • 16.Saeedi M, Pedram M. Linear-depth quantum circuits for n-qubit Toffoli gates with no ancilla. Phys. Rev. A. 2013;87:062318. doi: 10.1103/PhysRevA.87.062318. [DOI] [Google Scholar]
  • 17.da Silva AJ, Park DK. Linear-depth quantum circuits for multiqubit controlled gates. Physi. Rev. A. 2022;106:042602. doi: 10.1103/PhysRevA.106.042602. [DOI] [Google Scholar]
  • 18.Gidney, C. https://algassert.com/circuits/2015/06/05/Constructing-Large-Controlled-Nots.htmlAlgorithmic Assertions (visited on 2023-12-14)
  • 19.Sun X, Tian G, Yang S, Yuan P, Zhang S. Asymptotically optimal circuit depth for quantum state preparation and general unitary synthesis. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2023;42:3301. doi: 10.1109/TCAD.2023.3244885. [DOI] [Google Scholar]
  • 20.Bärtschi, A. and Eidenbenz, S. Deterministic preparation of dicke states, in Lecture Notes in Computer Science (Springer International Publishing, 2019).
  • 21.Yuan P, Allcock J, Zhang S. Does qubit connectivity impact quantum circuit complexity? IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2024;43:520. doi: 10.1109/TCAD.2023.3311734. [DOI] [Google Scholar]
  • 22.He Y, Luo M-X, Zhang E, Wang H-K, Wang X-F. Decompositions of n-qubit Toffoli gates with linear circuit complexity. Int. J. Theor. Phys. 2017;56:2350. doi: 10.1007/s10773-017-3389-4. [DOI] [Google Scholar]
  • 23.Baker, J. M., Duckering, C., Hoover, A., and Chong, F. T., Decomposing quantum generalized Toffoli with an arbitrary number of ancilla. Preprint at 10.48550/arXiv.1904.01671 (2019).
  • 24.Orts, F., Ortega, G., and Garzón, E. M. Studying the cost of n-qubit Toffoli gates, in Computational Science – ICCS 2022, edited by Groen, D., de Mulatier, C., Paszynski, M., Krzhizhanovskaya, V. V., Dongarra, J. J., and Sloot, P. M. A. (Springer International Publishing, Cham, 2022).
  • 25.Shende VV, Markov IL. On the cnot-cost of Toffoli gates. Quantum Info. Comput. 2009;9:461–486. [Google Scholar]
  • 26.Amy M, Maslov D, Mosca M, Roetteler M. A meet-in-the-middle algorithm for fast synthesis of depth-optimal quantum circuits. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2013;32:818. doi: 10.1109/TCAD.2013.2244643. [DOI] [Google Scholar]
  • 27.Bravyi, S., Dial, O., Gambetta, J. M., Gil, D., & Nazario, Z. The future of quantum computing with superconducting qubits. J. Appl. Phys.132, 160902 (2022).
  • 28.Silva, J. D. S., Azevedo, T. M. D., Araujo, I. F., & da Silva, A. J., Linear decomposition of approximate multi-controlled single qubit gates. Preprint at 10.48550/arXiv.2310.14974 (2023).
  • 29.Iten R, Colbeck R, Kukuljan I, Home J, Christandl M. Quantum circuits for isometries. Phys. Rev. A. 2016;93:032318. doi: 10.1103/PhysRevA.93.032318. [DOI] [Google Scholar]
  • 30.Vale R, Azevedo TMD, Araújo ICS, Araujo IF, Silva AJD. Circuit decomposition of multicontrolled special unitary single-qubit gates. IEEE Trans. Comput. Aided Design Integr. Circuits Syst. 2024;43:802. doi: 10.1109/TCAD.2023.3327102. [DOI] [Google Scholar]
  • 31.Ambainis A. Quantum search algorithms. ACM SIGACT News. 2004;35:22. doi: 10.1145/992287.992296. [DOI] [Google Scholar]
  • 32.de Veras TML, da Silva LD, da Silva AJ. Double sparse quantum state preparation. Quantum Inf. Process. 2022;21:204. doi: 10.1007/s11128-022-03549-y. [DOI] [Google Scholar]
  • 33.Feniou C, et al. Sparse quantum state preparation for strongly correlated systems. J. Phys. Chem. Lett. 2024;15:3197. doi: 10.1021/acs.jpclett.3c03159. [DOI] [PubMed] [Google Scholar]
  • 34.Lee S, et al. Evaluating the evidence for exponential quantum advantage in ground-state quantum chemistry. Nat. Commun. 2023;14:1952. doi: 10.1038/s41467-023-37587-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Goings JJ, et al. Reliably assessing the electronic structure of cytochrome p450 on today’s classical computers and tomorrow’s quantum computers. Proc. Natl. Acad. Sci. USA. 2022;119:e2203533119. doi: 10.1073/pnas.2203533119. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Berry DW, Gidney C, Motta M, McClean JR, Babbush R. Qubitization of arbitrary basis quantum chemistry leveraging sparsity and low rank factorization. Quantum. 2019;3:208. doi: 10.22331/q-2019-12-02-208. [DOI] [Google Scholar]
  • 37.Lee J, et al. Even more efficient quantum computations of chemistry through tensor hypercontraction. PRX Quantum. 2021;2:030305. doi: 10.1103/PRXQuantum.2.030305. [DOI] [Google Scholar]
  • 38.Dalzell, A. M. et al. Quantum algorithms: A survey of applications and end-to-end complexities. Preprint at10.48550/arXiv.2310.03011 (2023).
  • 39.Campbell ET, Terhal BM, Vuillot C. Roads towards fault-tolerant universal quantum computation. Nature. 2017;549:172–179. doi: 10.1038/nature23460. [DOI] [PubMed] [Google Scholar]
  • 40.Nam Y, Su Y, Maslov D. Approximate quantum fourier transform with o(n log(n)) T gates. NPJ Quantum Info. 2020;6:26. doi: 10.1038/s41534-020-0257-5. [DOI] [Google Scholar]
  • 41.Claudon, B. BaptisteClaudon/Polylog_MCXpublic:Polylog_MCX-public. 10.5281/zenodo.11486580 (2024).

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplementary Information (267.7KB, pdf)
Peer Review File (848.4KB, pdf)

Data Availability Statement

The data generated in this study have been deposited in the database under accession code41.

The code generated in this study has been deposited in the following repository41.


Articles from Nature Communications are provided here courtesy of Nature Publishing Group

RESOURCES