## Multi-controlled single-qubit unitary gates based on the quantum Fourier transform and deep decomposition

Vladimir V. Arsoski 1*

1* The Department of Microelectronics and Technical Physics, School of Electrical Engineering - University of Belgrade, Bulevar kralja Aleksandra 73, Belgrade, P.O. Box 35-54, Serbia.

Corresponding author(s). E-mail(s): vladimir.arsoski@etf.bg.ac.rs;

## Abstract

We will present a few new generalizations of the multi-controlled X (MCX) gate that uses the quantum Fourier transform (QFT). Firstly, we will optimize QFTMCX and prove that it is equivalent to a stair MCX gates array. This stair-wise structure will allow us to devise a method for adding an arbitrary phase factor to each qubit. The first MCX generalization into multi-controlled unitary gates (MCU) relies on replacing phase gates acting on the target qubit with controlled unitary gates. We will employ alternative single-qubit gate notation to minimize the complexities of these gates and show how to expand the circuit straightforwardly to the multi-controlled multi-target (MCMT) gate. The second generalization relies on the ZYZ-like decomposition. We will show that by extending one QFT-MCX circuit we implement the two multi-controlled X gates needed for the decomposition. Finally, we will split control wirelines into groups and use iterative ZYZ-like decomposition on QFT-MCU to obtain 'deep decomposed' (DD) MCU which employs a lower number of C-NOTs than the previous two, thus making DD-MCU less prone to decoherence and noise. The supremacy of our implementations over the best-known optimized algorithm will be demonstrated by emulating noisy quantum calculations.

Keywords: Quantum computing, Quantum algorithms, Multi-controlled gates, Multi-target gates, Quantum Fourier transform, Optimization

MSC Classification: 03G12 , 81P68

## 1 Introduction

Current quantum devices are constrained by the number of qubits available and the noise introduced during the execution of nonideal quantum operations employing the native gates used for computation in a genuine quantum device. The hardware of these Noisy Intermediate-Scale Quantum devices (NISQ) [1] is constantly improving by increasing the number of qubits and fidelity of the native gates used in a particular quantum computing architecture. However, the efficiency in performing quantum computation can be improved by optimizing software that defines a quantum circuit implementation. It can be achieved by more efficient error mitigation [2], quantum state preparation [3-5], and decomposition of unitary gates into scalable quantum circuits in the basis set of elementary gates [6-9]. The decomposition of a circuit is usually not unique. Therefore, different optimization techniques can be used to minimize the circuit's depth and (or) the number of elementary gates used [10-12].

The first algorithm for decomposing multi-controlled U (2) gates, which doesn't use auxiliary qubits, was proposed in Ref. [6]. It exhibits a quadratic increase in the circuit depth and number of elementary gates with the number of control qubits. The authors showed that implemented circuits can be efficiently reduced by removing some gates at the price of phase relativization, using ancilla qubits, and approximating gates up to the target error /epsilon1 . The advantages of using relative-phase Toffoli gates to obtain linear depths of n -qubit MCX gates were first recognized in Ref. [13]. The effectiveness of this approach is demonstrated theoretically [14] and experimentally [15]. To correct phases, an additional ( C -R x )-based circuit is introduced in Ref. [16] that approximately doubles the complexity of the previously simplified circuit. Different approximations are used to reduce the number of elementary gates in this circuit [17, 18]. As for all other cases, using auxiliary qubits lowers the circuit depth [19-21].

After this brief introduction, we will preview the previously implemented QFTbased MCX circuits and various methods for their optimization in sections 2. We will introduce equivalent circuits to simplify MCX and prove that QFT-MCX building blocks are equivalent to a stair-wise cascade of MCX gates in section 3. Furthermore, using deductive analysis of phase correction in the QFT-MCX, we will devise a method to add different phase factors to each qubit, thus making our circuit usable for other more complex applications. The detailed analysis of three QFT-based MCU implementations is presented in section 4. The first implementation is obtained by modifying QFT-MCX's controlled gates acting on the target qubit. We introduce a general single-qubit rotation to minimize the most complex gates and show how to generalize our circuit to the multi-target gate. The second implementation uses the ZYZ-like decomposition, but only one modified QFT-MCX to implement two MCX operations needed in the decomposition, which makes it twofold simpler than the standard one. Our implementations utilize the devized phase correction method to control the desired phase factor applied to the target qubit. Finally, the third implementation employs dividing control qubits into clusters and recursive ZYZ-like decomposition to minimize the number of C-NOT gates used in MCU making it less susceptible to noise. In section 5, a significant advantage over the state-of-the-art implementation is demonstrated by transpiling circuits and emulating noisy quantum computations. The

most important conclusions are summarized in the section 6. We prove the equivalence of the state-of-the-art circuit with our QFT-MCU in Appendix A.

## 2 Related work

Our approach is based on the QFT and inspired by basic quantum arithmetic [22]. One may show that simple QFT-based increment/decrement by one can be used to implement multi-controlled X gates. The equivalence between the QFT-based MCX and the standard one is rigorously proved theoretically in Ref. [21]. However, a fairly simple explanation can give an insight into the principles of the proposed implementation.

Multi-controlled gate, shown in Fig. 1(a), executes X operation on the highest n th qubit based on the state of ( n -1) lower qubits. A pure n -qubit state | a 〉 = | a n a n -1 · · · a a 2 1 〉 is represented by a 2 n dimensional state vector in Hilbert space. The set of orthonormal basis states {| 000 · · · 000 〉 , | 000 · · · 001 〉 , · · · , | 111 · · · 110 〉 , | 111 · · · 111 〉} = {| 0 〉 , | 1 〉 , · · · , | 2 n -2 〉 , | 2 n - 〉} 1 span this linear vector space. Each term in the state vector C | k 〉 (where k ∈ { 0 2 , n - } 1 ) is the probability amplitude (weight) of the corresponding basis state. An application of MCX on a n -qubit system results in the swap between C | 011 ··· 111 〉 and C | 111 ··· 111 〉 weights.

Arithmetic operations performed on a n -qubit state are congruent modulo 2 n . To implement MCX, we initially increment a qubit state by one. The weight of | k 〉 state becomes the weight of | ( k + 1) mod 2 n 〉 . Thus, all weights are circularly shifted by one, as shown in Fig. 1(b). Performed on a classical register that stores bits, this operation is known as the circular shift to the left. To restore values of control qubits, we have to execute decrement by one on the quantum register comprised of lower ( n -1) qubits. Thus, we perform the quantum circular shift to the right in the basis subsets | 0 b n -1 · · · b m · · · b 1 〉 and | 1 b n -1 · · · b m · · · b 1 〉 where b m ∈ { 0 1 , } , as displayed in Fig. 1(b). As a result, we swapped target states' probability amplitudes thereby implementing the MCX operation. A block schematic of n -qubit MCX implementation is shown in Fig. 1(c).

A standard QFT implementation uses phase gates:

$$R _ { m } = P \left ( \frac { \pi } { 2 ^ { m -$$

Increments and decrements by one can be executed using a QFT-based adder [22]. This method computes QFT on the first addend and uses R m gates to evolve it into QFT of the sum based on the second addend. Then, the inverse of the QFT (QFT ) † returns the result to the computational basis. Thus, the increment by one is executed by QFT P † n +1 ,n QFT n | a 〉 = | a +1 mod 2 n 〉 = C n -1 X a | n 〉⊗| a n c +1 mod 2 n -1 〉 , where P +1 ,n = Z 1 / 2 n -1 ⊗ Z 1 / 2 n -2 ⊗ · · · ⊗ Z 1 / 2 ⊗ Z and | a n c 〉 = | a n -1 a n -2 · · · a a 2 1 〉 is the register comprised of lower ( n -1) control qubits. This part of the schematic is framed by a blue dashed line and labeled by '+1' mod 2 n in Fig. 1(c). To restore control qubits to the initial value, we execute decrement by one I 2 × 2 ⊗ QFT † n -1 P -1 ,n -1 QFT n -1 ( C n -1 X a | n 〉 ⊗ | a n c + 1 mod 2 n -1 〉 ) = C n -1 X a | n 〉 ⊗ | a n c 〉 ,

Fig. 1 (a) Schematic view of n -qubit multi-controlled X gate, (b) illustration of increment/decrements action on the state vector, and (c) implementations block diagram using QFTs and phase gates, adapted from Fig.1 of Ref. [21] originally published in Quantum Information Processing by Springer Nature. In panel (b), MSS-PA (most significant state's probability amplitude) in classical computing ordering is on the left, while LSS-PA (least significant state's probability amplitude) is on the right.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-517c3126-793f-475d-856a-33c6d3fe3c3a.jpg)

where P -1 ,n -1 = Z 1 / 2 n -2 † ⊗··· ⊗ Z 1 / 2 † ⊗ Z † and I 2 × 2 is the identity 2 × 2 matrix. This part of the circuit is framed by a red dashed line and labeled by ' -1' mod 2 n -1 in Fig. 1(c).

The decomposition of the 5-qubit QFT-MCX is shown in Fig. 2. To estimate the time complexity of the circuit, gates that can execute simultaneously are assembled in a single time slot bounded by a vertical dashed gray line in Fig. 2. Control qubits are | a 1 〉 - | a 4 〉 , and the target is | a 5 〉 . Let us consider the '+1' mod 2 5 part of the circuit and find the expression for the operation that executes on the target qubit. Controlled phase gates ( C -R m = C -Z 1 / 2 m -1 ), which act on the target qubit, are represented by gray circles. There are (2 n -1) of these gates. The first ( n -1) gates (to the left) are conditioned on the qubits of the control register | a c 〉 = | a n -1 · · · a 1 〉 ,

the central gate is unconditional, and the last ( n -1) gates are controlled by | a c +1 mod 2 n -1 〉 = | a ′ n -1 · · · a ′ 1 〉 . In a simplified notation, the action of these gates on the target wireline is

$$\begin{array} {$$

This operator is the identity ( I 2 × 2 ) in all cases except for a 1 = a 2 = · · · = a n -2 = a n -1 = 1 when (1 + a c mod 2 n -1 ) = 0 and 1 + a c = 2 n -1 so the expression, given by Eq. 2, is Z . Since HZH = X , when the controls are uncomputed by ' -1' mod 2 n -1 , the overall circuit executes MCX.

Fig. 2 The decomposition of the 5-qubit MCX using non-elementary H R , m and C -R m gates. The circle indicates phase gate R m with index m inscribed. Gates are divided into time slots by vertical gray dashed lines, where the index of the time slot is denoted at the bottom.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-0aa49e3a-7a10-4548-a4d4-8a9f4b929b7d.jpg)

## 3 QFT-MCX circuit optimization and a phase implementation

Let's analyze some circuit simplifications. On the first wireline there is HR H 1 = HZH = X (slots 9 to 11 in Fig. 2) and HR H † 1 = HZ H † = X † = X (slots 26 to 28 in Fig. 2). The phase gates controlled by the first qubit are applied at the beginning of QFT and end of QFT . These gates can merge using the equivalence shown in † Figs. 3(a) and (b), respectively. We conclude there is no need to implement P ± 1 separately. Moreover, the QFT in '+1' mod 2 n and the QFT † in ' -1' mod 2 n -1 will also have a set of C -R m (or C -R † m ) gates less. Optimized parts of '+1'mod2 n and ' -1' mod 2 n -1 circuits are displayed in Figs. 3(c) and (d), respectively. It is straightforward to show that the optimization reduces the number of time slots in MCX by 8. Although slots comprising only a few gates are merged, it can still be significant when applying MCX on a small set of qubits. Non-optimized QFT-based MCX becomes less complex than the standard implementation when the number of qubits n &gt; 6 [21]. Using the above optimization, one may show that QFT-MCX is better or just as good as the optimized standard implementation even for n ≤ 6.

Next, we will explain the functionality of '+1' mod2 n and ' -1'mod2 n -1 blocks. Using an iterative approach, we show that the '+1' mod 2 n circuit

$$& Q F T _ { n } ^ { \dagger } P _ { + 1, n }$$

is equivalent to the stair-wise array of controlled X gates, and ' -1' mod 2 n is its inverse. Alternatively, by adding to C -X gates on the first two wirelines and using Lemma 6.1 from Ref. [6] it is evident that two C -X and three C -R 2 gates implement Toffoli gate, as shown in Fig. 3(e). Applying this equivalence on C -R 3 gates and recurrently on higher qubits, we obtain an equivalent C C C 1 2 3 -X 4 gate, as shown in Fig. 3(e). From this perspective, the schematic view of the QFT-MCX circuit is given in Fig. 2(f).

Different forms of C -R m decompositions are schematically displayed in Fig. 4(a). The control phase gate C p -R m,q applied to | a p 〉 as the control and | a q 〉 ( q &gt; p in Fig. 2) as the target is

$$& - \infty \cdot - \gamma \, \cfrac { \pi } {$$

where we used the identity P γ XP ( ) ( -γ ) = R z ( γ XR ) z ( -γ ).

A phase difference between C -R m and C -R z ( π 2 m -1 ) gates is compensated using the R m +1 = P ( π 2 m ) gate on the control wireline of the C -R z gate, as explained in

Fig. 3 The identities for merging gates in (a) '+1' mod 2 n and (b) ' -1' mod 2 n -1 , where U m is a single qubit unitary gate (Note: for U = R m = Z 1 / 2 m -1 , U 2 = R m -1 = Z 1 / 2 m -2 ). Merging of phase gates and controlled phase gates for the 5-qubit MCX in (c) '+1'mod 2 5 and (d) ' -1'mod2 4 circuits, respectively. (e) The basic schematics illustrate how our circuit is equivalent to a series of MCX gates and (f) the equivalent stair-wise schematic of QFT-MCX based on Eq. 3.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-87e41c8b-b56f-49a0-ada1-69baf6f13e69.jpg)

Ref. [6]. If we neglect the phase-adding P gates and use C -R z instead of C -R m , providing that all qubits lower than the selected one are in the state | 1 , 〉 R z ( π ) = -iZ will be implemented between the two Hadamard gates in '+1' mod 2 n instead of Z (see Fig. 2 and Eq. 2). The omitted P gates implement the phase factor i , which can be easily verified in Fig. 2. Consequently, there is a phase relativization in the operation implemented on each wireline of the relative '+1' mod2 n subcircuit. Thus,

Fig. 4 (a) Decompositions of C -R m gates using R m +1 = P ( π 2 m ) (marked by circles) and R z ( ± π 2 m ) gates (marked with rounded squares). Here, R z ( ± π 2 m ) (or R m +1 ) gate acting on | q 〉 can be shifted to the beginning of the wireline. (b) A schematic of the simplified QFT-MCX obtained by omitting the phase correction gates P from C -R m acting on control wirelines. A gray color of multi-controlled gates indicates a relative phase -i and + i on gates in the '+1' and ' -1' blocks, respectively.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-4fe059a3-de80-4a1f-9473-cf822d3462e7.jpg)

on the k th wireline we will implement a multi-controlled ( -iX ) gate conditioned by the lower ( k -1) qubits. Similarly, multi-controlled ( iX ) gates are implemented by the relative ' -1' mod 2 n -1 subcircuit. Since - · i i = 1, it will not affect the control qubits outputs. Moreover, based on the symmetry argument and using the decomposition of C -R m from Fig. 4(a), it is straightforward to show that on each control wireline, displayed in Fig. 2, these P gates cancel out if all lower control qubits are one (when we have P ( π 2 m ) XP ( -π 2 m ) P ( π 2 m ) XP ( -π 2 m ) = I 2 × 2 ), or if they are not (when we have P ( π 2 m ) P ( -π 2 m ) P ( π 2 m ) P ( -π 2 m ) = I 2 × 2 ). However, this doesn't apply to the C -R m gates acting on the target wireline (see gray colored circles in Fig. 2), where there is no 'inverted' sequence of gates in ' -1' block-circuit (which would perform 'uncomputation'). Therefore, the P gates (shown in magenta in Fig. 4(b)) emerging in the C -R z decomposition of the C -R m gates acting on the target wireline can not be omitted. In Fig. 4(b), we show an equivalent schematic of QFT-MCX based on the relative phase multi-controlled ( ∓ iX ) gates comprised of C -R z s and additional P gates originated from C -R m acting on the target qubit. We used the notation P δ/ ( 2 m -1 ) instead of R m = P π/ ( 2 m -1 ), to consider a general case of adjusting the phase-factor ( e iδ ) applied to the target qubit.

If all controls are | 1 , 〉 -iX is implemented to the target qubit. To correct the additional phase ( -i ), we need to implement the phase factor e iδ = e iπ/ 2 = i to the

target qubit by adding P δ/ ( 2) and P ( -δ/ 2) to the ( n -1)th wireline, as shown in Fig. 4(b), thereby implementing

$$X P \left ( - \frac { \delta } { 2 } \right ) X P \$$

By doing this, the phase factor e -iδ/ 2 is introduced on the ( n -1)th wireline conditioned on the lower ( n -2) qubits, which can be corrected by adding P δ/ ( 4) and P ( -δ/ 4) to the ( n -2)th wireline, as shown in Fig. 4(b). However, this results in the additional phase e -iδ/ 4 (the wireline output is e -iδ/ 4 P δ/ ( 2), by analogy to Eq. 5), which can be corrected by adding appropriate phase gates to the lower qubit, and so on. Phase gates employed for the conditional application of e iδ to the target qubit are displayed in magenta in Fig. 4(b). One may note that these gates annihilate if one of the control qubits is in | 0 〉 state. Moreover, the same 'phase-adding' circuit can be implemented by surrounding the ' -1'mod2 n -1 subcircuit with the same phase gates, but in reverse ordering to the one used in the '+1' mod2 n . Thereby, on the ( n -1)th wireline we implement

$$P \left ( \frac { \delta } { 2 } \right ) X P \left ( - \frac { \delta } { 2 } \right ) X = R _ { z } ( \delta ) = e ^ { - i \delta / 2 } P ( \delta ),$$

providing that all controls are | 1 . 〉 Alternatively, we may combine these two approaches.

The essence of phase correction is to use two multi-controlled X gates existing in this stair-wise structure to implement a multi-controlled R z gate on each wireline. So, on the ( n -1)th wireline we implement C ( n -2) -R z ( δ ), on the ( n -2)th C ( n -3) -R z ( δ/ 2), and on the first wireline we apply R z ( δ/ 2 n -2 ). One should note that in genuine quantum computing, we utilize R z gates instead of P resulting in the global phase e iδ/ 2 n -1 to the output state. Choosing the symmetric configuration may avoid this at the price of keeping the two consecutive X gates on the first wireline.

Moreover, we can conditionally apply a custom phase to each control qubit by choosing different arguments in the P gates sequence. This is potentially very useful from the point of view of a more general application that combines multiple circuits. For example, we can use less complex MC-SU(2) gates, which are linear in the depth and the number of C-NOTs used. After performing the set of SU(2)-based computations, we can custom-add phase factors for each qubit using only one circuit which, as we will show in the next chapter, employs a quadratic number of C-NOT gates.

## 4 Multi-controlled U(2) gates

The aim is to generalize the MCX circuit to the multi-controlled single-qubit unitary gate (MCU). We will explore implementations in two distinct quantum computer architectures to find the lower and upper bounds for the time and space complexities. The most favorable architecture supports interaction between arbitrary pairs of qubits, implying that the system is fully connected (FC). Implementation in this architecture is the least complex, setting the lower complexity bounds. The most restricted is

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-3b9514d7-09e0-4771-805d-c2ab820ef65a.jpg)

