- Research
- Open access
- Published:

# Efficient realization of quantum algorithms with qudits

*EPJ Quantum Technology*
**volume 11**, Article number: 43 (2024)

## Abstract

The development of a universal fault-tolerant quantum computer that can solve efficiently various difficult computational problems is an outstanding challenge for science and technology. In this work, we propose a technique for an efficient implementation of quantum algorithms with multilevel quantum systems (qudits). Our method uses a transpilation of a circuit in the standard qubit form, which depends on the characteristics of a qudit-based processor, such as the number of available qudits and the number of accessible levels. This approach provides a qubit-to-qudit mapping and comparison to a standard realization of quantum algorithms highlighting potential advantages of qudits. We provide an explicit scheme of transpiling qubit circuits into sequences of single-qudit and two-qudit gates taken from a particular universal set. We then illustrate our method by considering an example of an efficient implementation of a 6-qubit quantum algorithm with qudits. In this particular example, we demonstrate how using qudits allows a decreasing amount of two-body interactions in the qubit circuit implementation. We expect that our findings are of relevance for ongoing experiments with noisy intermediate-scale quantum devices that operate with information carriers allowing qudit encodings, such as trapped ions and neutral atoms, as well as optical and solid-state systems.

## 1 Introduction

Progress in engineering coherent quantum many-body systems with a significant degree of control makes it realistic to study properties of exotic quantum phases [1–6] and to prototype quantum algorithms [7–10]. One of the key issue in the future scaling of such systems is preserving their coherent properties when the system size is increased. Existing prototypes of quantum computing devices are based on various physical platforms, such as superconducting circuits [5], semiconductor quantum dots [11–13], trapped ions [3, 6, 9], neutral atoms [1, 2, 4], photons [14, 15], etc. The use of such objects as two-level systems (qubits) in many cases is an idealization since underlying physical systems are essentially multilevel. The idea of using additional levels of quantum objects for realizing quantum algorithms is at the heart of *qudit-based* quantum information processing. This approach has been widely studied last decades [16, 17], both theoretically and experimentally [18–60]. The most recent result is the pioneering realization of universal multi-qudit processors with trapped ions [61–63], superconducting [59, 64] and optical systems [65].

Although manipulating with additional levels faces additional challenges, recent experiments show dramatic progress in increasing the fidelities of qudit operations and making them comparable with the ones for qubits. In particular, high-fidelity qutrit CZ and \(\mathsf{CZ^{\dagger}}\) gates, with estimated process fidelities of 97.3(1)% and 95.2(3)%, respectively, have been recently demonstrated in Ref. [59]. Also with superconducting systems, fidelity of 97.7% for two-qutrit CPHASE gate have been achieved [64]. Two qudit MVCXd gate on two photonic ququarts has been implemented with fidelity 95.2% in [65]. For the trapped ion platform, on which a qudit processor with 8-level qudits was developed, two-qutrit gate fidelity 97.5(2)% has been achieved [61]. Remarkably, 8-level qudits are controlled by a single laser acousto-optic modulator (AOM) as reported in Ref. [61]

Quantum algorithms within the digital quantum computing model can be presented as qubit-based circuits, so there are several approaches for processing them using qudits. First of all, qudits can be decomposed of a set of qubits [19–21, 36, 37, 66]. This approach may decrease the cost of realizing quantum algorithms by replacing some two-qubit operations requiring interaction between distinct physical objects by single-qudit ones, which do not require an interaction between distinct physical objects. However, this method is not universal in the sense that the total number of operations strongly depends on the *mapping*, *i.e.* the way how qubits are encoded in qudits. As we demonstrate below, specific mappings applied to specific qubit circuits may even lead to a substantial increase in the number of operations in comparison with the standard qubit-based approach. Second, higher qudit levels can be used for substituting ancilla qubits [30, 41, 67, 68]. This is especially important for decomposing multiqubit gates, such as the generalized Toffoli gate. In particular, an additional (third) energy level of a transmon qubit has been used in the experimental realization of Toffoli gate [47] (see also Refs. [69, 70]), which is a key primitive of many quantum algorithms, such as Shor’s and Grovers’s algorithms. While existing quantum computing schemes that are based on qubits platform benefit from several approaches for the realization of quantum algorithms, which require compilers, transpilers, and optimizers, qudit-based quantum computing remains described mostly at the level of logic operations [71].

In the present work, we propose a technique for an efficient realization of qubit-based quantum algorithms, which employs the combination of two aforementioned approaches for the use of additional levels of qudits. The crucial element of our method is a transpilation of a qubit circuit, which depends on the parameters of an accessible qudit-based processor (e.g., number of levels and fidelity of operations). As a result, one obtains qubit-to-qudit mapping and comparison to the standard qudit realization. A qudit circuit can be executed via quantum processors or classical emulators, and corresponding outcomes can be further post-processed in order to be interpreted as results of an algorithm. Clearly, due to exponential complexity, classical emulation is possible only in the case of low-width or low-depth circuits. We develop an explicit scheme of transpiling qubit circuits into sequences of single-qudit and two-qudit gates taken from a particular universal set, which can be different for quantum processors based on various physical platforms. We provide an illustrative example of the qudit-based transpilation for a six-qubit quantum circuit, where we demonstrate the main features of our approach. We also discuss types of quantum algorithms, where the developed approach can show the greatest improvement compared with a straightforward qubit-based implementation.

The paper is organized as follows. In Sect. 2, we revise the basic principles of quantum computing with qubits. In Sect. 3, we discuss the general approach for implementing qubit circuit on qudit-based processors. In Sect. 4, we provide a concrete realization of a qudit-based transpiler. In Sect. 5, we present an example of applying the developed approach for realizing 6-qubit circuits with four 4-level qudits. In Sect. 6, we discuss the scalability of the developed approach and its most promising use cases. Finally, we conclude in Sect. 7.

## 2 Qubit-based approach

The essence of qubit-based quantum computation is applying a unitary operator \(U^{\mathrm{qb}}_{\mathrm{circ}}\) to a set of *n* two-level particles (qubits), initialized in the fixed state \(\vert 0\rangle ^{\otimes n}\), and the measuring the resulting state in the computational basis to obtain a sample from the following distribution:

Here we denote computational basis states of qubits as \(\vert 0\rangle \) and \(\vert 1\rangle \), \(\vert x\rangle \equiv \vert x_{0}\rangle \otimes \cdots \otimes \vert x_{n-1}\rangle \), and \(x=(x_{0},\ldots,x_{n-1})\in \{0,1\}^{n}\). Commonly, the same circuit is executed several times, which results in a sequence of independent and identically distributed (i.i.d.) random *n*-bit strings \((x^{(1)},\ldots,x^{(N)})\), where *N* is the number of samples, and each sample \(x^{(i)}\) is obtained from distribution (1).

The operator \(U^{\mathrm{qb}}_{\mathrm{circ}}\) is originally represented in the form of a sequence of some standard unitary operators (gates) \(U_{i}^{\mathrm{qb}}\) constituting hardware-agnostic (idealized) circuit \({\mathsf{circ}}^{\mathrm{qb}}\). For applying \(U^{\mathrm{qb}}_{\mathrm{circ}}\) to real physical objects, an additional *transpilation* step of decomposing \(U^{\mathrm{qb}}_{\mathrm{circ}}\) to *native* (usually, single-qubit and two-qubit) operations is required [71–73]. One of DiVincenzo’s criteria [74] to quantum processors is the requirement to realize a universal set of gates that allows obtaining an efficient approximation of an arbitrary unitary operation up to a predefined accuracy. Although multiqubit processors based on various physical principles have been demonstrated, the problem of limited quality of quantum operations restricts the computational capabilities of such systems [75]. A particular issue is the realization of high-quality two-qubit quantum operations that require interactions between quantum information carriers. Another important factor that has to be taken into account, is the restricted coupling map of information carriers, which represents the opportunity to implement two-body interactions. This issue can be overcome by adding additions SWAP operations. However, this problem is beyond the scope of our work, and further we suppose that the quantum processor has an all-to-all coupling map.

## 3 Quantum computing with qudits

The idea of using of qudits, i.e. *d*-level quantum systems with \(d>2\), have been widely considered in the context of quantum information processing [18–31, 33–56]. Clearly, an *m*-qudit system can be used in order to obtain the same result as in the case of qubit-based computing—obtaining the number of samples coming from the distribution determined by an *n*-qubit circuit, but potentially with fewer resources, e.g. smaller number of information carriers and/or operations. The dimension of qudits and their number has to be compatible with the given *n*-qubit circuit. In what follows, we assume that \(d^{m} \geq 2^{n}\).

A specific question that we are interested in is a transpilation of a circuit given in the qubit form depending on the parameters of a qudit-based processor. A scheme of our approach is presented in Fig. 1. It consists of the three following stages: (i) qubit-to-qudit circuit transpilation, (ii) circuit execution, and (iii) classical post-processing of the measurement results. We note that stages (i) and (iii) are performed with a classical computer, while stage (ii) is realized with an accessible qudit-based processor or its classical software emulator.

The input for our scheme is a hardware-agnostic qubit circuit \({\mathsf{circ}}^{\mathrm{qb}}\), necessary runs number *N*, and the general information about the accessible qudit-based processor, specifically, the number of qudits *m*, their dimension *d*, and the set of native gates (usually, it consists of single-qudit gates and a set of two-qudit gates within a certain connectivity graph indicating the possibility of direct realization of a two-qubit/two-qudit operation). The output of the transpilation step is an ‘optimized’ qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}\), which is a sequence of native qudit gates, and an ‘optimized qubit-to-qudit mapping’ that is an injective function

assigning a qudit’s computational basis state to each of the qubits’ ones. The general idea is that running of \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}\) and processing the output measurement outcomes according to \(\phi _{\mathrm{opt}}\) provides bitstrings equivalent to ones obtained after running \({\mathsf{circ}}^{\mathrm{qb}}\) on a standard qubit-based quantum processor (we formulate the rigorous consistency condition below). The term optimized appears here because various qubit-to-qudit mappings, which are assignments between qubits’ and qudits’ levels, result in different qudit-based circuits that are equivalent to the input qubit-based circuit under a particular mapping. In this way, the goal of the qudit-based transpiler consists not only in transforming qubit gates of \({\mathsf{circ}}^{\mathrm{qb}}\) to native qudit ones but also in finding a favorable mapping such that the realization of the resulting qudit-based circuit is beneficial over the straightforward realization of \({\mathsf{circ}}^{\mathrm{qb}}\) on a qubit-based processor. We note that the optimized mapping depends both on the input circuit (it can be different for different circuits) and the architecture of the accessible qudit-based processor.

The desirable characteristics of the mapping can be defined in different ways. Below, we consider a particular implementation of a qudit-based transpiler, where we use the number of two-qudit interactions as the main figure of merit for quantifying the performance of the transpilation (see Sect. 4). The reason for this is that usually, two-body gates are the main source of errors during the process of executing quantum circuits. Nevertheless, alternative metrics, such as circuit depth or resulting fidelity estimation, can be used.

To achieve the goal of reducing the number of two-body gates in going from qubits to qudits, two main techniques, as well as their combination, can be implemented. The first technique [19–21, 36, 37], employs a qudit’s *d*-dimensional space for embedding several qubits (the technique works for \(d\geq 2^{m'}\) with \(m'>1\)). Its main advantage is the possibility to reduce the number of employed physical information carriers (e.g., particles, such as atoms or ions). However, as we show in Sect. 4, this method is not universal in the sense that the total number of operations strongly depends on the mapping, i.e. the way how qubits are embedded in qudits. It appears that the cost of the realization of two-qubit operations between two qubits inside one qudit may be close to a couple of single-qudit operations, since it does not require any interaction between distinct physical particles. In contrast, in the realization of a two-qubit operation between qubits belonging to different qudits, additional entangling operations are required to presume the state of other qubits inside these qudits but untouched by the two-qubit gate.

The second technique is to use ‘upper’ qudit levels (\(\vert \mathrm{a}\rangle \), \(a\geq 2\)) for substituting ancillary qubits within standard multiqubit gates decompositions [30, 41, 46, 67, 68]. This approach allows decreasing both the number of required two-body interactions (entangling gates) and the number of employed quantum information carriers by removing the necessity of ancillary qubits and is useful in the case of quantum circuits containing multiqubit gates. We would like to note that these two approaches can be combined in the case of \(d>2^{t}\) for some \(t\geq 2\): The first \(2^{t}\) levels of a qudit can be used for embedding \(\lfloor \log _{2} d\rfloor \) qubits, while the remaining ones can be used for subsisting ancillas.

There are two main aspects regarding the qudit-based transpilation. The first is related to the possibility of realizing qudit gates. As for qubits, a universal set of gates can be composed of arbitrary single-qudit gates, supplemented with a two-qudit entangling gate of a particular type. One of the approaches for making this two-qudit gate is to employ the original two-qubit gate (used within the qubit-based architecture), yet considered in the full qudit state space. We note that this approach has been successfully demonstrated in experiments with trapped ions, and it has been shown that the resulting gate fidelities are comparable with the ones for corresponding qubit-based architectures [61, 62].

The second aspect is related to finding an appropriate qubit-to-qudit mapping. In the case of small- and intermediate-scale circuits, one may use an exhaustive search through all possible mappings. However, this approach requires significant classical computational resources for large-scale circuits. In this case, one is sufficed to find a mapping that is not the best possible one, but still gives the lower number of two-body gates compared to the standard qubit implementation (or gives a higher fidelity). If the number of available qudits *m* is not less than the number of qubits in the input circuit *n*, then it can be assured that the number of two-qudit gates in the resulting qudit circuit does not exceed the number of two-qubit gates in the input circuit. This follows from the fact that there is a trivial mapping, where each qubit is embedded in its own qudit. In the qutrit case (\(d=3\)) and \(m\geq n\), there is no problem with searching for the appropriate mapping: One can employ *n* qutrits, each used as a qubit plus the ancillary state. For more complex embeddings of qubits in qudits we describe several approaches of the optimized mapping finding algorithms in Sect. 4.1. The comparison between the number of two-body gates for the best-found mapping with the number of two-body gates for the straightforward qubit-based implementation can serve as a benchmark for the efficiency of the qudit-based transpilation process and could be placed in the supporting information.

Let us back to the description of the main stages of running the qubit-based circuit with the qudit-based processor shown in Fig. 1. At stage (ii), the qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}\) is the input for the qudit-based processor (or emulator) that applies the gates from \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}\) to the qudit register initialized in the state \(\vert 0\rangle ^{\otimes m}\), where we use \(\{ \vert l\rangle \}_{l=0}^{d-1}\) to denote computational basis states of each qudit. The resulting qudit state is measured in the computational basis, and a sample from the following distribution is obtained:

where \(U_{\mathrm{circ}}^{\mathrm{qd}}\) is the resulting qudit unitary operator, \(y=(y_{0},\ldots,y_{m-1})\), \(y_{i}\in \{0,\ldots,d-1\}\), and \(\vert y\rangle \equiv \vert y_{0}\rangle \otimes \cdots \otimes \vert y_{m-1}\rangle \). The circuit is run *N* times, that yields a *N*-length sequence \((y^{(1)},\ldots,y^{(N)})\), where each \(y^{(i)}\) is the string of *m* numbers from \(\{0,\ldots,d-1\}\).

The final post-processing stage takes the read-out results \((y^{(1)},\ldots,y^{(N)})\) and a mapping *ϕ* in order to obtain equivalent qubit outcomes \((\phi ^{-1}(y^{(1)}),\ldots,\phi ^{-1}(y^{(N)}))\) as output, where \(\phi ^{-1}\) outputs *n*-length bit strings out of \(y^{(i)}\). The general condition for the scheme’s correctness is as follows:

where \({\mathrm{image}}(\phi )\) is the set of all possible outputs of the mapping *ϕ*. The consistency condition (4) guarantees that only \(y\in {\mathrm{image}}(\phi )\) can appear as measurements results of the qudit circuit, and the obtained bit strings \((\phi ^{-1}(y^{(1)}),\ldots,\phi ^{-1}(y^{(N)}))\) are indistinguishable from ones that can be obtained with a qubit-based processor. The set of bitstrings \((\phi ^{-1}(y^{(1)}),\ldots,\phi ^{-1}(y^{(N)}))\) together with the supporting information is the final output of our approach. One can see that from the viewpoint of classical processing, the most challenging is the qudit-based transpilation stage. We discuss it in detail below.

## 4 Qudit-based transpilation

Here we describe the concrete realization of the qudit-based transpiler designed for a specific model of a qudit-based processor. We assume that the available processor consists of *m* *d*-dimensional qudits, labeled as \({\mathsf{Q}}1,\ldots,{\mathsf{Q}}m\). As a set of native qudit gates, we consider single-qudit operations

where \(e^{\imath \theta}\) is located in *α*th position, and a two-qudit operation

which applies a fixed phase factor −1 to the pair of levels given by *α* and *β*. Here we use the following notations:

\(\sigma _{x}\), \(\sigma _{y}\), \(\sigma _{z}\) are standard single-qubit Pauli matrices, \(\alpha,\beta \in \{0,\ldots, d-1\}\) denote levels in qudits’ space, \(\varphi,\theta \) are real-valued arbitrary angles, and \mathbb{1} stands for the identity matrix. In what follows, we use subindices over unitary operators to specify quantum information carriers or carriers (qubits or qudits) on which this operator acts. We assume that two-qudit gates can be implemented for every pair of qudits within the all-to-all coupling map. Note that \({\mathsf{CZ}}^{1,1}_{{\mathsf{Q}}j_{1}, {\mathsf{Q}}j_{2}}\) realizes a standard qubit controlled-phase gate acting in the four-dimensional subspace spanned by the first two levels of \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\), and acts as identity in the remaining subspace. Moreover, \({\mathsf{CZ}}^{\alpha,\beta }_{{\mathsf{Q}}j_{1}, {\mathsf{Q}}j_{2}}\) with arbitrary *α* and *β* can be realized by surrounding a single instance of \({\mathsf{CZ}}^{1,1}_{{\mathsf{Q}}j_{1}, {\mathsf{Q}}j_{2}}\) with single-qudit operations.

We note that to realize the considered single-qudit gates in Eq. (5), it is enough to have a connected (but not fully connected) coupling graph of allowed transitions between levels, as shown in Ref. [76]. Knowing the exact coupling map between levels, single-qudit operations can be easily reformulated in terms of accessible transitions. This is the case for superconducting [77, 78], ion-based [43, 61, 62], and neutral-atom-based [60] qudits. Moreover, in real existing experimental setups, transitions within a given coupling graph are usually addressed with a single laser. For example, in Ref. [61], 10 allowed transitions inside 8-level qudit realized by \({}^{40}{\mathrm{Ca}}^{+}\) ions are accessed by a single narrowband laser at 729 nm with AOM. The employed two-qudit gate (6) can be realized via Rydberg blockade neutral atom-based [60] qudits, and via common quantized motion mode in ion-based platform [79].

The input for the designed transpiler *n*-qubit hardware-agnostic qubit circuit \({\mathsf{circ}}^{\mathrm{qb}}\), acting on qubits denoted by \({\mathsf{q}}1,\ldots,{\mathsf{q}}n\), is assumed to consist of single-qubit gates

where \(\sigma _{\varphi}=\sigma _{x}\cos \varphi +\sigma _{y}\sin \varphi \), and a *κ*-qubit gates

with \(\kappa \in \{2,3,\ldots,n\}\). One can see that multi-body operations (9) and (6) correspond to acquiring a phase factor of −1 on a particular multi-body state. We note that a multi-qubit operation (9) can be transformed into a generalized Toffoli gate by applying single-qubit gates. We also note that both the considered qudit-based and qubit-based sets of gates are universal.

Without loss of generality, we assume that \({\mathsf{circ}}^{\mathrm{qb}}\) terminates with read-out measurements in a computational basis acting on each of *n* qubits. The initial state of the qubit register is assumed to be \(\vert 0\rangle ^{\otimes n}\). We note, however, that the developing technique of transforming qubit gates into qudit gates is independent of the chosen initial state, and can be applied in the same way within other types of initialization.

For possible mappings between qubits’ and qudits’ spaces, we restrict ourselves with embeddings of the whole computational space of one or several qubits into a space of a particular qudit. Specifically, each possible mapping *ϕ* can be defined in the following form:

meaning that qudit Q*j* contains #*j* qubits \({\mathsf{q}}i_{j,1},\ldots,{\mathsf{q}}i_{j,\#j}\) (given that the condition \(2^{\#j}\leq d\) is fulfilled). The assignment of computational basis states of qubits to computational basis states of qudits is governed by the corresponding binary representation:

where \(x_{1},\ldots, x_{\#j}\in \{0,1\}\) are bit values and \({\mathrm{int}}(x_{1},\ldots,x_{\#j})\in \{0,1,\ldots,2^{\#j}-1\}\) outputs an integer number from its binary representation \(x_{1},\ldots, x_{\#j}\). We note that within the considered mappings, the ‘address’ of each qubit is defined by an index of qudit \({\mathsf{Q}}j\in \{{\mathsf{Q}}1,\ldots,{\mathsf{Q}}m\}\) and a ‘position’ \({\mathsf{pos}}\in \{1,\ldots,\#j\}\) of the qubit inside the qudit. An example of a possible mapping between \(n=5\) qubits and \(m=3\) qudits of the dimension \(d=5\) is shown in Fig. 2.

To simplify operations within the considered special case of mapping *ϕ*, it is convenient to introduce the following functions:

where the first two functions provide the address of a given qubit with the qudits’ space, and the third function returns an index of a qubit given its address. We also introduce the following functions:

that return indices of qubits located in a given qudit and the total number of qubits in a given qudit correspondingly.

The considered ‘qubit-to-qudit’ mapping, in particular Eq. (10), implies that the computational basis measurement at the end of the qubit circuit corresponds to a computational basis measurement of qudits, also assumed to be realizable on the qudit-based processor.

The developed qudit transpiler consists of two modules: (i) the mapping finder and (ii) the qudit circuit constructor (see Fig. 3). Both of them take as input a qudit processor description (values of *m* and *d*) and a hardware-agnostic qubit-based circuit \({\mathsf{circ}}^{\mathrm{qb}}\). The goal of the mapping finder is to search for mapping \(\phi _{\mathrm{opt}}\in \{ \phi \}\), which minimizes a chosen figure of merit, while the purpose of the qudit circuit constructor is to generate a qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) that is equivalent to \({\mathsf{circ}}^{\mathrm{qb}}\) under a mapping *ϕ*. Finally, the qudit-based transpiler outputs the optimized mapping \(\phi _{\mathrm{opt}}\) and the corresponding circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}:={\mathsf{circ}}^{\mathrm{qd}}_{\phi _{\mathrm{opt}}}\). The mapping finder can also output some supporting information, which contains, e.g., the exact number of single and two-qudit gates in \({\mathsf{circ}}^{\mathrm{qd}}_{\mathrm{opt}}\) and its comparison with the number of single- and two-qubit gates is in the qubit circuit \({\mathsf{circ}}^{\mathrm{qb}}_{\mathrm{stand}}\) resulted from the standard qubit-based transpilation of \({\mathsf{circ}}^{\mathrm{qb}}\). Below we describe the operation of modules in more detail.

### 4.1 Mapping finder

Here we introduce several approaches of how the optimized qubit-to-qudit mapping can be obtained. As a figure of merit for a mapping *ϕ* we consider the number of two-qudit gates in \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\). This choice is motivated by the fact that entangling gates typically represent the main source of fidelity loss. However, as mentioned before, one can alternative other figures of merits, e.g., circuit depth or fidelity estimations, which can be efficiently calculated given the classical representation of the corresponding qudit-based circuit.

#### 4.1.1 Finding the optimal mapping with an exhaustive search

The straightforward way for optimizing qubit-to-qudit mapping is to employ an exhaustive search over all possible mappings \(\Phi \equiv \{\phi \}\) of the form Eq. (10). This approach is applicable if the number of available qudits *m* and their dimension *d* are reasonably small.

The first step of the exhaustive search is to construct a set of all non-equivalent mappings \(\widetilde{\Phi} \subset \Phi \). Here we call two mappings equivalent if they are different only up to permutations of qubits indices within a particular qudit, or up to permutation of whole sets of qubits’ indices belonging to different qudits (and thus definitely provide the same number of entangling gates). Then, the mapping finder sequentially inputs each \(\phi \in \widetilde{\Phi}\) to the qudit circuit constructor to get the corresponding qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\). By comparison of two-qudit gate numbers in \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) while going through all mappings, the mapping finder chooses the one (\(\phi _{\mathrm{opt}}\)), which provides the smallest number of two-qudit gates.

As we show below, the complexity of generating \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) is linear with respect to the number of gates in the original qubit-based circuit \({\mathsf{circ}}^{\mathrm{qb}}\), so the possible bottleneck is in the number of mappings in Φ̃. We note that this issue does not appear in the case of qutrits (\(d=3\)), where there is only a single non-equivalent mapping: each qubit q*i* is mapped to a qutrit Q*i*.

In Fig. 4 we show the behavior of the total number of non-equivalent mappings \(|\widetilde{\Phi}|\) for different values of *n* and \(d\geq 4\). Given the fact for \(d\leq 31\) and \(n \leq 7\), the resulting number of non-equivalent mappings is no more than thousand, it is possible to go through all \(\phi \in \widetilde{\Phi}\) within a reasonable time. We note that in Fig. 4 we take the number of qudits *m* to be equal to the number of qubits *n*, to maximize the number of possible mappings. Since we deal with a special case of mappings, where each qubit is entirely embedded in a single qudit, the number of mappings for different qudit dimensions taken from a range \(d=2^{n'},\ldots,2^{n'+1}-1\) for certain \(n'\) is the same.

#### 4.1.2 Searching for optimized mappings with polynomial heuristic algorithms

When the exhaustive search is not applicable, some approximate polynomial methods can be employed. We emphasize that the problem of finding a mapping from Φ, providing an advantage of using a qudit-based approach compared to the standard qubit-based approach, is much easier than finding the best mapping among all mappings in Φ. Indeed, in the case of \(m\geq n\), the one-to-one mapping \(\phi ^{(0)}\) definitely provides no more entangling gates compared to the standard qubit-based transpilation, since upper qudit levels are used only for multiqubit gates decomposition. We emphize that in the case of \(\phi ^{(0)}\), two-qubit entangling CZ gates from the input qubit circuit are realized within the qudit-based version exactly in the same way as in the qubit-based one. If the input qubit circuit has at least one Toffoli gate, then the number of entangling gates in the corresponding qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\phi ^{(0)}}\) is strictly smaller compared to the one in the standard qubit-based transpilation result \({\mathsf{circ}}^{\mathrm{qb}}_{\mathrm{stand}}\). Comparing \(\phi ^{(0)}\) with some *limited number* candidates from Φ definitely doesn’t make things worse. In the case of \(m< n\), yet \(m \lfloor \log _{2} d \rfloor \geq n\), the developed qudit-based transpilation method makes it possible to run an *n*-qubit circuit with *m* *d*-level qudits, which is not possible with *m* qubits at all.

In the case of \(m\geq n\), the choice of candidates from Φ can be directed by the following observations. First, it is advisable to consider embedding a pair of two qubits into the space of a single qudit, if there is a relatively huge amount of two-qubit gates connecting these qubits within the given circuit, and there is a relatively small amount of gates affecting each of these qubits separately. Second, it is reasonable to put qubits affected by multiqubit gates into qudits with free upper levels to use these levels as ancillas for multiqubit gates decomposition.

One can also consider an iterative “greedy” approach of \({\mathrm{poly}}(n)\) complexity for finding an optimized mapping, where a sequential joining of qubits in the space of qudit is considered. We sketch the idea for the case of \(m\geq n\) and \(d=4,\ldots,7\) (each qudit can embed no more than two qubits). Initially, the one-to-one mapping \(\phi ^{(0)}\) is considered, and the resulting number of entangling gates \({\mathcal{N}}_{\mathrm{ent}}^{(0)}\) is stored. At the first step, all \(n(n-1)/2\) mappings, where one qudit embeds a qubit pair and \(n-2\) other qudits embed remaining \(n-2\) qubits are considered. If the minimal number of entangling gates among these mappings \({\mathcal{N}}_{\mathrm{ent}}^{(1)}<{\mathcal{N}}_{\mathrm{ent}}^{(0)}\), then the corresponding mapping \(\phi ^{(1)}\) with the fewest entangling gates is chosen as a starting point for the next step. Otherwise, \(\phi _{\mathrm{opt}}:=\phi ^{(0)}\) is the output. In the second step, \((n-2)(n-3)/2\) mappings with two-qubit pairs (the previously selected pair and a newly tested one) are considered, and so on. The algorithm proceeds until the number of entangling gates starts to grow, or a mapping with the maximal number \(\lfloor n/2 \rfloor \) of qubit pairs is obtained. Although this algorithm does not guarantee getting the best possible mapping, it provides the resulting number of entangling gates to be no more than the one for a straightforward qubit-based realization, and the maximal number of iterations scales as \({\mathcal{O}}(n^{3})\). Given the polynomial complexity (in the number of qubits and number of gates) of the transpilation procedure for a given mapping, we obtain a polynomial complexity of the whole qudit-based transpiler.

It is also worth noting an interesting approach for finding a qubit-to-qudit mapping recently proposed in Ref. [80]. The goal of this algorithm is also to lower the number of non-local operations within the realization of qubit circuits with qudits. For this purpose, the authors use a weighted graph representation of a given qubit circuit, where qubit levels represent nodes, graph edges—local and nonlocal operations, and weights—the number of corresponding operations. The authors propose to use an adaption of the *K*-means algorithm to cluster the graph to place edges of the highest weights in distinct clusters. This clusterization is then interpreted in terms of the qubit-to-qudit mapping. We note that this algorithm is applied to input qubit circuits *already transpiled down to single- and two-qubit gates*, and therefore does not utilize the full potential of qudits for operating with multiqubit gates, which of the central features of the approach considered in our work.

### 4.2 Qudit circuit constructor

Here we consider in detail how the qudit circuit constructor transpiles qubit circuit \({\mathsf{circ}}^{\mathrm{qb}}\) to the qudit circuit \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) according to the given qubit-to-qudit mapping *ϕ*. The transpilation process of \({\mathsf{circ}}^{\mathrm{qb}}\) into \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) is performed in a gate-by-gate principle, shown in Fig. 5. At the very beginning of the process, \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\) is initialized as empty. Then, for each gate from the qubit circuit \({\mathsf{circ}}^{\mathrm{qb}}\), the constructor takes a set

of qubits, affected by this gate, and finds the set of corresponding qudits, possessing qubits from \({\mathsf{qubit{\_}set}}\):

We note that \({\mathsf{qudit{\_}set}}\) does not contain duplicates of qudit indices. Thus, the number of elements in \({\mathsf{qudit{\_}set}}\), which we denote by \(|{\mathsf{qudit{\_}set}}|\), can be less than the number of involved qubits *κ* if several affected qubits are located in the space of the same qudit according to the mapping *ϕ*.

The processing of the gate is determined by the value of \(|{\mathsf{qudit{\_}set}}|\). If \(|{\mathsf{qudit{\_}set}}|=1\), then the qubit gate under processing can be realized on the qudit processor as a sequence of single-qudit gates (see Sect. 4.2.1). In the case of \(|{\mathsf{qudit{\_}set}}|>1\), two-qudit gates become necessary. It is convenient to distinguish the case of \(|{\mathsf{qudit{\_}set}}|=2\) and the case of \(|{\mathsf{qudit{\_}set}}|\geq 3\) that we describe in detail in Sects. 4.2.2 and 4.2.3, correspondingly. For all these cases, we obtain a sequence of qudit gates that implement the processed qubit gate. This sequence is added to the end of \({\mathsf{circ}}^{\mathrm{qd}}_{\phi}\), and then the procedure is repeated for the next gate from \({\mathsf{circ}}^{\mathrm{qb}}\) until all gates have been processed. Below we describe the exact decomposition of qubit gates into the sequence of qudit gates for all possible values of \(|{\mathsf{qudit{\_}set}}|\).