## (b) LNN QFT-MCU

Fig. 5 A schematic of five-qubit MCU implementations based on QFT-MCX modification in the (a) fully connected (FC) and (b) linear nearest-neighbor (LNN) quantum computer architecture. Circles denote either phase R m = Z 1 / 2 m -1 or R z ( π/ 2 m -1 ) gates, while hexagons represent special unitary SU m = SU 1 / 2 m -1 gates ( U m = e iδ/ 2 m -1 SU m ), with the value m inscribed into gate symbols. To estimate the time complexity, gates that can execute simultaneously are divided into time slots. We do not assign a number for the time slot comprising P gates since they can merge or execute in parallel with some other.

the linear one allowing interactions only between nearest-neighbours (LNN). Using this architecture demands swapping many qubits to perform two-qubit gates, and additional SWAP gates increase the time and space complexities. We use two strategies to generalize the circuit. The first is based on modifying the QFT-based MCX gate, while the second uses extended optimized QFT-MCX gates to implement a circuit similar to the complex gate that could be obtained using the well-known ZYZ ( ABC ) decomposition [6].

/negationslash

It is straightforward to conclude from Eq. 2 that by substituting R m = Z 1 / 2 m -1 with U m = U 1 / 2 m -1 on the target qubit and omitting H gates, the circuit implements a multi-controlled unitary U gate. Schematic views of 5-qubit MCUs in the FC and LNN architecture are given in Figs. 5(a) and (b), respectively. If U is not a special unitary, then U (2) = e iδ SU (2), where δ is a real valued. To implement an arbitrary multi-controlled U (2) ∈ SU (2), we need to implement multi-controlled SU (2) and the controlled phase circuit C C 1 2 · · · C n -2 -P n -1 ( δ ) that adds the phase factor e iδ , as shown in the inset in Fig. 5(a). In section 3 we found that the '+1' and ' -1' blocks are equivalent to a sequence of multi-controlled gates needed to implement ( n -1)controlled phase gate. So, we don't need to implement it using a separate circuit. Moreover, these gates can be found by direct decomposition of controlledU (2) gate

$$C - U _ { m } = ( C - S U _ { m } ) ( P ( \delta / 2 ^ { m - 1 } ) \otimes I _ { 2 \times 2 } ),$$

where U m = e iδ/ 2 m -1 SU m . Furthermore, these phase gates execute simultaneously with a gate acting on the controlled wireline. Therefore, we have not assigned them a separate time slot in Fig. 5.

One may show that FC QFT-MCU executes in (8 n -18) time slots. It comprises of 4( n -3) single-qubit Hadamards, 2( n -1)( n -3) controlled phase gates, two C -NOTs and (2 n -3) C -U m gates. An approximate QFT (AQFT) may provide greater accuracy than a full QFT in the presence of decoherence [23]. Controlled phases R m with m ≤ [log 2 n ] are used in AQFT. Therefore, the number of controlled gates reduces to 2([log 2 n ] -1)(2 n -3 -[log 2 n ]) C -R m gates and at least 2([log 2 n ] -1) C -U m gates.

Using the systematic approach for swapping qubits in finite-neighbor quantum architectures [24], one may find that LNN QFT-MCU needs (8 n -20) time slots with (2 n 2 -6 n + 6) SWAP gates. Therefore, LNN uses approximately twice the number of time slots and gates as FC QFT-MCU, thus setting the upper bound for the time and space complexities. In the LNN architecture, SWAP and C -R m are neighboring. Decomposing C -R m and C -R † m into C -R z ( ± π/ 2 m -1 ) gate and shifting R z ( ∓ π/ 2 m ) either to the beginning or the end of controlled gate sequence, two C -X gates cancel out between SWAP and C -R z . Hence, each additional SWAP gate (except the upper gate in slot 26) effectively reduces to a C-NOT gate, while the target and control of the C -X gate in the neighbor C -R z swap over.

Actual circuit depth and the number of gates implemented depend on the native gate set (NGS) of the quantum device used in the calculation. The decomposition of a non-elementary gate uses a few elementary gates executed in a certain number of time slices. This number of time slices defines the circuit depth. One should note that

some elementary gates can be executed in parallel and some cancel out, as explained in Ref. [21] for the selected NGS. Elementary gates that comprise the NGS have a high but finite fidelity. Also, current quantum devices are prone to noise and decoherence. Therefore, low-depth circuits using fewer elementary gates are less prone to errors.

The advantage of using QFT to implement MCU relies on the efficient decomposition of controlled phase gates compared to C -R x ( π/ 2 m -1 ) used in the state-of-the-art linear-depth decomposition (LDD) of MCU [16, 18]. If we ignore noiseless R z gates and the two C-NOT gates used in both implementations, the decomposition of C -R z uses additional noisy √ X gates. However, both implementations use C -U m gates which are the most complex and hard to implement in a general case. A recent paper showed that the circuit can be simplified by omitting gates with m &gt; /ceilingleft log 2 n /ceilingright [18] similar to the approximate QFT approach. We should note that the QFT-based MCU circuit uses approximately the same number of non-elementary gates as the state-ofthe-art one. However, the decomposition of C -R m in the NGS of superconducting hardware is twice as less complex as C -R x ( π/ 2 m -1 ) leading to approximately double the advantage of the QFT-based approach when implementing MCX [21]. In the case of a general special unitary gate, the depth of the MCU circuit is predominantly determined by the complexity of the C -U m decomposition. Since our approach uses the same sequence of gates on the target qubit's wireline in the first 'triangular' subcircuit, the difference in the LDD- and QFT-MCU depths is smaller than in the case of MCX-s. However, the number of elementary gates used in our approach is still approximately twice as small as in LDD.

We introduce an alternative single-qubit unitary gate notation [7] based on a general rotation about an arbitrary axis given by a unit vector /vector a to optimize the QFT-MCU depth further. A single qubit unitary gate can be expressed as:

$$U & = e ^ { \imath \delta } R _ { \vec { a } } ( \Phi ) = e ^ { \imath \delta } e ^ { - \imath \frac { \Phi } { z } \vec { a } \cdot \vec { a } } = e ^ { \imath \delta } R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) R _ { z } ( \Phi ) R _ { y } ( - \theta _ { z } ) R _ { z } ( \phi _ { x y } ) \\ & = e ^ { \imath \delta } R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) R _ { z } ( \Phi ) ( R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) ) ^ { \dagger },$$

where θ z is the angle between /vector a and the z -axis, and φ xy is the angle between the projection of /vector a in the xy -plane and the x -axis, as displayed in Fig. 6(a). Thus, R z ( -φ xy ) first rotates /vector a into the xz -plane, and then R y ( -θ z ) executes rotation to align /vector a with the z -axis. After performing the desired rotation about /vector a by the angle Φ using R z (Φ), the system is restored to its original orientation applying rotations R y ( θ z ) and R z ( φ xy ), respectively. This decomposition is slightly more complex than the standard U = e iδ R z ( α R ) y ( θ R ) z ( β ). Using the general rotation formula from Ref. [7] it is straightforward to show that the alternative decomposition can be reduced to the standard one where sin θ 2 = sin θ z sin Φ 2 , α = α z + φ xy and β = α z -φ xy + π with tan α z = -cot Φ 2 / cos φ z .

This alternative notation provides us with a rather simple symmetric form of U k :

$$U ^ { k } & = e ^ { \imath k \delta } R _ { \vec { a } } ^ { k } ( \Phi ) = e ^ { \imath k \delta } e ^ { - \imath \frac { \Phi } { 2 } k \vec { a } \cdot \vec { \sigma } } \\ & = e ^ { \imath k \delta } R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) R _ { z } ( k \Phi ) ( R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) ) ^ { \dagger }.$$

Fig. 6 (a) Schematic representation of a general single-qubit state rotation by angle Φ about the axis defined by the vector /vector a (displayed by a blue arrow). The angle between /vector a and the z -axis is θ z , while the projection of /vector a onto the xy -plane forms the angle φ xy with the x -axis. The Bloch state vectors | ψ 0 〉 and | ψ 1 〉 = e -ı Φ 2 /vector /vector aσ | ψ 0 〉 , given by a red arrows, denote the initial and the final single-qubit state up to the phase e ı δ , respectively. The trajectory of the state on the Bloch sphere, represented by a red arc, is in the plane perpendicular to /vector a . (b) The decomposition of C p -U m,q .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-5aeaf563-ccae-4b90-90b3-0958408a8514.jpg)

To implement C -U k we use C -R z ( k Φ), as displayed in Fig. 6(b). Although this decomposition is not less complex than the standard one, it will significantly simplify QFT-MCU. To implement our circuit, we have to find

$$U _ { m } = U ^ { 1 / 2 ^ { m - 1 } } = e ^ { \imath \delta / 2 ^ { m - 1 } } R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) R _ { z } ( \Phi / 2 ^ { m - 1 } ) ( R _ { z } ( \phi _ { x y } ) R _ { y } ( \theta _ { z } ) ) ^ { \dagger }, \quad ( 1 0 )$$

where we used k = 1 2 / m -1 in Eq. 9. Here, controlled U m gate is:

$$C - U _ { m } = ( I _ { 2 \times 2 } \otimes R _ { z y } ( \phi _ { x y }, \theta _ { z } ) ) ( C - R _ { z } ( \Phi / 2 ^ { m - 1 } ) ) ( I _ { 2 \times 2 } \otimes R _ { z y } ( \phi _ { x y }, \theta _ { z } ) ) ^ { \dagger }, \quad ( 1 1 )$$

where R zy ( φ xy , θ z ) = R z ( φ xy ) R y ( θ z ). Using the above identity we may replace C -SU m gates with C -R z (Φ 2 / m -1 ) in the '+1' subcircuit, as displayed in Fig. 7. One may note that R zy and R † zy between consecutive SU m gates acting on the target wireline in the '+1' subcircuit cancel out. This significantly simplifies the circuit, since C -R z has approximately threefold simpler decomposition than a general C -SU .

If Φ is small, R z (Φ 2 / m -1 ) approaches the identity matrix for a rather small value of m . In the place of these gates, QFT-MCX has R z ( π/ 2 m -1 ). When Φ is sufficiently smaller than π , MCU gates perform poorly compared to MCX.

One may imply that this alternative notation ( U = U φ ( xy , θ z , Φ , δ )) is very beneficial due to the symmetry argument and simplicity. It is straightforward to define many common gates, such as X = U (0 , π/ 2 , π, π/ 2). Furthermore, some useful operations are simple to implement. For example, C n -1 -U † ( φ xy , θ z , Φ , δ ) = C n -1 -U φ ( xy , θ z , -Φ , -δ ).

If we apply the sequence of gates acting on the target qubit to new target wirelines, we will implement the same unitary gate controllably. Thus, expanding QFT-MCU to the multi-controlled multi-target unitary gate (MCMTU) is straightforward. We can use '+1' subcircuit to implement C -U to as many qubits as needed, and

Fig. 7 A schematic of the optimized circuit which is straightforwardly expanded to the multicontrolled multi-target unitary gate. We show the circuit with only two target qubits displayed in blue. Instead of applying the sequence of C -R z (Φ 2 / m -1 ) operations on two wirelines using only '+1' subcircuit, we employed 'uncomputational' ' -1' subcircuit to implement C -U to the second wireline.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-b58c0117-71b8-47db-91cf-df461ca46556.jpg)

' -1' mod 2 n -1 subcircuit is identical as in the MCU. In Fig. 7, we have shown the modified 6-qubit MCU with four controls and two targets. We used '+1' subcircuit to apply controlled unitary to the first target, and ' -1' to execute the same operation on the second target. This approach is beneficial if both target qubits are part of the qubits chain in the linear nearest-neighbor network. If we use only '+1' subcircuit to implement C -U on both targets, we would have to swap target qubits for applying each of (2 n -5) C -R z (Φ 2 / m -1 ) operations. However, if we split execution between '+1' and ' -1' subcircuits, we need to swap only twice, in slots 13 and 26 in Fig. 7. If we apply a controlled operation to many target wirelines, the best option is to execute MCX on one clean ancilla qubit and then use it to implement C -U on all targets.

The second implementation is also based on an alternative single-qubit notation. It is straightforward to conclude that a multi-controlled single-qubit unitary gate can be expressed as

$$C ^ { n - 1 } - U ( \phi _ { x y }, \theta _ { z }, \Phi, \delta ) & = [ I _ { ( n - 1 ) \times ( n - 1 ) } \otimes R _ { z y } ( \phi _ { x y }, \theta _ { z } ) ] \\ & \cdot \ [ C ^ { n - 1 } - ( e ^ { \imath \delta } R _ { z } ( \Phi ) ) ] \\ & \cdot \ [ I _ { ( n - 1 ) \times ( n - 1 ) } \otimes R _ { z y } ( \phi _ { x y }, \theta _ { z } ) ] ^ { \dagger },$$

where the decomposition of C n -1 -R z (Φ) uses two MCX ( C n -1 -X ) gates

$$C ^ { n - 1 } - R _ { z } ( \Phi ) = & \, ( C ^ { n - 1 } - X ) ( I _ { ( n - 1 ) \times ( n - 1 ) } \otimes R _ { z } ( - \Phi / 2 ) ) \\ & \, \cdot ( C ^ { n - 1 } - X ) ( I _ { ( n - 1 ) \times ( n - 1 ) } \otimes R _ { z } ( \Phi / 2 ) ),$$