#### 4.2.1 Single-qudit case

The case of \(|{\mathsf{qudit{\_}set}}|=1\) can appear in two situations: (i) the processed gate is a single-qubit one (\(\kappa =1\)), and (ii) the processed gate in a multi-qubit (\(\kappa \geq 2\)) with all affected qubits being located in the same qudit according to the mapping *ϕ*.

First, let us consider the case of a single-qubit gate, acting on a qubit \({\mathsf{q}}{i_{1}}\). Let \({\mathsf{Q}}j={\mathsf{qudit\_index}}[{\mathsf{q}}{i_{1}}]\), \({\mathsf{pos}}={\mathsf{position\_in\_qudit}}[{\mathsf{q}}{i_{1}}]\), and \(\#j={\mathsf{number\_of\_qubits}}[{\mathsf{Q}}j]\). Remind that in our realization, the only type of single-qubit gates is rotation \(r_{{\mathsf{q}}i}(\varphi,\theta )\), defined in Eq. (8). To implement this unitary in the qudit’s space, we need to consider a tensor product of a \(2\times 2\) unitary acting in a subspace of affected qubits with an identity operation acting in the remaining space of a qudit. The resulting correspondence between the qubit gate and a sequence of qudit gates is given by

where the product is made over all possible pair levels \((\alpha,\beta )\) satisfying the following condition:

Here \(\operatorname{bin}(\alpha )\) and \(\operatorname{bin}(\beta )\) are #*j*-length binary representation of *α* and *β*, correspondingly (let us remind that \(\alpha,\beta \in \{0,1,\ldots,d-1\}\) and \(\#j \leq \log _{2} d\)), and \(x_{1}\dots x_{{\mathsf{pos}}-1}x_{{\mathsf{pos}}+1}\dots x_{\#j}\) are all possible bitstrings of length \(\#j-1\). The sequence of qudit unitaries, given by Eqs. (16) and (17), is in agreement with the employed structure of qubit-to-qudit mappings shown in Eq. (11) [see also Fig. 6(a) for an intuitive explanation].

Let us then consider the case of a multi-qubit gate \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\), where all qubits \({\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}\) are located in the same qudit Q*j*. Let \({\mathsf{pos}}_{i_{k}}={\mathsf{position\_in\_qudit}}[{\mathsf{q}}{i_{k}}]\) for \(k=1,\ldots,\kappa \). Then the desired gate \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\) can be realized with the following sequence of single-qudit phase gates:

where qudit levels *α* satisfy the following condition:

(here \(\operatorname{bin}(\alpha )[{\mathsf{pos}}_{i_{k}}]\) stands for \({\mathsf{pos}}_{i_{k}}\)th bit in a #*j*-length binary representation of *α*). As in the case of a single-qubit gate, the resulting sequence provides a proper transformation at the required qudit levels [see Fig. 6(b)]. Clearly, the processing of the single-qudit case is of \({\mathcal{O}}(1)\) space and time complexity on a classical computer.

#### 4.2.2 Two-qudit case

Here we consider the case where qubits, which are involved in certain multi-qubit gate \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots,{\mathsf{q}}i_{\kappa}}\), are located (according to *ϕ*) in two different qudits, namely \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\). Let \(\{{\mathsf{pos}}_{1}^{l}\}\) and \(\{{\mathsf{pos}}_{2}^{l'}\}\) be positions, according to \({\mathsf{position\_in\_qudit}}[\cdot ]\), of qubits located at \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\), correspondingly.

As in the case of a single-qubit gate, the resulting transformation performed in the space of two qudits is obtained as a tensor product of the unitary corresponding to \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots,{\mathsf{q}}i_{\kappa}}\) in the proper subspace of the two-qudits space and identity operator in the remaining subspace. This operation reads

where pairs of levels \((\alpha,\beta )\) are all possible admissible pairs satisfying the condition

According to Eqs. (20) and (21), the number of \({\mathsf{CZ}}^{\alpha, \beta}_{{\mathsf{Q}}j_{1}, {\mathsf{Q}}j_{2}}\) gates in the resulting sequence is determined by the number of qubits located in qudits \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\) and *not* involved by \({\mathsf{CZ}}_{{\mathsf{q}}i_{1}, \dots, {\mathsf{q}}i_{\kappa}}\) (see an example for two-qudit case in Fig. 7). Each unused qubit doubles the number of pairs \((\alpha,\beta )\) satisfying Eq. (21), and so the resulting number of two-qudit gates is given by

where \(\#j_{1}\) and \(\#j_{2}\) are the number of qubits in \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\), correspondingly.

Equation (22) captures an intuition behind qudit CZ gate. On the one hand, implementation of, e.g., two-qubit gates (\(\kappa =2\)) in the case where qudits \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\) contain other qubits (\(\#j_{1}+\#j_{2}>2\)) costs more two-body CZ-type interactions than in the case of direct qubit-based realization (\(2^{\#j_{1}+\#j_{2}-1}\) compared to 1). Recall, however, that in the case of the one-to-one mapping \(\phi ^{(0)}\), \(\#j_{1}=\#j_{2}=1\) and \(\kappa =2\), so there in no overhead in the number of entnagling gates. On the other hand, in the case of multi-qubit gates with \(\kappa >2\), the resulting number of two-body CZ-type interactions can become smaller compared to the one obtained from known multi-qubit gates decompositions into single-qubit and two-qubit gates (see e.g. Ref. [81]). We also remind that in the case where all qubits affected by \({\mathsf{CZ}}_{{\mathsf{q}}i_{1}, \dots, {\mathsf{q}}i_{\kappa}}\) fall into the same qudit, there is no need for two-body interactions at all.

As in the single-qudit case, the described processing is of \({\mathcal{O}}(1)\) space and time complexity on a classical computer. We also note that for other types of two-qudit interactions, different from \({\mathsf{CZ}}^{\alpha, \beta }_{{\mathsf{Q}}j_{1}, {\mathsf{Q}}j_{2}}\), Eqs. (20) and (22) have to be modified. For example, as shown in [82], in a trapped-ion platform with native parametric two-qudit Mølmer-Sørensen gate, to implement two-qubit CZ gates (\(\kappa =2\)) in the case, where qudits \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\) contain two qubits each, a single two-qudit Mølmer-Sørensen gate with increased value of effective rotation angle, compared to the rotation angle used within the qubit-based verstion, is needed.

#### 4.2.3 Multi-qudit gate case

Here we describe the most complicated case, where qubits affected by the gate \({\mathsf{CZ}}_{{\mathsf{q}}i_{1}, \dots, {\mathsf{q}}i_{\kappa}}\), fall into more than two qudits. To make the decomposition description more clear, let us introduce new notations. For each qudit Q*j*, we define states \({\vert \underline {0}\rangle }_{{\mathsf{Q}}j}\equiv \vert 0\rangle _{{\mathsf{Q}}j}\) and \({\vert \underline {1}\rangle }_{{\mathsf{Q}}j}\equiv \vert d^{2}-1\rangle _{{\mathsf{Q}}j}\) that corresponds to multi-qubit states \(\vert 0\dots 0\rangle _{{\mathsf{q}}i_{j,1},\ldots,{\mathsf{q}}i_{j,\# j}}\) and \(\vert 1\dots 1\rangle _{{\mathsf{q}}i_{j,1},\ldots,{\mathsf{q}}i_{j,\# j}}\), correspondingly, with respect to the considered mapping *ϕ* (remind that \({\mathsf{q}}i_{j,1},\ldots,{\mathsf{q}}i_{j,\# j}\) denote labels of qubits located in the space of qudit Q*j*). If qudit dimension \(d>2^{\#j}\), we also define an ancillary state \(\vert {\mathrm{a}}\rangle _{{\mathsf{Q}}j}\equiv \vert 2^{\#j}\rangle _{{\mathsf{Q}}j}\) that is beyond the qubits’ subspace in the space of Q*j*, and a flag, indicating whether the ancillary level is available in this qudit:

Let \({\mathsf{qudit\_set}}\) be a set of qudit indices involved in the realization of \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\), see Eq. (15). We assign each qudit from \({\mathsf{qudit{\_}set}}\) to one of three possible types labeled as \({\mathcal{A}}\), \({\mathcal{B}}\), or \({\mathcal{C}}\).

We say that Q*j* belongs to type \({\mathcal{A}}\), if all qubits, located in this qudit, are affected by \({\mathsf{CZ}}_{{\mathsf{q}}i_{1}, \dots, {\mathsf{q}}i_{\kappa}}\) and Q*j* has no ancillary level, that is

where \(\overline{{\mathsf{ancilla}}[{\mathsf{Q}}j]}\) stands for \({\mathsf{ancilla}}[{\mathsf{Q}}j]={\mathsf{False}}\). If all qubits located in qudit Q*j* are involved in the decomposed qubit gate and Q*j* has ancillary level, that is

then we say that qudit Q*j* belongs to type \(\mathcal{B}\). Qudit \({\mathsf{Q}}j\in {\mathsf{qudit\_set}}\) belongs to type \({\mathcal{C}}\) if there is at least one qubit located in Q*j* but not affected by \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\):

We denote the number of qudits of types \({\mathcal{A}}\), \({\mathcal{B}}\), and \({\mathcal{C}}\) as \(|{\mathcal{A}}|\), \(|{\mathcal{B}}|\), and \(|{\mathcal{C}}|\), correspondingly.

The transpilation of \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\) is performed by, first, constructing an intermediate qudit circuit \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\) presented in Fig. 8(a), and then decomposing \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\) down to single-qudit and two-qudit gates.

We then split \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\) into five steps: (i) multi-qudit controlled gate with controls on type \(\mathcal{A}\) qudits and target on the first qudit of type \(\mathcal{B}\); (ii) down-step ladder-like sequence of two-qudit gates on all qudits of type \(\mathcal{B}\); (iii) multi-qudit gate acting on the last qudit of type \(\mathcal{B}\) and all qudits of type \(\mathcal{C}\); (iv) up-step ladder-like sequence that is the uncomputation of step (ii); (v) the uncomputation of step (i).