and the controlled phase factor can be implemented by adding appropriate phase gates to the controlled wirelines of MCXs, as explained in Section 3. To implement two MCX gates needed for the decomposition, we will use a single QFT-based MCX circuit with ' -1' mod 2 n instead of I 2 × 2 ⊗ (' -1' mod 2 n -1 ), as shown in Fig. 8. Thus, we used one MCX instead of the two needed in the standard approach. A simplified stair-wise MCX diagram used in MCU is displayed in Fig. 8. A detailed representation of QFT-MCX circuits in FC and LNN architectures can be found in Ref. [21]. Here, A = R zy ( φ xy , θ z ) = R z ( φ xy ) R y ( θ z ), B = R z ( -Φ 2), / and C = ( AB ) † . In the standard ZYZ decomposition, for a single-qubit unitary matrix expressed as U = e iδ R z ( α R ) y ( θ R ) z ( β ), there is a set of matrices A = R z ( α R ) y ( θ/ 2), B = R y ( -θ/ 2) R z ( -( α + β / ) 2), and C = R z (( β -α / ) 2) such that ABC = I 2 × 2 and U = e iδ AXBXC [6]. Thus, we use an alternative form of the ZYZ decomposition that is as complex as the standard one when implemented using the QFT-based approach. Therefore, an advantage of the ZYZ QFT-MCU implementation is not based on an alternative notation but on the fact that we use one QFT-MCX to implement MCU instead of the two MCXs used in the default approach. The complexity of the circuit is approximately equal to the QFT-MCX, where we use only additional A B , , and C single-qubit gates. In general multi-controlled single-qubit U (2) gate implementation, we have additional phase gates (shown in magenta color in Fig. 8), that implement ( n -1)-qubit controlled phase gate. This doesn't affect the MCU's fidelity and time complexity, since P gates are noiseless and can be executed parallel with B and C . As in the case of QFT-MCU, it is straightforward to expand this circuit to MTMCU by applying the same sequence of gates on a new target wireline as on the n th.

The QFT-based subcircuits ('+1' and ' -1') implement two MCX gates and are executed in (8 n -12) time slots in the FC architecture. There are 4( n -2) Hadamard gates, 2 n n ( -2) controlled phases, and two C -X gates. AQFT reduces the number of C -R m gates to 2([log 2 n ] -1)(2 n - -1 [log 2 n ]). At most three time slots are required for executing A B , , and C . The LNN implementation uses an additional (8 n -16) time slots with 2( n -1) 2 SWAP gates. Due to canceling out of two C -X gates between SWAP and C -R z the increase in the number of elementary gates in LNN will be lower than it seems.

After reviewing the complexity metrics, we can ask ourselves if the second implementation is useful. However, using Lemma 7.9 and referring to Lemma 5.4 of Ref. [6] implies that multi-controlled special unitary (MC-SU) gates can be efficiently simulated by splitting control qubits into two groups, as shown in Fig. 11(a) for the SU R z gate used in the generalized notation. This approach is employed to linearise the number of C-NOT gates used in different MC-SU circuits [17, 19, 25]. By roughly dividing the control register in half and utilizing dirty ancilla qubits in each group, the number of C-NOT gates in FC implementation is reduced to (28 n -88) for n even

Fig. 8 A schematic of n -qubit MCU implementation based on the ZYZ-like decomposition and extended QFT-MCX. The phase gates that implement multi-controlled phase factor e ı δ are represented by magenta circles, while the green rectangle frames the part of the circuit which implements C n -1 -( e ı δ R z (Φ)). Groups of single-qubit gates acting on the target qubit, other than the ones belonging to MCX, are famed by dashed gray rectangles and denoted by A B , , and C , by analogy to the standard ZYZ decomposition.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-71cf00ec-60c1-423a-9630-27719074ba6a.jpg)

and (28 n -92) for n odd, provided the number of qubits is n ≥ 8.[25] Using additional optimization in Ref. [17] this number is reduced to (20 n -42) for n even and (20 n -38) for n odd, provided the number of qubits is n ≥ 5.

Fig. 9 The decomposition of a multi-controlled R z gate, which is applied to the target in our approach that uses the alternative notation, when controls are divided into (a) two and (b) three groups.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-caddc4a3-79dc-40d9-ab5e-52afc2b0cacc.jpg)

Applying ABC decomposition recursively, it is straightforward to show that control qubits can be divided into more than two clusters, as shown in Fig.11(b) for splitting controls into three groups. Using a deductive analysis, we found the simple binary

rule to implement this circuit without an actual recursive decomposition. Providing that controls are divided into m groups, there will be 2 m R z ( ± Φ 2 / m ) gates separated by MCX gates controlled by a certain group. The sequence starts with R z gate and ends with MCX, or vice versa. The nearest R z s have the opposite sign of argument (Φ 2 / m ). Labeling controlled groups by p i , with i ranging from 1 to m , and the position of MCX action on the target wireline from 1 to 2 m , the first MCX should be applied to the first and 2 m -1 th position. Since one extended MCX implements two multicontrolled NOTs, we use only one MCX for this operation. Considering that ' -1' is inverse to '+1', the action of phase-adding gates cancels out and we use only relative MCX in implementation, as explained in section 3. The MCX gates controlled by the second cluster are applied periodically to positions labeled by k · 2 m -2 th (where k = { 1 , ..., 2 2 } ) except the two positions 'occupied' by MCX gate controlled by the first group. Therefore, the QFT-MCX circuit controlled by the second group is also used once to implement the two multi-controlled X on the 2 m -2 th and 3 · 2 m -2 th position (that is, 2 2 -2 1 = 2). The third group is applied to the positions labeled by an integer multiple of 2 m -3 , excluding the one already occupied by lower indexed groups (namely, 2 3 -2 2 = 4 points and twice less QFT-MCX circuits, e.g. 2). Finally, the last group is applied to the remaining positions, which are 2 m -1 locations labeled by an odd number. The MCXs controlled by the last cluster will be applied the most frequently and should contain the smallest number of controls, preferably one wireline when we use C-NOTs instead of MCX.

We will use more than two groups if the price in the circuit depth and the number of C-NOT gates due to removing a single wireline from the larger of the first two groups is higher than adding one more cluster containing a single wireline. Moreover, the price of adding another wireline to the third cluster is higher than forming the fourth cluster containing a single wireline, and so on. Thus, the first two clusters must contain approximately equal to the number of control wirelines while others are comprised of a single wireline. From Fig. 8 it is apparent that a R z gate controlled by the lower qubits is implemented on each control wireline, except the first one. For example, the circuit acting on the k th wireline is C k -1 -R z ( δ/ 2 n - -k 1 ). Therefore, we can apply decomposition to phase circuits too. Thus, we can use this decomposition to optimize QFT-MCU. If circuits acting on the target and all control wire lines are decomposed as described, we will call this approach 'deep decomposition' (DD). In Fig. 10, we show the five-qubit DD-MCU. Rather straightforward but a more complex circuit for n &gt; 4 is when using ( n -1) groups each containing a single control when we apply by 2 n -1 R z and C -X gates of each on the target wireline.

Building DD-MCU with more than four qubits requires MCX gates in the first two groups. These gates are comprised of '+1' and ' -1' subcircuits, each executing the single MCX operation, as shown in Fig. 8. If we use relative phase MCX, the gates in the second part of a circuit have to be inverted with respect to the ones in the first part. Then, the phase -i in the first half of MCX cancels out with the + i in the second half. We demonstrate this case in Fig. 10, where we used relative '+1' mod 2 3 (the relative Toffoli) and relative ' -1'mod2 3 (the reversed relative Toffoli) circuits framed by dashed lines. Furthermore, each QFT-MCX gate applied to a wireline reduces the number of z -rotation operators needed by twice. Therefore, we double arguments in

Fig. 10 Optimal 5-qubit MCU based on the deep decomposition.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-63cd33f0-cbf6-4bdc-bd95-6acfd5ff9e37.jpg)

R z gates for each QFT-MCX employed for two multi-controlled X operations. This consideration is crucial when implementing the phase factor to the control wirelines.

The depth of this circuit is predominantly determined by the number of gates acting on the target wireline. The most complex circuit for n &gt; 4 is when having ( n -1) groups each containing a single control when we apply by 2 n -1 R z and C -X gates each to the target wireline. In the next chapter, we will analyze circuit depth and the number of elementary gates used in various implementations. We will show that deep decomposition is useful. Although the increase in the number of C-NOT gates with the number of qubits is not linear in DD-circuits, up to the certain number of qubits used in MCU, the total number of C-NOTs is smaller than that in QFT-based circuits with a quadratic increase in the number of C-NOT gates.

## 5 Analytical and numerical analysis

To get theoretical bounds for complexities in a genuine quantum computation, we adopt the native gate set { C -X,R ,ID,SX z = √ X,X } , which is one of a few sets used by superconducting hardware. One may show that R m = exp( i π 2 m ) · R z ( π 2 m -1 ), H = exp( i π 4 ) · R z ( π 2 ) √ XR z ( π 2 ), R y = √ ZHR H z √ Z † , and SWAP 12 = ( C 1 -X 2 )( C 2 -X 1 )( C 1 -X 2 )[7]. Hadamard and SWAP use three native gates and three elementary time intervals to execute, while R y and C -R m use five. Shifting and merging R z gates the depths of C -R z and C -R m gates are effectively reduced to three. Some of the R z gates can be executed simultaneously, as elaborated in Ref. [21]. Merging consecutive R z gates, A and C comprise 5 elementary gates, and B uses one R z gate. There are SWAP · C -X and SWAP · C -R z gate sequences in the LNN implementation, where two C -X gates annihilate in each. In the most general case, the standard decomposition of a controlled single-qubit unitary gate in the NGS uses 14 elementary gates (two C -X , four √ X , and the rest are R z ) that execute in 13 elementary time intervals. One should note that the decomposition of some C -U gates (excluding C -X or C -Z , since comprised in the basis gate set of superconducting quantum devices) is less complex, where C -R z and C -P are some of the simplest. Merging R z 's of neighboring U m gates, the depth and the number of elementary gates effectively

reduce by one (except for the first or the last gate on the target wireline). However, using an alternative single-qubit representation we derived a method to substitute C -U m gates with C -R z (Φ 2 / m -1 ) significantly reducing our circuit depth and the number of the elementary gates used.

Experimental analysis of LDD-MCX circuits demonstrated that omission of certain gates may result in a higher precision [18]. However, a clear criterion for approximation has not been elaborated. In QFT-MCU we use R z ( π/ 2 m -1 ) and R z (Φ 2 / m -1 ), where the former are a part of the QFT circuit while later are gates acting on the target qubit. To obtain a consistent approximation of the QFT-MCU circuit, we should keep R z ( ϕ ) gates with the argument ϕ ≥ π/ 2 /ceilingleft log 2 n /ceilingright1 = ϕ min . Therefore, the approximation would not be applicable if Φ &lt; ϕ min . However, we may choose the optimal ϕ min for our circuit.

We will estimate the lower and upper bounds for the circuit depth and number of elementary gates for a multi-controlled U (2) gate. All bounds, expressed as a function of the number of qubits used, are derived employing the selected NGS. We will use all the optimizations above thus obtaining the minimal values for complexity bounds. If the transpiling software does not find the optimal conditions, the circuit complexities may exceed the calculated upper bounds.

By counting in the NGS, FC-MCU based on MCX modification has the depth (24 n -53) for n &gt; 3. The circuit uses 4( n -2) √ X or √ X † , and 4( n -1)( n -2) C -X gates. In the fully optimized circuit, the number of R z gates is at least (2 n 2 -17). An approximation of the circuit depends on Φ and may additionally reduce the number of C-NOTs and R z gates. Due to the SWAP gates used in the LNN implementation, the depth of the circuit increases by at least (8 n -18) for n &gt; 3. We do not need to swap qubits for n = 3. Also, the number of C -X gates enlarges by at least (2 n 2 -6 n +6). For a general C -U (2) circuit, we use (2 n -3) R z gates to implement the controlled-phase circuit.

FC-MCU based on the ZYZ-like decomposition has the depth (24 n -31). It uses 2( n 2 + 2 n -6) R z , 4( n -1) √ X or √ X † , and 2(2 n 2 -4 n + 1) C -X gates. An approximation of the circuit is straightforward, as in the case of standard QFT. It will reduce the number of R z and C -X gates to 2(2(2 n -3)+([log 2 n ] -1)(2 n - -1 [log 2 n ])) and 2(1 + 2([log 2 n ] -1)(2 n -1 -[log 2 n ])), respectively. Additional SWAP gates used in the LNN architecture increase circuit depth and the number of C -X gates by at most (8 n -16) and 2( n -1) 2 for n &gt; 3, respectively. This circuit also uses (2 n -3) R z gates to implement e iδ .

As shown in the previous chapter, the number of elementary gates in a DD-MCU is non-linear with the number of qubits. In Table 1 we give the number of C-NOT gates used in DD-MC-SU(2) and DD-MC-U(2) circuits as a function of the number of qubits n . One may show that the number of C-NOTs used in DD-MCU is lower than that employed in QFT-MCU for n ≤ 12. Moreover, the most optimal MC-SU(2) circuit [18] uses more C-NOTs than DD-MCU for n ≤ 15. We consider only C-NOT or C - √ Z gates since the median error of these gates is approximately 20 times higher than X used in our circuits, while R z gates are error-free. Based on these facts and the current performance of NISQ devices, we infer that DD-MCU can have the highest impact on practical applications.

Table 1 Qubits clustering and the number of C-NOTs in n -qubit DD-MCUs.

|   n qubits |   The number of clusters | Controls per cluster   |   The number of C-NOTs in MC-SU(2) 1 |   The number of C-NOTs in MC-U(2) 2 |
|------------|--------------------------|------------------------|--------------------------------------|-------------------------------------|
|          3 |                        2 | [1, 1]                 |                                    4 |                                   6 |
|          4 |                        3 | [1, 1, 1]              |                                    8 |                                  14 |
|          5 |                        3 | [2, 1, 1]              |                                   14 |                                  28 |
|          6 |                        3 | [2, 2, 1]              |                                   20 |                                  48 |
|          7 |                        3 | [3, 2, 1]              |                                   28 |                                  76 |
|          8 |                        3 | [3, 3, 1]              |                                   36 |                                 112 |
|          9 |                        4 | [3, 3, 1, 1]           |                                   44 |                                 156 |
|         10 |                        4 | [4, 3, 1, 1]           |                                   60 |                                 216 |
|         11 |                        4 | [4, 4, 1, 1]           |                                   76 |                                 292 |
|         12 |                        5 | [4, 4, 1, 1, 1]        |                                   92 |                                 384 |
|         13 |                        5 | [5, 4, 1, 1, 1]        |                                  124 |                                 508 |
|         14 |                        5 | [5, 5, 1, 1, 1]        |                                  156 |                                 664 |
|         15 |                        6 | [5, 5, 1, 1, 1, 1]     |                                  188 |                                 852 |

Comparison to other methods.

1 For n ≤ 15 is lower than (16 n -40) in the most optimal SU(2) implementation.[18]

2 For n ≤ 12 is lower than 4( n -1)( n -3) in QFT-MCU.

Actual complexities for execution on a quantum device are obtained by assembling analyzed circuits using the transpile function built-in Python package Qiskit v.1.3.2 [26]. In doing so, we employed optimization level 3. We used the local simulator to transpile circuits for application on the latest version of a generic quantum device. The Qiskit Runtime local testing mode is engaged to emulate noisy MCU calculations. To find circuit reliability, we set all input qubits to | 1 〉 and appended the target qubit with U † , as in Ref. [16]. We consider the calculation to be executed properly only if we measure 'one' at all the outputs. Emulations were repeated n shots = 10 5 times on each circuit. We have compared our implementations to the standard Qiskit and the state-of-the-art LDD-MCU circuit. The unitary single-qubit gate used in all analyzed MCU circuits was randomly chosen from U (2) gates. To get angles φ xy , θ z , δ and Φ, we have generated random rational numbers and multiplied them by π . We constrained our choice to exclude trivial gates. In Figs. 11 (a) and (b), we show comparative results of variation in circuit depth and reliability with the number of qubits, respectively. Furthermore, we compare the number of C-NOT and √ X gates used in various implementations in Fig. 11 (c) and (d), respectively.

The default Qiskit implementation exhibits an exponential increase in the time complexity with the number of qubits, while circuit depths of either LDD or QFTbased MCUs are linear. LDD and QFT-MCU use C -U m gates, which have a complex decomposition that increases the circuit depth compared to MCX implementation. Using an alternative notation, we simplified C -U m to C -R z in our approach. Moreover, LDD uses C -R x gates that are more complex than C -R m comprising QFT-based implementation. Therefore, the circuit depths of LDD-MCU are twofold larger than QFT-MCU even though they have a similar construction. Although not linear, DD-MCU has the smallest depth up to a five-qubit circuit, as shown in Fig. 11(a).