The general idea of this structure is as follows. According to \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\), we have to add a phase factor of −1 to all basis states of involved qudits such that all corresponding qubits \({\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}\), embedded in these qudits, are in the state 1. We note that for qudits of types \(\mathcal{A}\) and \(\mathcal{B}\), there is a single level that is a candidate for acquiring the phase factor, namely \({\vert \underline {1}\rangle }\). For type \(\mathcal{C}\) qudits, the situation is different. Since the presence of unaffected qubits, the phase factor is acquired or not acquired (depending on the state of other involved qudits), to several levels of type \({\mathcal{C}}\) qudit, namely to all levels *α* satisfying the condition

where pos values correspond to positions of affected qubits in the considered qudit. Roughly speaking, we need to add a phase factor of −1 to a computational basis state of involved qudits, if all type-\(\mathcal{A}\) and type-\(\mathcal{B}\) qudits are in the state \({\vert \underline {1}\rangle }\), and all qubits encoded in type-\(\mathcal{C}\) qudits are in the state \(\vert 1\rangle \).

The important feature of type \(\mathcal{B}\)-qudits is that they possess an ancillary level that can be employed for storing temporary information within the gate decomposition. We use an ancillary level of type \(\mathcal{B}\) qudit for storing a ‘flag’ whether this qudit and all ‘previous’ qudits are in the proper state for acquiring the phase factor: this is the way how the ladder type sequences [parts (ii) and (iv)] appear in our construction. As we discuss further, the operation with qudits of type \(\mathcal{A}\) and \(\mathcal{C}\) is based on standard schemes of reconstructing multi-qubit controlled gates down to single-qubit and two-qubit gates. At the same time, the implementation of a two-qubit operation for qubits in qudits, possessing other uninvolved qubits (qudits of type \(\mathcal{C}\)), results in overhead in the number two-qudit operation (as we discussed in Sect. 4.2.2). In order to avoid the doubling of this overhead in the uncomputation, we put the operation with \(\mathcal{C}\) type qudits in the middle of our circuit.

However, it is a possibly realizable situation when the number of two-qudit gates required for processing \(\mathcal{C}\) type qudits is lower than the number of two-qudit gates for processing \(\mathcal{A}\) type qudits. In this case, it is preferable to swap \(\mathcal{A}\) and \(\mathcal{C}\)-type qudits in the structure of \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\). In order to simplify our description, next we consider the processing of the original circuit presented in Fig. 8(a). The possible improvement related to swapping \(\mathcal{A}\) and \(\mathcal{C}\) qudits in the structure of \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\) is discussed in Appendix B. We also consider modifications of the described scheme in cases where one or two types of qudits are missing (e.g. \(|{\mathcal{B}}|=0\)) in Appendix A.

Below we consider the decomposition of each of the described groups of gates to the set of basic single-qudit and two-qudit gates for our transpiler.