Fig. 11 The dependence of (a) circuit depths, (b) probabilities for measuring '1' at all outputs, (c) the number of C-NOT and (d) √ X gates on the number of qubits used in MCU in the default Qiskit ( /triangle ), LDD-MCU from Ref. [16] ( /square ), QFT-MCU ( © ), and DD-MCU ( /triangleinv ). Due to the high complexity of the default Qiskit circuit, the software failed to emulate results for n &gt; 9.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-3e5916c6-ae57-47ce-b1a8-3cf222d827d2.jpg)

Since the default Qiskit MCU is the most complex, it exhibits the lowest fidelity of all other implementations (see Fig. 11(b)). Moreover, there is an exponential increase in the number of C-NOT and √ X gates used, as displayed in Figs.11(c) and (d), respectively. Detail analysis shows that the probability of measuring '1' at all outputs in the default Qiskit MCU is approximately n shots / 2 n for n ≥ 7 implying a white noise-like output in the circuit. Up to n = 10, DD-MCU has the highest fidelity of all. This is a consequence of using the smallest number of noisy C-NOT gates, as can be inferred from Fig. 11(c). However, since the depth of the circuit increases nonlinearly and significantly exceeds the value of the depth of the QFT and LDD circuits for n &gt; 10, it becomes less reliable than the later two implementations. QFT-MCU circuit exhibits a small advantage in fidelity over LDD-MCU. One may note that both implementations use an equal number of noisy C-NOT gates (see Fig. 11(c)). However, LDD-MCU has a twofold higher depth and uses approximately three times more low-noisy √ X gates than our QFT-MCU, which becomes significant for n &gt; 10. Considering these facts, and following the discussion in section 3, one may wonder if LDD-MCU is somehow equivalent to our QFT-MCU. Straightforward methods to simplify LDD-MCU to our QFT-MCU are elaborated in Appendix A. One should be noted that the results for LDD are in excellent agreement with the experimental ones

(see the lower panel of Fig. 4 in Ref. [16]). Therefore, the emulation of noisy quantum calculations should be comparable to genuine quantum computations.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-10cd9bf1-2c52-4e98-8c4c-183804945d22.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-cf48da77-93eb-46f9-b05f-9b3d5634783f.jpg)

n

Fig. 12 The dependence of (a) circuit depths, (b) probability for measuring '1' at all outputs, and (c) the number of C-NOT gates in a circuit on the number of qubits used by MCU in the state-ofthe-art Qiskit's MCX ( /triangle ) and DD-MCX ( /triangleinv ).

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-e8bf8edb-b2bf-49a3-8e7c-d55dc973c07c.jpg)

Finally, we use our DD-MCU to implement a multi-controlled X gate and compare it to the Qiskit implementation. One should note that Qiskit's library contains custom-tailored low-depth MCX circuits using a small number of C-NOTs. Their schematics can be found in state-of-the-art references. In Fig. 12, we compare circuit depths, fidelities, and the number of C-NOT gates used in our DD and Qiskit MCX implementation. For circuits with up to four qubits, both implementations have the same depth, fidelity, and number of C-NOT gates used. Starting from 5-qubit MCX, our deep decomposed circuit is less complex (see panel (a)), more reliable (panel (b)), and uses fewer C-NOT gates (panel (c)) than state-of-the-art Qiskit's MCX.

Our library used to generate results presented in this work is publicly available on GitHub [27]. Given the high fidelities and low depths of our QFT-based circuits, we assert that they implement multi-controlled circuits in the qubit-based devices as well as a perspective higher-dimensional qudit-based hardware [28, 29].

## 6 Conclusions

In this paper, we have presented a few new implementations of multi-controlled unitary (MCU) gates based on the modification of multi-controlled X (MCX) circuits that use the quantum Fourier transform (QFT). In the first implementation, the phase gates acting on the target qubit ( Z 1 / 2 m -1 ) of QFT-MCX, are replaced with the adequate roots of the single-qubit unitary gate ( U 1 / 2 m -1 ). The main drawback of this circuit is that it uses U m = U 1 / 2 m -1 gates, which are relatively complex to implement. However, in our approach we used an alternative single-qubit gate notation to simplify C -U m gates to C -R z , thereby making our circuit as simple as MCX. The second implementation is based on the ZYZ-like decomposition and uses an extended QFT-based MCX circuit to implement the two MCX gates needed for the decomposition. Further simplifications of these two are straightforward by approximating QFT or introducing auxiliary qubits. We used our second implementation recursively on the QFT-MCU with control qubits divided into clusters. It provides us with a deep decomposition (DD) of our QFT-MCU. We showed that DD-MCU uses the least number of noisy

C -X gates, which makes it the most useful for application in the current noisy quantum devices. Our implementations have lower time and space complexities compared to any existing MCU. Running noisy emulations on transpiled circuits demonstrated that our MCUs have a noticeable advantage in fidelity compared to state-of-the-art implementations.

We elaborated various techniques to optimize our circuits. Moreover, we demonstrated that the state-of-the-art linear-depth decomposition (LDD) MCU can be simplified to our QFT-MCU, thus significantly reducing the LDD's time and space complexities. Our alternative notation may facilitate the optimization and simplification of various complex quantum circuits.

## Appendix A Optimization of state-of-the-art LDD-MCU circuit

We found that if we insert two consecutive Hadamard gates between R x gates from References [16, 18] (where HH = I 2 × 2 ), and using the equivalence HR x ( γ H ) = R z ( γ ), all the C -R x ( γ ) gates will transform to C -R z ( γ ). On the second wireline R x ( ± π ) = ∓ iX . We can add two constant phase gates, + iI 2 × 2 and -iI 2 × 2 , between R x gates transforming C -R x ( ± π ) to C -X gates. By doing this, we transitioned from the X -basis used in LDD to the Z -basis utilized in our approach. When we perform all transformations above, each control wireline, except the first two, will have one H gate 'remaining' at the beginning and the end of the C -R z sequence. Thus, the LDDMCU is reduced to our QFT-MCU from Fig. 5, as demonstrated in Fig. 13. This will decrease the number of elementary gates employed and the LDD circuit's depth by approximately twice.

It is straightforward to show that equivalent simplification can be obtained using our alternative single-qubit notation applied to C -U m and C -R x gates. We imply that this method may effectively simplify many state-of-the-art circuits.

Finally, in Ref. [18] authors shown that using decomposition in Fig. 9(a), Lemma 7.2 with Corollary 7.4 from Ref. [6], and Lemma 8 from Ref. [25], multi-controlled SU(2) circuit can be implemented with at most (16 n -40) C-NOTs for n ≥ 5. To implement U(2) gates, a series of multi-controlled R z gates should be implemented on control wirelines. Thus, on the ( n -1)th wireline we have to implement C n -1 -R z ( δ ) gate, which implies use of 16( n -1) -40 C-NOTs. On the ( n -2)th wireline we implement C n -2 -R z ( δ/ 2) utilizing 16( n -2) -40 C-NOTs. Finally, we implement the circuit with (16 · 4 -40) C-NOTs on the first five qubits. The total number of C-NOT gates employed in MCU is:

$$& ( 1 6 n - 4 0 ) + ( 1 6 ( n - 1 ) - 4 0 ) + ( 1 6 ( n - 2 ) - 4 0 ) + \cdots + ( 1 6 \cdot 4 - 4 0 ) \\ & = 1 6 ( n + ( n - 1 ) + \cdots + 5 + 4 ) - 4 0 ( n - 3 ) \\ & = 4 ( n - 1 ) ( n - 3 ), & & ( A 1 ) \\ \dots \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot$$

which is the number of C-NOTs used in the QFT-MCU.

Fig. 13 Simplification of LDD-MCU to our QFT-MCU. Pairs of Hadamard gates ( HH = I 2 × 2 ) added to the LDD-MCU are shown by gray-outlined squares ( /square ), where the two constant phase gates ± iI 2 × 2 are given by small gray squares ( /squaresolid ).

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00935v4-figure-ef574053-6414-4c28-b1d1-6da3e9b2a3dc.jpg)

Acknowledgements. This work was financially supported by the Ministry of Science, Technological Development and Innovation of the Republic of Serbia under contract number: 451-03-65/2024-03/200103.

## References

- [1] Preskill, J.: Quantum Computing in the NISQ era and beyond. Quantum 2 , 79(2018). https://doi.org/10.22331/q-2018-08-06-79
- [2] Kim, Y., Eddins, A., Anand, S., Wei, K.X., van den Berg, E., Rosenblatt, S., Nayfeh, H., Wu, Y., Zaletel, M., Temme, K., Kandala, A.: Evidence for the utility of quantum computing before fault tolerance. Nature 618 , 500-505 (2023). https://doi.org/10.1038/s41586-023-06096-3
- [3] Plesch, M., Brukner, ˇ .: C Quantum-state preparation with universal gate decompositions. Phys. Rev. A 83 (3), 032302 (2011). https://doi.org/10.1103/ PhysRevA.83.032302
- [4] Zhang, X.-M., Yung, M.-H., Yuan, X.: Low-depth quantum state preparation. Phys. Rev. Res. 3 (4), 043200 (2021). https://doi.org/10.1103/PhysRevResearch. 3.043200

| [5]   | Araujo, I.F., Park, D.K., Petruccione, F., da Silva, A.J.: A divide-and-conquer algorithm for quantum state preparation. Sci. Rep. 11 (1), 6329 (2021). https:// doi.org/10.1038/s41598-021-85474-1                                     |
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [6]   | Barenco, A., Bennett, C.H., Cleve, R., DiVincenzo, D.P., Shor, P., Sleator, T., Smolin, J.A., Weinfurter, H.: Elementary gates for quantum computation. Phys. Rev. A 52 (5), 3457-3467 (1995). https://doi.org/10.1103/PhysRevA.52.3457 |
| [7]   | Nielsen, M.C., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, New York (2010). ISBN 978-1-107-00217-3                                                                                           |
| [8]   | Shende, V.V., Bullock, S.S., Markov, I.L.: Synthesis of quantum-logic circuits. IEEE Transactions on CAD 25 (6), 1000-1010 (2006). https://doi.org/10.1109/ TCAD.2005.855930                                                            |
| [9]   | Malvetti, E., Iten, R., Colbeck, R.: Quantum circuits for sparse isometries. Quantum 5 , 412 (2021). https://doi.org/10.22331/q-2021-03-15-412                                                                                          |
| [10]  | Bae, J.-H., Alsing, P.M., Ahn, D., Miller, W.A.: Quantum circuit optimization using quantum Karnaugh map. Sci. Rep. 10 (1), 15651 (2020). https://doi.org/ 10.1038/s41598-020-72469-7                                                   |
| [11]  | de Brugi`re, e T.G., Baboulin, M., Valiron, B., Martiel, S., Allouche, C.: Reducing the depth of linear reversible quantum circuits. IEEE Trans. Quantum Eng. 2 , 3102422 (2021). https://doi.org/10.1109/TQE.2021.3091648              |
| [12]  | Cuomo, D., Caleffi, M., Krsulich, K., Tramonto, F., Agliardi, G., Prati, E., Cac- ciapuoti, A.S.: Optimized compiler for distributed quantum computing. ACM T. Quantum Comput. 4 (2), 15 (2023). https://doi.org/10.1145/3579367        |
| [13]  | Saeedi, M., Pedram, M.: Linear-depth quantum circuits for n -qubit Toffoli gates with no ancilla. Phys. Rev. A 87 (6), 062318 (2013). https://doi.org/10.1103/ PhysRevA.87.062318                                                       |
| [14]  | Maslov, D.: Advantages of using relative-phase Toffoli gates with an application to multiple control Toffoli optimization. Phys. Rev. A 93 (2), 022311 (2016). https:// doi.org/10.1103/PhysRevA.93.022311                              |
| [15]  | Jun, J.-M., Choi, I.-C.: Optimal multi-bit Toffoli gate synthesis. IEEE Access 11 , 27342-27351 (2023). https://doi.org/10.1109/ACCESS.2023.3243798                                                                                     |
| [16]  | da Silva, A.J., Park, D.K.: Linear-depth quantum circuits for multiqubit con- trolled gates. Phys. Rev. A 106 (4), 042602 (2022). https://doi.org/10.1103/ PhysRevA.106.042602                                                          |
| [17]  | Vale, R., Azevedo, T.M.D., Ara´jo, u I.C.S., Araujo, I.F., da Silva, A.J.: Circuit                                                                                                                                                      |

decomposition of multicontrolled special unitary single-qubit gates. IEEE Transactions on CAD 43 (3), 802-811 (2023). https://doi.org/10.1109/TCAD.2023. 3327102

- [18] Silva, J.D.S., Azevedo, T.M.D., Araujo, I.F., da Silva, A.J.: Linear decomposition of approximate multi-controlled single qubit gates (2023). https://doi.org/ 10.48550/arXiv.2310.14974
- [19] 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. 56 , 23502361 (2017). https://doi.org/10.1007/s10773-017-3389-4
- [20] Balauca, S., Arusoaie , A.: Efficient constructions for simulating multi controlled quantum gates. In: Groen, D., de Mulatier, C., Paszynski, M., Krzhizhanovskaya, V.V., Dongarra, J.J., Sloot, P.M.A. (eds.) Computational Science ICCS 2022, vol. 13353, pp. 179-194. Springer International Publishing, Cham (2022) ISBN 978-3-031-08759-2 https://doi.org/https://doi.org/10.1007/ 978-3-031-08760-8 16
- [21] Arsoski, V.V.: Implementing multi-controlled X gates using the quantum Fourier transform. Quantum Inf. Process. 23 , 305 (2024). https://doi.org/10.1007/ s11128-024-04511-w
- [22] Draper, T.G.: Addition on a Quantum Computer (2000). https://doi.org/10. 48550/arXiv.quant-ph/0008033
- [23] Barenco, A., Ekert, A., Suominen, K.-A., T¨ orm¨, a P.: Approximate quantum Fourier transform and decoherence. Phys. Rev. A 54 (1), 139-146 (1996). https:// doi.org/10.1103/PhysRevA.54.139
- [24] Maslov, D.: Linear depth stabilizer and quantum Fourier transformation circuits with no auxiliary qubits in finite-neighbor quantum architectures. Phys. Rev. A 76 (5), 052310 (2007). https://doi.org/10.1103/PhysRevA.76.052310
- [25] Iten, R., Colbeck, R., Kukuljan, I., Home, J., Christandl, M.: Quantum circuits for isometries. Phys. Rev. A 93 (5), 032318 (2016). https://doi.org/10.1103/ PhysRevA.93.032318
- [26] https://pypi.org/project/qiskit/
- [27] https://github.com/Arsoski/qccirc.git
- [28] Zheng, W., Zhang, Y., Dong, Y., Xu, J., Wang, Z., Wang, X., Li, Y., Lan, D., Zhao, J., Li, S., Tan, X., Yu, Y.: Optimal control of stimulated Raman adiabatic passage in a superconducting qudit. Npj Quantum Inf. 8 (1), 9 (2022). https:// doi.org/10.1038/s41534-022-00521-7

[29] Saha, A., Majumdar, D., Saha, D., Chakrabarti, A., Sur-Kolay, S.: Asymptotically improved circuit for a d -ary Grover's algorithm with advanced decomposition of the n -qudit Toffoli gate. Phys. Rev. A 105 (6), 062453 (2022). https://doi.org/10. 1103/PhysRevA.105.062453
Vladimir V. Arsoski
Multi-controlled single-qubit unitary gates based on the quantum Fourier transform and deep decomposition
We will present a few new generalizations of the multi-controlled X (MCX)
gate that uses the quantum Fourier transform (QFT). Firstly, we will optimize
QFT-MCX and prove that it is equivalent to a stair MCX gates array. This
stair-wise structure will allow us to devise a method for adding an arbitrary
phase factor to each qubit. The first MCX generalization into multi-controlled
unitary gates (MCU) relies on replacing phase gates acting on the target qubit
with controlled unitary gates. We will employ alternative single-qubit gate
notation to minimize the complexities of these gates and show how to expand the
circuit straightforwardly to the multi-controlled multi-target (MCMT) gate. The
second generalization relies on the ZYZ-like decomposition. We will show that
by extending one QFT-MCX circuit we implement the two multi-controlled X gates
needed for the decomposition. Finally, we will split control wirelines into
groups and use iterative ZYZ-like decomposition on QFT-MCU to obtain "deep
decomposed" (DD) MCU which employs a lower number of C-NOTs than the previous
two, thus making DD-MCU less prone to decoherence and noise. The supremacy of
our implementations over the best-known optimized algorithm will be
demonstrated by emulating noisy quantum calculations.