*a. Processing the multi-controlled gate of Step (i)* The idea of its decomposition is as follows. First, by employing single-qudit rotations \(R_{{\mathsf{Q}}j}^{\underline{0},\underline{1}}(\phi,\theta )\) and \(R_{{\mathsf{Q}}j}^{\underline{0},{\mathrm{a}}}(\phi,\theta )\) where Q*j* is an affected type-\({\mathcal{B}}\) qudit, and notations \(\underline{0}\equiv 0\), \(\underline{1}\equiv d^{2}-1\), and \({\mathrm{a}}\equiv 2^{\#j}\) are used, we turn the desired multi-qudit gate into the gate of CZ type [see Fig. 8(b)]. Namely, it adds the phase factor −1 to the state \({\vert \underline {1}\rangle }\otimes \cdots \otimes {\vert \underline {1}\rangle }\) of the affected qudits and leaves the remaining states unchanged.

Then we take an ancilla-free decomposition of \((|{\mathcal{A}}|+1)\)-qubit gate \({\mathsf{CZ}}_{{\mathsf{p}}0,\ldots,{\mathsf{p}}(|{\mathcal{A}}|)}\) gate, acting on abstract qubits \({\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{A}}|\), to single-qubit gates \(r_{{\mathsf{p}}k}(\phi,\theta )\) and two-qubit gates \({\mathsf{CZ}}_{{\mathsf{p}}k_{1} {\mathsf{p}}k_{2}}\). This decomposition is used as a ‘template’ for reconstructing the desired multi-qudit gate into a single-qudit and two-qudit gate. As an example, one can take a standard decomposition from Ref. [81] shown in Fig. 8(d). Next we turn each single-qubit gate \(r_{{\mathsf{p}}k}(\phi,\theta )\) into a single-qudit gate \(R^{\underline{0},\underline{1}}_{{\mathsf{Q}}j}(\phi,\theta )\), and each \({\mathsf{CZ}}_{{\mathsf{p}}k_{1} {\mathsf{p}}k_{2}}\) into \({\mathsf{CZ}}^{\underline{1},\underline{1}}_{{\mathsf{Q}}j_{1} {\mathsf{Q}}j_{2}}\), where the correspondence between qubits \({\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{A}}|\) and affected qudits is realized via a straightforward ordering (see Fig. 8 (e)). One can see that this construction provides the realization of CZ operation in the space spanned by a tensor product of states \({\vert \underline {0}\rangle }\) and \({\vert \underline {1}\rangle }\) of affected qudits.

We note that it is possible a situation, where the taken qubit-based decomposition of \({\mathsf{CZ}}_{{\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{A}}|}\) realizes the gate up to a global phase. In our case, where we embed this decomposition into qudit space, the global phase turns into a relative one between the CZ operation in the subspace spanned by a tensor product of \({\vert \underline {0}\rangle }\) and \({\vert \underline {1}\rangle }\) states and the identity operation in the remaining subspace. However, this relative phase is removed in the uncomputation Step (v), given that all operations in the uncomputation are Hermitian conjugates of ones in Step (i).

*b. Processing the ladder-like sequence on type-*\(\mathcal{B}\) *qudits of Step (ii)* Remind that each type-\(\mathcal{B}\) qudit has an ancillary level \(\vert \mathrm{a}\rangle \) that we use to store the information about whether ‘previous’ (according to the ordering in Fig. 8(a)) qudits are in the state \({\vert \underline {1}\rangle }\). The idea behind employed gates in the ladder-like sequence of Step (ii) is quite straightforward: Each gate turns the state of the target qudit from \({\vert \underline {1}\rangle }\) to \(\vert \mathrm{a}\rangle \) if and only if the control qudit is in the state \(\vert \mathrm{a}\rangle \). One can see that by realizing the sequence of Step (ii), following Step (i), the last type-\(\mathcal{B}\) qudit appears in the state \(\vert \mathrm{a}\rangle \) if and only if all type-\(\mathcal{A}\) and type-\(\mathcal{B}\) qudits were initially in the state \({\vert \underline {1}\rangle }\). The decomposition employed in Step (ii) two-qudit gates using native qudit gates can be performed according to schemes of Fig. 8(b) and (c).

*c. Processing the multi-controlled gate of Step (iii)* The goal of the considered gate is to acquire the phase factor of −1 to the input state if the last type-\({\mathcal{B}}\) qudit is in the ancillary state \(\vert \mathrm{a}\rangle \), and type-\(\mathcal{C}\) qudits are in a such state that all qubits embedded in the type-\(\mathcal{C}\) qudits and affected by the decomposed gate are in the state \(\vert 1\rangle \). As has been mentioned, the important point of type-\(\mathcal{C}\) qudits is that they also contain unaffected qubits, which results in the fact that the gate of Step (iii) has to acquire the phase factor of −1 to several computational basis states. Specifically, the phase factor of −1 has to be acquired to \(2^{\#{\mathrm{unaff}}}\) states, where #unaff is a total number of unaffected qubits in type-\(\mathcal{C}\) qudits. The intuition behind this fact is exactly the same as behind Eq. (22) of the required number of two-qudit gates for realizing an operation between qubits embedded in these qudits.

The idea of decomposing the gate of Step (iii) is very similar to the one of decomposing the gate at Step (i). First, we turn the gate at Step (iii) to a multi-controlled gate of CZ type by adding \(R_{{\mathsf{Q}}j}^{\underline{1}, {\mathrm{a}}}(\pi /2,\pi )\) and \(R_{{\mathsf{Q}}j}^{\underline{1}, {\mathrm{a}}}(\pi /2,-\pi )\) rotations on the last qudit Q*j* of type \({\mathcal{B}}\). Then we take an ancilla-free decomposition of \((|{\mathcal{C}}|+1)\)-qubit \({\mathsf{CZ}}_{{\mathsf{p}}0,\ldots,{\mathsf{p}}(|{\mathcal{C}}|)}\) gate (acting on virtual qubits \({\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{C}}|\)) to single-qubit rotations \(r_{{\mathsf{p}}k}(\phi,\theta )\) and two-qubit \({\mathsf{CZ}}_{{\mathsf{p}}k_{1}{\mathsf{p}}k_{2}}\) gates [see Fig. 7(f)].

Each single-qubit gate \(r_{{\mathsf{p}}k}(\phi,\theta )\) is transformed into the sequence of single-qudit gates

where Q*j* is a qudit corresponding to p*k* according to the straightforward ordering, and \((\alpha, \beta )\) are all appropriate level pairs satisfying the condition

and \(\{{\mathsf{pos}}_{\ell}\}\) is a set of position of qubits embedded in Q*j* and affected by the multi-qudit gate of Step (iii).

Two-qubit gates \({\mathsf{CZ}}_{{\mathsf{p}}k_{1}{\mathsf{p}}k_{2}}\) are transformed according to Sect. 4.2.2. Namely, we take qudits \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\) corresponding to \({\mathsf{p}}k_{1}\) and \({\mathsf{p}}k_{2}\), chose the set of qubits \({\mathsf{q}}i_{1}',\ldots {\mathsf{q}}i_{\kappa}'\) that are embedded in \({\mathsf{Q}}j_{1}\) and \({\mathsf{Q}}j_{2}\) and are affected by the multi-qudit gate of Step (iii), and transform \({\mathsf{CZ}}_{{\mathsf{q}}i_{1}',\ldots {\mathsf{q}}i_{\kappa}'}\) according to (20) and (21).

In contrast to the decomposition of the multi-controlled gate of Step (i), here we should also take into account the global phase factor that may appear from the qubit-based decomposition. Though it is insignificant in the qubit case, when we use this decomposition for qubit embedded into qudits, the phase turns from the global to the relative one (this is the relative phase between the CZ operation in the subspace of affected qubits, and identity operation in the remaining subspace). To compensate for this phase explicitly, we add a phase single-qubit gate

to the qubit p0. The value of *γ* is chosen to make the whole sequence of gates, applied to \({\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{C}}|\), to realize \({\mathsf{CZ}}_{{\mathsf{p}}0,\ldots,{\mathsf{p}}|{\mathcal{C}}|}\) without any global phase.

From the viewpoint of the qudit circuit, p0 corresponds to the type-\(\mathcal{B}\) qudit Q*j* involved in the multi-controlled gate of Step (iii). The qubit phase gate \({\mathsf{Ph}}_{{\mathsf{p}}0}(\gamma )\) transforms into

*d. Uncomputation steps (iv) and (v)* By its construction, the implementation of Steps (i)–(iii) realizes an acquiring of the phase factor of −1 to such qudits input state, where all embedded qubits affected by the decomposed gate \({\mathsf{CZ}}_{{\mathsf{q}}1,\ldots,{\mathsf{q}}\kappa}\) are in state \(\vert 1\rangle \). However, we employ ancillary level \(\vert \mathrm{a}\rangle \) of type-\(\mathcal{B}\) qudits. To remove the population from \(\vert \mathrm{a}\rangle \) to original levels, we employ uncomputation, which is a ‘mirror reflection’ of steps (i) and (ii). Namely, Steps (iv) and (v) are obtained as a Hermitian conjugate of a sequence of steps (i) and (ii): their order is reversed, and each \(r_{{\mathsf{Q}}j}(\varphi,\theta )\) i s transformed to \(r_{{\mathsf{Q}}j}(\varphi,-\theta )\) (note that \({\mathsf{CZ}}_{{\mathsf{Q}}j_{1}{\mathsf{Q}}j_{2}}={\mathsf{CZ}}_{{\mathsf{Q}}j_{1}{\mathsf{Q}}j_{2}}^{ \dagger}\)). As it was already mentioned, the uncomputation also removes the relative phase between the subspace of affected qubits and the remaining subspace of type-\(\mathcal{A}\) qudits, possibly acquired in Step (i).

We see that all routines during the processing of the multi-qudit case are efficient, and the resulting complexity has no more than quadratic growth with an increase the degree of the processed generalized Toffoli gate (the quadratic asymptotics can appear from the used template for ancillary-free decomposition [81]). That is why the whole complexity of transpiling an *n*-qubit circuit consisting of *L* gates scales linearly *L* and no more than polynomially with *n*.

## 5 Realizing 6-qubit quantum circuit with ququarts

As an example, we consider the realization of an \(n=6\) qubit circuit, which is presented in Fig. 9(a), with a qudit-based processor consisting of \(m=4\) ‘ququarts’ (qudits with \(d=4\)). First, let us consider a straightforward implementation of the input circuit with a qubit-based processor. To simplify the transpiration of multi-qubit gate \({\mathsf{CZ}}_{{\mathsf{q}}1,\ldots,{\mathsf{q}}}6\), we use two additional ancillary qubits q7, q8. Using schemes shown in Fig. 9(b,c) together with one from Fig. 8(d), \({\mathsf{CZ}}_{{\mathsf{q}}1,\ldots,{\mathsf{q}}6}\) can be realized with \(5\times 6=30\) two-qubit gates and a number of single-qubit gates. In this way, the straightforward qubit-based decomposition of the input circuit results in \(N_{\text{2-body}}^{\mathrm{qb}}=33\) two-qubit operations. We note that no restrictions on the coupling map between qubits are considered here.

In contrast, the qubit-to-qudit mapping, shown in Fig. 9(d), allows realizing the input qubit circuit with only \(N_{\text{2-body}}^{\mathrm{qd}}=6\) two-qudit gates. In Fig. 9(e) we show a transformation of 1024 measurement outcomes, obtained with a qudit-based classical emulator, to the read-out measurement outcomes performed in the input qubit circuit. The transpiled qudit circuit is shown in Fig. 9(f). One can see that the qudit-based realization provides an advantage both in the circuit width and depth.

Recall that the results of the qudit-based transpilation, shown in Fig. 9, remain also valid for initial qubit states other than \(\vert 0\rangle ^{\otimes n}\). To realize the qubit circuit with respect to another initial state using qudits, the only thing that is required is to update the initial state of qudit’s register in accordance with the qubit-to-qudit mapping. We note that within the considered mappings of the form (10), any separable state of qubits corresponds to a separable state of qudits (but not vice-versa).

## 6 Discussion

Here we stress some important points related to the developed qudit-based transpilation approach. First, we emphasize its scalability with respect to the width and depth of a processed input qubit circuit. The scalability is assured by the facts that (i) the complexity of transpiling of a given single-, two-, or multi-qubit gate to its qudit version grows no more than polynomially with the number of qubits affected by the gate, (ii) the complexity of transpiling the whole qubit circuit with respect to the given qubit-to-qudit mapping grows linearly with a number of gates, and (iii) a polynomial in qubit number *n* algorithm for mapping finding, which provides an advantage (or at least doesn’t make things worse) compared to a standard qubit-based transpilation, can be used. In particular, a greedy algorithm for the mapping finder of \(\mathcal{O}(n^{3})\) complexity for \(4\leq d\leq 7\) is shown. Therefore, the resulting qudit-based transpilation complexity is polynomial in the number of qubits *n* in the processed circuit and linear in the number of gates.

We also recall that in the case of \(m< n\leq m\lfloor \log _{2}d \rfloor \), where *m* is the number of available *d*-dimensional qudits, the developed transpilation approach makes it possible to run an *n*-qubit circuit, which cannot be launched at all with *m* qubits. Thus, our approach allows one to expand the range of algorithms suitable for running in terms of the required number of qubits. On the other hand, if \(m\geq n\), then the corresponding qudit circuit definitely has no more entangling gates than the transpiled in a standard qubit-based version and strictly less number of entangling gates, if there is at least one multiqubit gate in the original qubit circuit.

An important feature of the developed approach is its adaptiveness to qudit dimension in the processing of multi-qubit gates. It allows leveraging the power of extra levels in qudits to a greater extent compared to the approaches (see, e.g., [80]), where first a given qubit circuit is transpiled down to single- and two-qubit gates, and then a qubit-to-qudit mapping is obtained.

These features together demonstrate the applicability of our approach to useful near-term quantum algorithms. The main application area of our approach is quantum algorithms, which typically contain multi-qubit gates. A clear example of two-particle gate reduction provided by qudit-based realization is Grover’s search algorithm. As shown in Ref. [83], a thousandfold reduction in entangling gate number starting from eight qubits implementation can be achieved with ququints (\(d=5\)). Multi-qubit gates are inherent in solving factorization [84] and discrete logarithm [85] problems. It’s worth emphasizing that decompositions of general multiqubit unitaries, e.g. Haar-random, are also based on generalized Toffoli gates [86]. We also note that the presented qudit-based transpilation approach is promising within the employing Toffoli + Hadamard universal gate set [87], where new interesting results were reported recently [88].

## 7 Conclusion and outlook

We have presented the approach for an efficient implementation of qubit circuits with qudit-based processors. The proposed approach consists of finding the optimized qubit-to-qudit mapping, transpiling a qubit circuit according to this mapping, running a transpiled circuit on a qudit-based processor (or emulator), and then reassigning read-out measurement results back to the qubit-based representation. We have developed a qudit-based transpilation algorithm with respect to a particular universal set of single-qudit and two-qudit gates and proposed an idea of a mapping finder algorithm with polynomial complexity. Then we have shown an example of applying the developed approach for realizing a 6-qubit circuit with four 4-level qudits. We have demonstrated that the resulting number of two-particle operations required for implementing the given circuit with qudits appears considerably smaller than the one within a straightforward qubit-based implementation. Taking into account recent progress in improving the fidelity of qudit gates, we expect an overall increase in the resulting fidelity of implementing qubit circuits with qudits.

We note that the main goal of the current work is to provide a general approach for qubit circuit execution with qudit-based hardware. The considered example of qudit-based transpilation has to be modified for each particular physical platform with a specific set of native gates and qudits’ connection topology. We leave these particular platform-specific problems for further consideration. Although the realization of \(d'\)-ary circuits with qudits is beyond the scope of this work, their transpilation for qudit processors with \(d\geq d'+1\) levels is also an improvement option for the developed qudit transpiler.

We also note that one can consider a refinement of the optimized qudit circuit criterion. It can be defined not only by the number of two-particle operations but also as a total qudit circuit fidelity (or its estimation), which takes into account both single-qudit and two-qudit gates fidelities. Although recent papers demonstrate that fidelities of single- and two-qudit gates are comparable with qubit gates’ fidelities, this metric allows one to more accurately take into account the effects of decoherence arising from the usage of upper levels.

## Data availability

Not applicable.

## References

Bernien H, Schwartz S, Keesling A, Levine H, Omran A, Pichler H, Choi S, Zibrov AS, Endres M, Greiner M, Vuletić V, Lukin MD. Nature. 2017;551:579. https://doi.org/10.1038/nature24622.

Ebadi S, Wang TT, Levine H, Keesling A, Semeghini G, Omran A, Bluvstein D, Samajdar R, Pichler H, Ho WW, Choi S, Sachdev S, Greiner M, Vuletić V, Lukin MD. Nature. 2021;595:227. https://doi.org/10.1038/s41586-021-03582-4.

Zhang J, Pagano G, Hess PW, Kyprianidis A, Becker P, Kaplan H, Gorshkov AV, Gong ZX, Monroe C. Nature. 2017;551:601. https://doi.org/10.1038/nature24654.

Barredo D, Lienhard V, de Léséleuc S, Lahaye T, Browaeys A. Nature. 2018;561:79. https://doi.org/10.1038/s41586-018-0450-2.

Arute F, Arya K, Babbush R, Bacon D, Bardin JC, Barends R, Biswas R, Boixo S, Brandao FGSL, Buell DA, Burkett B, Chen Y, Chen Z, Chiaro B, Collins R, Courtney W, Dunsworth A, Farhi E, Foxen B, Fowler A, Gidney C, Giustina M, Graff R, Guerin K, Habegger S, Harrigan MP, Hartmann MJ, Ho A, Hoffmann M, Huang T, Humble TS, Isakov SV, Jeffrey E, Jiang Z, Kafri D, Kechedzhi K, Kelly J, Klimov PV, Knysh S, Korotkov A, Kostritsa F, Landhuis D, Lindmark M, Lucero E, Lyakh D, Mandrà S, McClean JR, McEwen M, Megrant A, Mi X, Michielsen K, Mohseni M, Mutus J, Naaman O, Neeley M, Neill C, Niu MY, Ostby E, Petukhov A, Platt JC, Quintana C, Rieffel EG, Roushan P, Rubin NC, Sank D, Satzinger KJ, Smelyanskiy V, Sung KJ, Trevithick MD, Vainsencher A, Villalonga B, White T, Yao ZJ, Yeh P, Zalcman A, Neven H, Martinis JM. Nature. 2019;574:505. https://doi.org/10.1038/s41586-019-1666-5.

Friis N, Marty O, Maier C, Hempel C, Holzäpfel M, Jurcevic P, Plenio MB, Huber M, Roos C, Blatt R, Lanyon B. Phys Rev X. 2018;8:021012. https://doi.org/10.1103/PhysRevX.8.021012.

O’Malley PJJ, Babbush R, Kivlichan ID, Romero J, McClean JR, Barends R, Kelly J, Roushan P, Tranter A, Ding N, Campbell B, Chen Y, Chen Z, Chiaro B, Dunsworth A, Fowler AG, Jeffrey E, Lucero E, Megrant A, Mutus JY, Neeley M, Neill C, Quintana C, Sank D, Vainsencher A, Wenner J, White TC, Coveney PV, Love PJ, Neven H, Aspuru-Guzik A, Martinis JM. Phys Rev X. 2016;6:031007. https://doi.org/10.1103/PhysRevX.6.031007.

Kandala A, Mezzacapo A, Temme K, Takita M, Brink M, Chow JM, Gambetta JM. Nature. 2017;549:242. https://doi.org/10.1038/nature23879.

Hempel C, Maier C, Romero J, McClean J, Monz T, Shen H, Jurcevic P, Lanyon BP, Love P, Babbush R, Aspuru-Guzik A, Blatt R, Roos CF. Phys Rev X. 2018;8:031022. https://doi.org/10.1103/PhysRevX.8.031022.

Moll N, Barkoutsos P, Bishop LS, Chow JM, Cross A, Egger DJ, Filipp S, Fuhrer A, Gambetta JM, Ganzhorn M, Kandala A, Mezzacapo A, Müller P, Riess W, Salis G, Smolin J, Tavernelli I, Temme K. Quantum Sci Technol. 2018;3:030503. https://doi.org/10.1088/2058-9565/aab822.

Xue X, Russ M, Samkharadze N, Undseth B, Sammak A, Scappucci G, Vandersypen LMK. Nature. 2022;601:343. https://doi.org/10.1038/s41586-021-04273-w.

Madzik MT, Asaad S, Youssry A, Joecker B, Rudinger KM, Nielsen E, Young KC, Proctor TJ, Baczewski AD, Laucht A, Schmitt V, Hudson FE, Itoh KM, Jakob AM, Johnson BC, Jamieson DN, Dzurak AS, Ferrie C, Blume-Kohout R, Morello A. Nature. 2022;601:348. https://doi.org/10.1038/s41586-021-04292-7.

Noiri A, Takeda K, Nakajima T, Kobayashi T, Sammak A, Scappucci G, Tarucha S. Nature. 2022;601:338. https://doi.org/10.1038/s41586-021-04182-y.

Zhong H-S, Wang H, Deng Y-H, Chen M-C, Peng L-C, Luo Y-H, Qin J, Wu D, Ding X, Hu Y, Hu P, Yang X-Y, Zhang W-J, Li H, Li Y, Jiang X, Gan L, Yang G, You L, Wang Z, Li L, Liu N-L, Lu C-Y, Pan J-W. Science. 2020;370:1460. https://doi.org/10.1126/science.abe8770.

Madsen LS, Laudenbach F, Askarani MF, Rortais F, Vincent T, Bulmer JFF, Miatto FM, Neuhaus L, Helt LG, Collins MJ, Lita AE, Gerrits T, Nam SW, Vaidya VD, Menotti M, Dhand I, Vernon Z, Quesada N, Lavoie J. Nature. 2022;606:75. https://doi.org/10.1038/s41586-022-04725-x.

Kiktenko EO, Nikolaeva AS, Fedorov AK. Realization of quantum algorithms with qudits. 2023. arXiv:2311.12003 [quant-ph].

Erhard M, Fickler R, Krenn M, Zeilinger A. Light: Sci Appl. 2018;7:17146. https://doi.org/10.1038/lsa.2017.146.

Farhi E, Gutmann S. Phys Rev A. 1998;57:2403. https://doi.org/10.1103/PhysRevA.57.2403.

Kessel’ AR, Ermakov VL. JETP Lett. 1999;70:61. https://doi.org/10.1134/1.568130.

Kessel’ AR, Ermakov VL. JETP Lett. 2000;71:307. https://doi.org/10.1134/1.568340.

Kessel AR, Yakovleva NM. Phys Rev A. 2002;66:062322. https://doi.org/10.1103/PhysRevA.66.062322.

Muthukrishnan A, Stroud CR. Phys Rev A. 2000;62:052309. https://doi.org/10.1103/PhysRevA.62.052309.

Nielsen MA, Bremner MJ, Dodd JL, Childs AM, Dawson CM. Phys Rev A. 2002;66:022317. https://doi.org/10.1103/PhysRevA.66.022317.

Wang X, Sanders BC, Berry DW. Phys Rev A. 2003;67:042323. https://doi.org/10.1103/PhysRevA.67.042323.

Klimov AB, Guzmán R, Retamal JC, Saavedra C. Phys Rev A. 2003;67:062313. https://doi.org/10.1103/PhysRevA.67.062313.

Bagan E, Baig M, Muñoz Tapia R. Phys Rev A. 2003;67:014303. https://doi.org/10.1103/PhysRevA.67.014303.

Vlasov AY. In: Ozhigov YI, editor. First international symposium on quantum informatics. vol. 5128. International Society for Optics and Photonics (SPIE, 2013); 2003. p. 29–36.

Greentree AD, Schirmer SG, Green F, Hollenberg LCL, Hamilton AR, Clark RG. Phys Rev Lett. 2004;92:097901. https://doi.org/10.1103/PhysRevLett.92.097901.

O’Leary DP, Brennen GK, Bullock SS. Phys Rev A. 2006;74:032334. https://doi.org/10.1103/PhysRevA.74.032334.

Ralph TC, Resch KJ, Gilchrist A. Phys Rev A. 2007;75:022313. https://doi.org/10.1103/PhysRevA.75.022313.

Lanyon BP, Weinhold TJ, Langford NK, O’Brien JL, Resch KJ, Gilchrist A, White AG. Phys Rev Lett. 2008;100:060504. https://doi.org/10.1103/PhysRevLett.100.060504.

Zobov VE, Shauro V, Ermilov AS. JETP Lett. 2008;87:334. https://doi.org/10.1134/S0021364008060143.

Ionicioiu R, Spiller TP, Munro WJ. Phys Rev A. 2009;80:012312. https://doi.org/10.1103/PhysRevA.80.012312.

Ivanov SS, Tonchev HS, Vitanov NV. Phys Rev A. 2012;85:062321. https://doi.org/10.1103/PhysRevA.85.062321.

Li B, Yu Z-H, Fei S-M. Sci Rep. 2013;3:2594. https://doi.org/10.1038/srep02594.

Kiktenko EO, Fedorov AK, Man’ko OV, Man’ko VI. Phys Rev A. 2015;91:042312. https://doi.org/10.1103/PhysRevA.91.042312.

Kiktenko E, Fedorov A, Strakhov A, Man’ko V. Phys Lett A. 2015;379:1409. https://doi.org/10.1016/j.physleta.2015.03.023.

Song C, Su S-L, Wu J-L, Wang D-Y, Ji X, Zhang S. Phys Rev A. 2016;93:062321. https://doi.org/10.1103/PhysRevA.93.062321.

Frydryszak A, Jakóbczyk L, Ługiewicz P. J Phys Conf Ser. 2017;804:012016. https://doi.org/10.1088/1742-6596/804/1/012016.

Bocharov A, Roetteler M, Svore KM. Phys Rev A. 2017;96:012306. https://doi.org/10.1103/PhysRevA.96.012306.

Gokhale P, Baker JM, Duckering C, Brown NC, Brown KR, Chong FT. In: Proceedings of the 46th international symposium on computer architecture, ISCA’19. New York: Association for Computing Machinery; 2019. p. 554–66.

Luo Y-H, Zhong H-S, Erhard M, Wang X-L, Peng L-C, Krenn M, Jiang X, Li L, Liu N-L, Lu C-Y, Zeilinger A, Pan J-W. Phys Rev Lett. 2019;123:070505. https://doi.org/10.1103/PhysRevLett.123.070505.

Low PJ, White BM, Cox AA, Day ML, Senko C. Phys Rev Res. 2020;2:033128. https://doi.org/10.1103/PhysRevResearch.2.033128.

Jin Z, Gong W-J, Zhu A-D, Zhang S, Qi Y, Su S-L. Opt Express. 2021;29:10117. https://doi.org/10.1364/OE.419568.

Neeley M, Ansmann M, Bialczak RC, Hofheinz M, Lucero E, O’Connell AD, Sank D, Wang H, Wenner J, Cleland AN, Geller MR, Martinis JM. Science. 2009;325:722. https://doi.org/10.1126/science.1173440.

Lanyon BP, Barbieri M, Almeida MP, Jennewein T, Ralph TC, Resch KJ, Pryde GJ, O’Brien JL, Gilchrist A, White AG. Nat Phys. 2009;5:134. https://doi.org/10.1038/nphys1150.

Fedorov A, Steffen L, Baur M, da Silva MP, Wallraff A. Nature. 2012;481:170. https://doi.org/10.1038/nature10713.

Mischuck BE, Merkel ST, Deutsch IH. Phys Rev A. 2012;85:022302. https://doi.org/10.1103/PhysRevA.85.022302.

Peterer MJ, Bader SJ, Jin X, Yan F, Kamal A, Gudmundsen TJ, Leek PJ, Orlando TP, Oliver WD, Gustavsson S. Phys Rev Lett. 2015;114:010501. https://doi.org/10.1103/PhysRevLett.114.010501.

Svetitsky E, Suchowski H, Resh R, Shalibo Y, Martinis JM, Katz N. Nat Commun. 2014;5:5617. https://doi.org/10.1038/ncomms6617.

Braumüller J, Cramer J, Schlör S, Rotzinger H, Radtke L, Lukashenko A, Yang P, Skacel ST, Probst S, Marthaler M, Guo L, Ustinov AV, Weides M. Phys Rev B. 2015;91:054523. https://doi.org/10.1103/PhysRevB.91.054523.

Kues M, Reimer C, Roztocki P, Cortés LR, Sciara S, Wetzel B, Zhang Y, Cino A, Chu ST, Little BE, Moss DJ, Caspani L, Azaña J, Morandotti R. Nature. 2017;546:622. https://doi.org/10.1038/nature22986.

Godfrin C, Ferhat A, Ballou R, Klyatskaya S, Ruben M, Wernsdorfer W, Balestro F. Phys Rev Lett. 2017;119:187702. https://doi.org/10.1103/PhysRevLett.119.187702.

Sawant R, Blackmore JA, Gregory PD, Mur-Petit J, Jaksch D, Aldegunde J, Hutson JM, Tarbutt MR, Cornish SL. New J Phys. 2020;22:013027. https://doi.org/10.1088/1367-2630/ab60f4.

Pavlidis A, Floratos E. Phys Rev A. 2021;103:032417. https://doi.org/10.1103/PhysRevA.103.032417.

Rambow P, Tian M. 2021. arXiv:2109.09902.

Zobov V, Pichkovskiy I. Quantum Inf Process. 2022;21:144. https://doi.org/10.1007/s11128-022-03482-0.

Vashukevich EA, Bashmakova EN, Golubeva TY, Golubev YM. Laser Phys Lett. 2022;19:025202. https://doi.org/10.1088/1612-202X/ac45b2.

Goss N, Morvan A, Marinelli B, Mitchell BK, Nguyen LB, Naik RK, Chen L, Jünger C, Kreikebaum JM, Santiago DI et al.. Nat Commun. 2022;13:7481. https://doi.org/10.1038/s41467-022-34851-z.

González-Cuadra D, Zache TV, Carrasco J, Kraus B, Zoller P. Phys Rev Lett. 2022;129:160501. https://doi.org/10.1103/PhysRevLett.129.160501.

Ringbauer M, Meth M, Postler L, Stricker R, Blatt R, Schindler P, Monz T. Nat Phys. 2022;18:1053. https://doi.org/10.1038/s41567-022-01658-0.

Aksenov MA, Zalivako IV, Semerikov IA, Borisenko AS, Semenin NV, Sidorov PL, Fedorov AK, Khabarova KY, Kolachevsky NN. Phys Rev A. 2023;107:052612. https://doi.org/10.1103/PhysRevA.107.0526123.

Zalivako IV, Borisenko AS, Semerikov IA, Korolkov AE, Sidorov PL, Galstyan KP, Semenin NV, Smirnov VN, Aksenov MD, Fedorov AK, Khabarova KY, Kolachevsky NN. Front Quantum Sci Technol. 2023;2. https://doi.org/10.3389/frqst.2023.1228208.

Hill AD, Hodson MJ, Didier N, Reagor MJ. 2021. arXiv:2108.01652.

Chi Y, Huang J, Zhang Z, Mao J, Zhou Z, Chen X, Zhai C, Bao J, Dai T, Yuan H, Zhang M, Dai D, Tang B, Yang Y, Li Z, Ding Y, Oxenløwe LK, Thompson MG, O’Brien JL, Li Y, Gong Q, Wang J. Nat Commun. 2022;13:1166. https://doi.org/10.1038/s41467-022-28767-x.

Popov A, Kiktenko E, Fedorov A, Man’ko VI. J Russ Laser Res. 2016;37:581.

Kiktenko EO, Nikolaeva AS, Xu P, Shlyapnikov GV, Fedorov AK. Phys Rev A. 2020;101:022304. https://doi.org/10.1103/PhysRevA.101.022304.

Nikolaeva AS, Kiktenko EO, Fedorov AK. Phys Rev A. 2022;105:032621. https://doi.org/10.1103/PhysRevA.105.032621.

Galda A, Cubeddu M, Kanazawa N, Narang P, Earnest-Noble N. 2021. arXiv:2109.00558.

Gu X, Allcock J, An S, Liu Y-X. 2021. arXiv:2111.06534.

Chong FT, Franklin D, Martonosi M. Nature. 2017;549:180. https://doi.org/10.1038/nature23459.

Zhu D, Cian Z-P, Noel C, Risinger A, Biswas D, Egan L, Zhu Y, Green AM, Alderete CH, Nguyen NH, Wang Q, Maksymov A, Nam Y, Cetina M, Linke NM, Hafezi M, Monroe C. 2021. arXiv:2107.11387.

Earnest N, Tornow C, Egger DJ. Phys Rev Res. 2021;3:043088. https://doi.org/10.1103/PhysRevResearch.3.043088.

DiVincenzo DP. Fortschr Phys. 2000;48:771.

Fedorov AK, Gisin N, Beloussov SM, Lvovsky AI. 2022. arXiv:2203.17181.

Mato K, Ringbauer M, Hillmich S, Wille R. In: 2022 IEEE international conference on quantum computing and engineering (QCE). Los Alamitos: IEEE Computer Society; 2022. p. 484–91.

Blok MS, Ramasesh VV, Schuster T, O’Brien K, Kreikebaum JM, Dahlen D, Morvan A, Yoshida B, Yao NY, Siddiqi I. Phys Rev X. 2021;11:021010. https://doi.org/10.1103/PhysRevX.11.021010.

Kazmina AS, Zalivako IV, Borisenko AS, Nemkov NA, Nikolaeva AS, Simakov IA, Kuznetsova AV, Egorova EY, Galstyan KP, Semenin NV, Korolkov AE, Moskalenko IN, Abramov NN, Besedin IS, Kalacheva DA, Lubsanov VB, Bolgar AN, Kiktenko EO, Khabarova KY, Galda A, Semerikov IA, Kolachevsky NN, Maleeva N, Fedorov AK. Demonstration of a parity-time symmetry breaking phase transition using superconducting and trapped-ion qutrits. 2023. arXiv:2310.20432 [quant-ph].

Cirac JI, Zoller P. Phys Rev Lett. 1995;74:4091. https://doi.org/10.1103/PhysRevLett.74.4091.

Mato K, Hillmich S, Wille R. In: 2023 IEEE international conference on quantum software (QSW). New York: IEEE; 2023. p. 155–61.

Barenco A, Bennett CH, Cleve R, DiVincenzo DP, Margolus N, Shor P, Sleator T, Smolin JA, Weinfurter H. Phys Rev A. 1995;52:3457. https://doi.org/10.1103/PhysRevA.52.3457.

Nikolaeva AS, Kiktenko EO, Fedorov AK. Universal quantum computing with qubits embedded in trapped-ion qudits. 2023. arXiv:2302.02966 [quant-ph].

Nikolaeva AS, Kiktenko EO, Fedorov AK. Entropy. 2023;25. https://doi.org/10.3390/e25020387.

Shor P. In: Proceedings 35th annual symposium on foundations of computer science. 1994. p. 124–34.

Litinski D. How to compute a 256-bit elliptic curve private key with only 50 million toffoli gates. 2023. arXiv:2306.08585 [quant-ph].

Nielsen MA, Chuang IL. Quantum computation and quantum information. Cambridge: Cambridge University Press; 2010.

Aharonov D. 2003. arXiv preprint. arXiv:quant-ph/0301040.

Amy M, Glaudell AN, Li SM, Ross NJ. Improved synthesis of toffoli-hadamard circuits. 2023. arXiv:2305.11305 [quant-ph].

## Funding

The research is supported by the Russian Science Foundation (Grant No. 20-42-05002; qudit-based approach), the Leading Research Center on Quantum Computing (Agreement No. 014/20; implementation of quantum algorithms), and by the Priority 2030 program at the National University of Science and Technology “MISIS” (aspects of the transpilation scheme).

## Author information

### Authors and Affiliations

### Contributions

A.S.N. designed the transpilation algorithm and wrote the manuscript with support from E.O.K. and A.K.F. E.O.K. developed the theoretical formalism and general computational framework. All authors contributed to the final version of the manuscript. E.O.K. and A.K.F. supervised the project.

## Ethics declarations

### Ethics approval and consent to participate

Not applicable.

### Consent for publication

Not applicable.

### Competing interests

Owing to the employments and consulting activities of authors, A.S.N., E.O.K., and A.K.F. have financial interests in the commercial applications of quantum computing. A.S.N., E.O.K., and A.K.F. do not have any non-financial competing interest.

## Additional information

### Publisher’s Note

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

## Appendices

### Appendix A: Intermediate circuit in the case of incomplete set of type-\({\mathcal{A}}, {\mathcal{B}}, {\mathcal{C}}\) qudits

While processing multi-qubit gates \({\mathsf{CZ}}_{{\mathsf{q}}i_{1},\ldots, {\mathsf{q}}i_{\kappa}}\) with \(|{\mathsf{qudit{\_}set}}|\geq 3\), it is possible a situation, where one or two types (\({\mathcal{A}}\), \({\mathcal{B}}\), \({\mathcal{C}}\)) are missing. In this case, the described decomposition needs some slight corrections.

If there are no type-\(\mathcal{B}\) qudits, then the intermediate circuit consists of a single multi-qudit CZ gate acting on all \(|{\mathsf{qudit{\_}set}}|\) qudits. To decompose this gate we take a standard multi-qubit gate decomposition as a template as it is described in Sect. 4.2.3a and 4.2.3c. Then each qubit gate is replaced with the corresponding qudit gate(s) taking into account the type of involved qudits (type \(\mathcal{A}\) or type \(\mathcal{C}\)). The phase correction, discussed in Sect. 4.2.3c, has to be applied if it is necessary.

If there are no type-\(\mathcal{A}\) qudits, yet there is at least one type-\(\mathcal{B}\) qudit, the ladder-like part of decomposition is started with the control on the first qudit in the state \({ \vert \underline {1}\rangle }\). If type-\(\mathcal{C}\) qudits are also missing, then the ladder-like part of the decomposition ends with a target on the last type \(\mathcal{B}\) qudit in the state \({ \vert \underline {1}\rangle }\).

### Appendix B: Alternative form of the intermediate circuit

The structure of the intermediate qudit circuit \({\mathsf{circ}}^{\text{qd-int-alt}}_{\phi}\), which is presented in Fig. 10 is similar to the structure of the previously described \({\mathsf{circ}}^{\text{qd-int}}_{\phi}\). The main difference between them is the location of type \(\mathcal{A}\) and \(\mathcal{C}\) qudits in the scheme. In the alternative version, the multi-qudit gate on type-\(\mathcal{C}\) qudits is employed twice, and the multi-qudit gate on type \(\mathcal{A}\) is employed once in the central part of the scheme. We note that operations on type \(\mathcal{B}\) qudits remain the same as in the previously described scheme in Fig. 8(a).

Taking into account invariability of operations on type \(\mathcal{B}\) qudits and the symmetry of CZ type operation in the core of type-\(\mathcal{A}\) and \(\mathcal{C}\) multi-qudit gates, realization of the CZ type operation on \(\mathcal{A}\) and \(\mathcal{C}\) qudits reduces to the procedures described in Sects. 4.2.3a and 4.2.3c, correspondingly.

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Nikolaeva, A.S., Kiktenko, E.O. & Fedorov, A.K. Efficient realization of quantum algorithms with qudits.
*EPJ Quantum Technol.* **11**, 43 (2024). https://doi.org/10.1140/epjqt/s40507-024-00250-0

Received:

Accepted:

Published:

DOI: https://doi.org/10.1140/epjqt/s40507-024-00250-0