This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Using ZDDs in the Mapping of Quantum Circuits

Kaitlin Smith   Mitchell Thornton Quantum Informatics Research Group, SMU
Dallas, Texas, USAIntegrated Systems Laboratory, EPFL
Lausanne, Switzerland
   Mathias Soeken   Bruno Schmitt  Giovanni De Micheli Integrated Systems Laboratory, EPFL
Lausanne, Switzerland
Abstract

A critical step in quantum compilation is the transformation of a technology-independent quantum circuit into a technology-dependent form for a targeted device. In addition to mapping quantum gates into the supported gate set, it is necessary to map pseudo qubits in the technology-independent circuit into physical qubits of the technology-dependent circuit such that coupling constraints among qubits acting in multiple-qubit gates are satisfied. It is usually not possible to find such a mapping without adding SWAP gates into the circuit. To cope with the technical limitations of NISQ-era quantum devices, it is advantageous to find a mapping that requires as few additional gates as possible. The large search space of possible mappings makes this task a difficult combinatorial optimization problem. In this work, we demonstrate how zero-suppressed decision diagrams (ZDDs) can be used for typical implementation tasks in quantum mapping algorithms. We show how to maximally partition a quantum circuit into blocks of adjacent gates, and if adjacent gates within a circuit do not share common mapping permutations, we attempt to combine them using parallelized SWAP operations represented in a ZDD. Boundaries for the partitions are formed where adjacent gates are unable to be combined. Within each partition block, ZDDs represent all possible mappings of pseudo qubits to physical qubits.

1 Introduction

Today’s NISQ-era quantum devices [10] support some given set of single- and two-qubit quantum gates. While single-qubit operations can be executed on any of the physical qubits, two-qubit quantum gates can only be performed by a pair of qubits that share a physical connection. The set of permissible qubit pairs are referred to as the coupling constraints. One task in quantum compilation algorithms is the mapping of a quantum circuit or algorithm, a sequence of quantum operations, onto the physical qubits of the device such that all two-qubit operations are executed with respect to device coupling constraints. This task is not always possible without including additional gates in the circuit.

Finding an optimum solution that minimizes the number of additional gates is “NP-hard” [3]. In order to efficiently find a solution, several heuristics have been proposed [12, 15, 6, 8]. Past work in mapping algorithms for quantum circuits are reported in [4, 13]. A common bottleneck in these heuristic methods is due to the large combinational search space resulting in numerous possible ways of mapping the gates to the device.

In this paper, we discuss how zero-suppressed decision diagrams (ZDDs, [9, 7]) can be used in mapping algorithms to combat combinational complexity. These data structures were selected because nearest neighbor couplings within quantum devices make the possible connections between qubits in a quantum circuit a sparse set, and ZDDs, as compared to other types of decision diagrams, are efficient at representing sparse sets. We show how to implement two specific problems which appear in several heuristics: (1) finding a maximal subcircuit partition that can be mapped without adding gates, and (2) how to determine and choose among all possible SWAP circuits that can execute in parallel in order to extend a partition. Once a maximal subcircuit partition is determined, a pseudo to physical qubit permutation from that partition is used to map the quantum circuit to a technology platform. If the maximal partition spans the entire quantum circuit, the result of ZDD mapping is a circuit that is fully mapped with respect to the coupling constraints of a device.

Finding maximal partitions for quantum circuit mapping is solved using SAT in [6]. In contrast to the SAT-based solution that finds one possible mapping, the ZDD-based algorithm generates all possible mappings for a maximal partition. All solutions are represented implicitly by means of a decision diagram, which may be used to count all solutions, query some solutions, or compute the solution that minimizes some linear cost function. All such tasks can be performed in time that is linear with respect to the size of the ZDD. All possible parallel SWAP operations used to extend the size of a partition are also stored in a ZDD.

The algorithms reported in this paper are intended to serve as motivating examples to illustrate how ZDDs may be used as a data structure for implementing a mapping algorithm. These algorithms have been prototyped and evaluated on a set of benchmarks. Effectiveness of the ZDD mapping algorithms is determined by using them in a preprocessing step for the publically-available compilers developed for the IBM and Rigetti quantum devices.

2 Preliminaries

2.1 Graphs

An undirected graph G=(V,E)G=(V,E) consists of a set of vertices VV and a set of edges E(V2)={VV|V|=2}E\subseteq\binom{V}{2}=\{V^{\prime}\subseteq V\mid|V^{\prime}|=2\}. Given two undirected graphs G\lx@text@underscore1=(V\lx@text@underscore1,E\lx@text@underscore1)G_{\lx@text@underscore}1=(V_{\lx@text@underscore}1,E_{\lx@text@underscore}1) and G\lx@text@underscore2=(V\lx@text@underscore2,E\lx@text@underscore2)G_{\lx@text@underscore}2=(V_{\lx@text@underscore}2,E_{\lx@text@underscore}2), we say that G\lx@text@underscore1G_{\lx@text@underscore}1 is a subgraph of G\lx@text@underscore2G_{\lx@text@underscore}2, if there exists an injective function φ:V\lx@text@underscore1V\lx@text@underscore2\varphi:V_{\lx@text@underscore}1\to V_{\lx@text@underscore}2 such that {v,w}E\lx@text@underscore1\{v,w\}\in E_{\lx@text@underscore}1 implies {f(v),f(w)}E\lx@text@underscore2\{f(v),f(w)\}\in E_{\lx@text@underscore}2. A directed graph, G=(V,E)G=(V,E), is similar to a undirected graph, but edges consist of ordered pairs, or permutations, of nodes rather than bidirectional combinations. Therefore, in a directed graph, EP\lx@text@underscoreV2={VV|V|=2}E\subseteq P^{V}_{\lx@text@underscore}{2}=\{V^{\prime}\subseteq V\mid|V^{\prime}|=2\} where P\lx@text@underscorenkP^{n}_{\lx@text@underscore}{k} indicates a kk-permutation of nn.

Given an ordered sequence S=s\lx@text@underscore1,,s\lx@text@underscorenS=s_{\lx@text@underscore}1,\dots,s_{\lx@text@underscore}n, we define an ordered partition S\lx@text@underscore1,,S\lx@text@underscorelS_{\lx@text@underscore}1,\dots,S_{\lx@text@underscore}l as a set of nonempty subsequences S\lx@text@underscorei=s\lx@text@underscoreb\lx@text@underscorei,s\lx@text@underscoreb\lx@text@underscorei+1,,s\lx@text@underscoree\lx@text@underscoreiS_{\lx@text@underscore}i=s_{\lx@text@underscore}{b_{\lx@text@underscore}i},s_{\lx@text@underscore}{b_{\lx@text@underscore}i+1},\dots,s_{\lx@text@underscore}{e_{\lx@text@underscore}i} such that s\lx@text@underscoreb\lx@text@underscore1=s\lx@text@underscore1s_{\lx@text@underscore}{b_{\lx@text@underscore}1}=s_{\lx@text@underscore}1, s\lx@text@underscoree\lx@text@underscorel=s\lx@text@underscorens_{\lx@text@underscore}{e_{\lx@text@underscore}l}=s_{\lx@text@underscore}n, and s\lx@text@underscoreb\lx@text@underscorei=s\lx@text@underscoree\lx@text@underscorei1+1s_{\lx@text@underscore}{b_{\lx@text@underscore}i}=s_{\lx@text@underscore}{e_{\lx@text@underscore}{i-1}+1} for all 1<il1<i\leq l.

Example 1.

Let S=3,5,1,2,8,2,3,4S=3,5,1,2,8,2,3,4. Then S\lx@text@underscore1=3,5,1S_{\lx@text@underscore}1=3,5,1, S\lx@text@underscore2=2,8S_{\lx@text@underscore}2=2,8, and S\lx@text@underscore3=2,3,4S_{\lx@text@underscore}3=2,3,4 is an ordered partition of SS.

2.2 Zero-suppressed decision diagrams

Given a set of variables X={x\lx@text@underscore1,,x\lx@text@underscoren}X=\{x_{\lx@text@underscore}1,\dots,x_{\lx@text@underscore}n\}, a ZDD [9, 7] is a directed acyclic graph with nonterminal vertices NN and two terminal vertices \top and \bot. Each non-terminal vertex vNv\in N is associated with a variable V(v){1,,n}V(v)\in\{1,\dots,n\} and two successor nodes HI(v),LO(v)N{,}\text{HI}(v),\text{LO}(v)\in N\cup\{\top,\bot\}. The nodes on a path follow a fixed variable order on the way to a terminal node. We have HI(v){,}\text{HI}(v)\in\{\top,\bot\} or V(HI(v))>V(v)V(\text{HI}(v))>V(v) for all vv.111To simplify the presentation in the paper, we assume the variable ordering 1<2<<n1<2<\cdots<n. In practice, any permutation of this order can be used. The same applies to LO(v)\text{LO}(v).

Each vertex in the ZDD represents a finite family of finite subsets over XX where families of sets are canonical up to order of the sets and repetition. The terminal node \bot represents the empty family \emptyset and the terminal node \top represents the unit family which is the set containing the empty set {}\{\emptyset\}. Each non-terminal vv represents the subset

LO(v){S{x\lx@text@underscoreV(v)}SHI(v)}.\text{LO}(v)\cup\{S\cup\{x_{\lx@text@underscore}{V(v)}\}\mid S\in\text{HI}(v)\}. (1)

A ZDD is reduced if there are no two vertices that represent the same sets. This implies that in a reduced ZDD there cannot be a vertex vv with HI(v)=\text{HI}(v)=\bot, since such a vertex represents the set LO(v)\text{LO}(v). For the sake of convenience, we use ϵ\lx@text@underscorex\epsilon_{\lx@text@underscore}x to denote the elementary family {{x}}\{\{x\}\} for each xXx\in X. Finally, we use \wp to refer to the ZDD that represents the universal family of all subsets of XX.

\bot\top443333222211{{x\lx@text@underscore2},{x\lx@text@underscore3},{x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}2\},\{x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}4\}\}{{x\lx@text@underscore2,x\lx@text@underscore3},{x\lx@text@underscore2,x\lx@text@underscore4},{x\lx@text@underscore3,x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}4\},\{x_{\lx@text@underscore}3,x_{\lx@text@underscore}4\}\}{{x\lx@text@underscore3},{x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}4\}\}{{x\lx@text@underscore3,x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}3,x_{\lx@text@underscore}4\}\}{{x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}4\}\}
Figure 1: A ZDD representing the family of sets {{x\lx@text@underscore1,x\lx@text@underscore2},{x\lx@text@underscore1,x\lx@text@underscore3},{x\lx@text@underscore1,x\lx@text@underscore4},{x\lx@text@underscore2,x\lx@text@underscore3},{x\lx@text@underscore2,x\lx@text@underscore4},{x\lx@text@underscore3,x\lx@text@underscore4}}\{\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}2\},\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}4\},\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}4\},\{x_{\lx@text@underscore}3,x_{\lx@text@underscore}4\}\}. All internal non-terminal nodes are annotated with the sets they represent. Dashed edges indicate LO and solid edges indicate HI.

We write |f||f| to denote the number of sets in a family ff. We write Z(f)Z(f) to denote the number of nodes, including the terminal nodes, of the reduced ZDD for ff. It should be noted that because of the reduction rules associated with ZDDs, the data structure is a canonical representation of a function with respect to a fixed variable order.

Example 2.

Fig. 1 shows a ZDD for f={{x\lx@text@underscore1,x\lx@text@underscore2},{x\lx@text@underscore1,x\lx@text@underscore3},{x\lx@text@underscore1,x\lx@text@underscore4},{x\lx@text@underscore2,x\lx@text@underscore3},{x\lx@text@underscore2,x\lx@text@underscore4},{x\lx@text@underscore3,x\lx@text@underscore4}}f=\{\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}2\},\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}4\},\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}3\},\{x_{\lx@text@underscore}2,x_{\lx@text@underscore}4\},\{x_{\lx@text@underscore}3,x_{\lx@text@underscore}4\}\}, i.e., all two-element subsets of X={x\lx@text@underscore1,x\lx@text@underscore2,x\lx@text@underscore3,x\lx@text@underscore4}X=\{x_{\lx@text@underscore}1,x_{\lx@text@underscore}2,x_{\lx@text@underscore}3,x_{\lx@text@underscore}4\}. We have |f|=6|f|=6 and Z(f)=8Z(f)=8. In the general case, the ZDD ff that represents all kk-element subsets of a set {x\lx@text@underscore1,,x\lx@text@underscoren}\{x_{\lx@text@underscore}1,\dots,x_{\lx@text@underscore}n\} has Z(f)=O(kn)Z(f)=O(kn) nodes, while representing |f|=(nk)|f|=\binom{n}{k} sets.

Given two ZDDs ff and gg, the following list of operations is part of what is called a ZDD family algebra. Each operation can be efficiently implemented using ZDDs.

fg\displaystyle f\cup g ={ααf or αg}\displaystyle=\{\alpha\mid\text{$\alpha\in f$ or $\alpha\in g$}\} union
fg\displaystyle f\cap g ={ααf and αg}\displaystyle=\{\alpha\mid\text{$\alpha\in f$ and $\alpha\in g$}\} intersection
fg\displaystyle f\setminus g ={ααf and αg}\displaystyle=\{\alpha\mid\text{$\alpha\in f$ and $\alpha\notin g$}\} difference
fg\displaystyle f\sqcup g ={αβαf and βg}\displaystyle=\{\alpha\cup\beta\mid\text{$\alpha\in f$ and $\beta\in g$}\} join
fg\displaystyle f\sqcap g ={αβαf and βg}\displaystyle=\{\alpha\cap\beta\mid\text{$\alpha\in f$ and $\beta\in g$}\} meet
fg\displaystyle f\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}g ={αfβg implies αβ}\displaystyle=\{\alpha\in f\mid\text{$\beta\in g$ implies $\alpha\not\supseteq\beta$}\} nonsupersets

Finally, if ff represents the family ϵ\lx@text@underscorex\lx@text@underscore1ϵ\lx@text@underscorex\lx@text@underscorel\epsilon_{\lx@text@underscore}{x^{\prime}_{\lx@text@underscore}1}\cup\cdots\cup\epsilon_{\lx@text@underscore}{x^{\prime}_{\lx@text@underscore}l} for some subset {x\lx@text@underscore1,,x\lx@text@underscorel}=XX\{x^{\prime}_{\lx@text@underscore}1,\dots,x^{\prime}_{\lx@text@underscore}l\}=X^{\prime}\subseteq X, then

(fk)\binom{f}{k}

is the ZDD that represents the family (Xk)\binom{X^{\prime}}{k}.

Note that the nonsupersets operation can be described in terms of the others: fg=f(fg)f\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}g=f\setminus(f\sqcup g). However, it may be more efficient to implement the operation explicitly in a ZDD package. For a detailed description of how ZDDs are represented in memory and how the ZDD family algebra operations are implemented, the reader is referred to the literature [7].

2.3 Physical Quantum Architectures

2.3.1 Rigetti

Rigetti has developed quantum machines based on solid-state, superconducting circuit technology. The company has also developed the Python library pyQuil as well as a software development kit (SDK) called Forest that can be used to write quantum algorithms, to interact with quantum processing units (QPUs), and to simulate quantum computing. The quantum instruction language Quil is used to specify algorithms for the Rigetti QPUs [14]. Within the SDK, it is possible to create custom architectures that can be targeted by the Rigetti compiler. To implement an algorithm on the Rigetti QPUs, complex gates must be decomposed into the native gate set of R\lx@text@underscorez(θ),R\lx@text@underscorex(kπ2)R_{\lx@text@underscore}z(\theta),R_{\lx@text@underscore}x(\frac{k\pi}{2}) where kk is an integer value, and the two-qubit operator CZCZ. As an additional constraint, CZCZ operations are limited with respect to where they may be placed on the device due to the constraints among qubits. The Rigetti compiler may be used to transform technology-independent circuits into forms that have the appropriate gate library and connections for QPU execution. This compiler performs mapping and minimization procedures, but the resulting circuits may not necessarily be the optimum solution.

2.3.2 IBM

IBM has also developed quantum computers based on solid-state, superconducting circuit technology. The Python SDK Qiskit is their tool for performing quantum information processing (QIP) with their platform. Quantum assembly language, or QASM, is used to specify quantum logic for execution on the IBM quantum machines [5]. In order for a quantum circuit to be executable on a real machine, the QASM specification must not only obey coupling map constrictions but also contain operators within the gate set of R\lx@text@underscorez(θ)R_{\lx@text@underscore}z(\theta), R\lx@text@underscorex(ϕ)R_{\lx@text@underscore}x(\phi), R\lx@text@underscorey(γ)R_{\lx@text@underscore}y(\gamma), and the two-qubit operator CXCX. The compiler contained in the Qiskit SDK may be used for transforming circuits into a technology-ready form, but as with the Rigetti compiler, solutions may not be optimum. Qiskit allows for compilation to custom architectures so that devices outside of the existing IBM machines may be targeted.

3 Problem formulation

In this paper, we model the quantum circuit that is to be mapped to a quantum device as a set of pseudo qubits V={v\lx@text@underscore1,,v\lx@text@underscoren}V=\{v_{\lx@text@underscore}1,\dots,v_{\lx@text@underscore}n\} and an ordered sequence of two-qubit gates G\lx@text@underscorej=g\lx@text@underscore1,,g\lx@text@underscorenG_{\lx@text@underscore}j=g_{\lx@text@underscore}1,\dots,g_{\lx@text@underscore}n, with g\lx@text@underscorei(V2)g_{\lx@text@underscore}i\in\binom{V}{2}. We can safely ignore the one-qubit gates in the circuit, since the coupling constraints of the device do not affect their mapping. Also note that we do not take the direction of a gate (e.g., the position of control and target in a CXCX) into account as unidirectional gates may be reversed, as seen in [12], with single qubit operations.

aabbccdd
(a) Circuit
AABBCCDD
(b) Device
AABBCCDD
(c) Mapped circuit
Figure 2: Simple circuit and device
Example 3.

Fig. 2(a) shows a quantum circuit on four pseudo qubits V={a,b,c,d}V=\{a,b,c,d\} and three two-qubit gates g\lx@text@underscore1={a,b}g_{\lx@text@underscore}1=\{a,b\}, g\lx@text@underscore2={b,c}g_{\lx@text@underscore}2=\{b,c\}, and g\lx@text@underscore3={b,d}g_{\lx@text@underscore}3=\{b,d\}.

A quantum device is modeled by an undirected graph (P,E)(P,E), where P={p\lx@text@underscore1,,p\lx@text@underscorem}P=\{p_{\lx@text@underscore}1,\dots,p_{\lx@text@underscore}m\} is a set of physical qubits and an edge {p,q}E(P2)\{p,q\}\in E\subseteq\binom{P}{2} states that a 2-qubit operation can be executed using the two physical qubits pp and qq.

Example 4.

Fig. 2(b) shows a simple four-qubit quantum device with physical qubits P={A,B,C,D}P=\{A,B,C,D\} and a ring topology, i.e., edges E={{A,B},{B,C},{C,D},{D,A}}.E=\{\{A,B\},\{B,C\},\{C,D\},\{D,A\}\}.

The goal is to find a mapping φ:VP\varphi:V\to P of pseudo qubits into physical ones, such that all two-qubit operations in the circuit are executed on adjacent qubits according to the device’s coupling constraints. It may not be possible to find such mapping for the input circuit. For example, there exists no such mapping for the example circuit, since the pseudo qubit bb interacts with three other qubits. However, by adding SWAP gates to reorder pseudo qubits, a mapping can be achieved. A SWAP gate is a two-qubit operation that can either be implemented with CXCX or single-qubit rotations and CZCZ.

Example 5.

By adding a SWAP gate after the second gate of the circuit in Fig. 2(a), one must update all successive gates in order to retain the functionality as is seen in Fig. 2(c). However, the transformed circuit can now be mapped to the quantum device by mapping aAa\mapsto A, bBb\mapsto B, cCc\mapsto C, and dDd\mapsto D.

The aim is to use a small number of SWAP gates when transforming an initial circuit to a circuit that can be mapped into a target device. Finding the globally optimum mapping and a transformed circuit using the fewest number of SWAP gates is a computationally complex and time-consuming task [3].

To address the problem of finding maximal partitions for a circuit using ZDDs, we use partitions where

  • there exists a (V,G\lx@text@underscorej)(V,G_{\lx@text@underscore}j) that is a subgraph of (P,E)(P,E) for 1jl1\leq j\leq l,

  • there is not a (V,G\lx@text@underscorej{g\lx@text@underscoree\lx@text@underscorej+1})(V,G_{\lx@text@underscore}j\cup\{g_{\lx@text@underscore}{{e_{\lx@text@underscore}j+1}}\}) that is a subgraph of (P,E)(P,E) for 1j<l1\leq j<l.

Each partition has an associated set of mappings of pseudo to physical qubits Φ\lx@text@underscorej={φ:VP}\Phi_{\lx@text@underscore}j=\{\varphi:V\mapsto P\}\ where φ\varphi is a subgraph isomorphism of (V,G\lx@text@underscorej)(V,G_{\lx@text@underscore}j) to (P,E)(P,E). If partition G\lx@text@underscorejG_{\lx@text@underscore}j starting at gate g\lx@text@underscorebg_{\lx@text@underscore}b cannot be extended, SWAP operations are inserted to merge the last gate of the partition, g\lx@text@underscoreeg_{\lx@text@underscore}e with the adjacent gate, g\lx@text@underscoree+1g_{\lx@text@underscore}{e+1}, in the circuit. These swapping operations, referred to as layers, exchange information on the adjacent physical qubits of the device and are executable in parallel within a single time cycle. The best SWAP layer is chosen according to a scoring metric. Once selected, the SWAP layer merges the gate g\lx@text@underscoreig_{\lx@text@underscore}{i} with g\lx@text@underscorei+1g_{\lx@text@underscore}{i+1} by inserting SWAP gates before g\lx@text@underscorei+1g_{\lx@text@underscore}{i+1}, extending G\lx@text@underscorejG_{\lx@text@underscore}j.

Ideally, a single partition will cover the entire circuit, providing a set of mappings that assign pseudo qubits to physical qubits on the device. In the case that multiple partitions exist that are fully extended with inserted SWAP layers, a mapping for the circuit is selected using the largest, and therefore maximal, partition.

Definition 1.

Maximal Partition
A maximal partition within a quantum circuit is the largest subset of gates G\lx@text@underscorejG_{\lx@text@underscore}j that can be covered by a set of mappings of pseudo to physical qubits, Φ\lx@text@underscorej\Phi_{\lx@text@underscore}j. Maximal partitions are fully expanded with parallel SWAP operations that exchange information between physical qubits.

4 Finding maximal partitions

In this section, we describe how to use ZDDs and ZDD operations to find a maximal partition that starts in some gate g\lx@text@underscoreig_{\lx@text@underscore}i. The ZDDs are defined over the nmnm variables vpvp for each vVv\in V and each pPp\in P. Each ZDD represents a family of finite subsets, and each subset α\alpha represents a partial mapping φ:VP\varphi:V\to P, where φ(v)=p\varphi(v)=p, if and only if vpαvp\in\alpha where α\alpha is a mapping.

Example 6.

The ZDD f={{aA,bB,cC,dD}}f=\{\{aA,bB,cC,dD\}\} represents a family of a single mapping that maps aAa\mapsto A, bBb\mapsto B, cCc\mapsto C, and dDd\mapsto D.

First, we define some general sets, which are used throughout the following operations. It is sufficient to initialize these sets once at the beginning of the algorithm. The set

from(v)=\lx@text@underscorepPϵ\lx@text@underscorevp\textit{from}(v)=\bigcup_{\lx@text@underscore}{p\in P}\epsilon_{\lx@text@underscore}{vp} (2)

contains all singleton mappings vpv\mapsto p for some vVv\in V. Analogously, the set

to(p)=\lx@text@underscorevVϵ\lx@text@underscorevp\textit{to}(p)=\bigcup_{\lx@text@underscore}{v\in V}\epsilon_{\lx@text@underscore}{vp} (3)

contains all singleton mappings vpv\mapsto p for some pPp\in P.

Example 7.

For the example circuit and device we have from(a)={{aA},{aB},{aC},{aD}}\textit{from}(a)=\{\{aA\},\{aB\},\{aC\},\{aD\}\} and to(A)={{aA},{bA},{cA},{dA}}\textit{to}(A)=\{\{aA\},\{bA\},\{cA\},\{dA\}\}.

Using this set, we can define two other helpful sets, valid and bad, using the ZDD family algebra operations. The set valid contains all two-element partial mappings that are feasible with respect to the coupling constraints of the device:

valid=\lx@text@underscore{p,q}Eto(p)to(q)\textit{valid}=\bigcup_{\lx@text@underscore}{\{p,q\}\in E}\textit{to}(p)\sqcup\textit{to}(q) (4)

The set bad contains all two element sets of illegal partial mappings, because they either contain an element with two images or two elements which map to the same image:

bad=\lx@text@underscorevV(from(v)2)\lx@text@underscorepP(to(p)2)\textit{bad}=\bigcup_{\lx@text@underscore}{v\in V}\binom{\textit{from}(v)}{2}\cup\bigcup_{\lx@text@underscore}{p\in P}\binom{\textit{to}(p)}{2} (5)
Lemma 1.

βbad\beta\in\textit{bad} if and only if either β={vp,vq}\beta=\{vp,vq\} and pqp\neq q or β={vp,wp}\beta=\{vp,wp\} and vwv\neq w, for all v,wVv,w\in V and all p,qPp,q\in P.

Proof.

Note that

(f2)=(ff)f\binom{f}{2}=(f\sqcup f)\setminus f

if ff only contains singletons. Therefore, (from(v)2)\binom{\textit{from}(v)}{2} contains all sets {vp,vq}\{vp,vq\} where pqp\neq q. Similarly, (to(p)2)\binom{\textit{to}(p)}{2} contains all sets {vp,wp}\{vp,wp\} for vwv\neq w. For the other direction, note that all pairs are included due to the construction of from and to in Eqn. 2 and Eqn. 3.

Corollary 1.

A set α\alpha represents a partial mapping if and only if all two-element, illegal mappings are removed where a single pseudo qubit is assigned to multiple physical qubits or where multiple pseudo qubits are assigned to a single physical qubit. Thus, there exists no βbad\beta\in\textit{bad} such that βα\beta\subseteq\alpha, respectively.

Last, we define the set map(i)\textit{map}(i) which represents all possible mappings of the pseudo qubits in gate g\lx@text@underscorei={v,w}g_{\lx@text@underscore}i=\{v,w\}:

map(i)=(from(v)from(w))valid\textit{map}(i)=(\textit{from}(v)\sqcup\textit{from}(w))\cap\textit{valid} (6)

In other words, we first join all possible mappings of vv with all possible mappings of ww, before we restrict the result two-element subsets to those which are valid with respect to the target device.

Example 8.

Gate g\lx@text@underscore1={a,b}g_{\lx@text@underscore}1=\{a,b\} can be mapped in eight different ways:

map(1)\displaystyle\textit{map}(1) ={{aA,bB},{aB,bC},{aC,bD},{aD,bA}\displaystyle=\{\{aA,bB\},\{aB,bC\},\{aC,bD\},\{aD,bA\}
{aB,bA},{aC,bB},{aD,bC},{aA,bD}}\displaystyle\phantom{{}=\{{}}\{aB,bA\},\{aC,bB\},\{aD,bC\},\{aA,bD\}\}

Also gate g\lx@text@underscore2={b,c}g_{\lx@text@underscore}2=\{b,c\} can be mapped in eight different ways:

map(2)\displaystyle\textit{map}(2) ={{bA,cB},{bB,cC},{bC,cD},{bD,cA}\displaystyle=\{\{bA,cB\},\{bB,cC\},\{bC,cD\},\{bD,cA\}
{bB,cA},{bC,cB},{bD,cC},{bA,cD}}\displaystyle\phantom{{}=\{{}}\{bB,cA\},\{bC,cB\},\{bD,cC\},\{bA,cD\}\}

Finally, the possible mappings of two consecutive gates g\lx@text@underscoreig_{\lx@text@underscore}i and g\lx@text@underscorei+1g_{\lx@text@underscore}{i+1} can be computed using

(map(i)map(i+1))bad.(\textit{map}(i)\sqcup\textit{map}(i+1))\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}\textit{bad}. (7)
Example 9.

Recall the two families map(1)\textit{map}(1) and map(2)\textit{map}(2) from the previous example. Joining them leads to a family with up to 64 subsets, out of which many do not represent legal partial mappings such as {aA,bB,bA,cB}\{aA,bB,bA,cB\}. These can be removed using the restriction to bad, resulting a family consisting of the only eight legal partial mappings:

{{aA,bB,cC},{aB,bC,cD},{aC,bD,cA},{aD,bA,cB},{aA,bD,cC},{aB,bA,cD},{aC,bB,cA},{aD,bC,cB}}\{\{aA,bB,cC\},\{aB,bC,cD\},\{aC,bD,cA\},\\ \{aD,bA,cB\},\{aA,bD,cC\},\{aB,bA,cD\},\\ \{aC,bB,cA\},\{aD,bC,cB\}\}
Data: Gate sequence g\lx@text@underscore1,,g\lx@text@underscorekg_{\lx@text@underscore}1,\dots,g_{\lx@text@underscore}k, and device (P,E)(P,E)
Result: partitions G\lx@text@underscorejG_{\lx@text@underscore}j with begin and end indexes b\lx@text@underscorej,e\lx@text@underscorejb_{\lx@text@underscore}j,e_{\lx@text@underscore}j; all possible mappings Φ\lx@text@underscorej\Phi_{\lx@text@underscore}j
Set j1j\leftarrow 1, b\lx@text@underscorej1b_{\lx@text@underscore}j\leftarrow 1, mmap(1)m\leftarrow\textit{map}(1);
for i=2,,ki=2,\dots,k do
  Set m(mmap(i))badm^{\prime}\leftarrow(m\sqcup\textit{map}(i))\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}\textit{bad};
 if m=m^{\prime}=\emptyset then
    for layerlayer in layerslayers do
        calculate scores;
       
      end for
    if max score 0\neq 0 then
        insert SWAP circuit;
         update topology;
         Set m(m(max score)(mmap(i))bad)^{\prime}\leftarrow(m\sqcup\textit{map}(i))\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}\textit{bad};
         Set mmm\leftarrow m^{\prime};
       
    else
        Set e\lx@text@underscoreji1e_{\lx@text@underscore}j\leftarrow i-1, Φ\lx@text@underscorejm\Phi_{\lx@text@underscore}j\leftarrow m;
         Set jj+1j\leftarrow j+1, b\lx@text@underscorejib_{\lx@text@underscore}j\leftarrow i, mmap(i)m\leftarrow\textit{map}(i);
       
      end if
    
 else
     Set mmm\leftarrow m^{\prime};
    
   end if
 
end for
Set e\lx@text@underscorejke_{\lx@text@underscore}j\leftarrow k, Φ\lx@text@underscorejm\Phi_{\lx@text@underscore}j\leftarrow m;
Algorithm 1 Find maximal partitions

In some instances, Eqn. 7 results in the empty set, \emptyset, whenever the mappings of two consecutive gates are combined. In this case, SWAP procedures must be performed on physical qubits to exchange pseudo qubit information and extend the partition G\lx@text@underscorejG_{\lx@text@underscore}j.

Finding an ideal SWAP circuit during quantum circuit mapping is an intractable problem that works in an exponentially-growing state space. In our method, we narrow this search space by focusing on the implementation of all SWAP circuits that can be executed in parallel during a single time cycle. We call this particular set of SWAP circuits layers, and it is a combination set rather than permutation set of ordered SWAP operations. ZDDs are a good data structure for combinatorial set representation, so a ZDD is implemented to represent the layers set. Acceptable SWAP operations are determined by the topology of the device, and the sets of operations that can be executed simultaneously within a time cycle are desired. ZDDs are used to create a set of all “good” SWAP circuits, which are those that interact with at least one qubit in the image of φ\varphi and the depth of the circuit is one, i.e., a SWAP circuit may only contain multiple SWAP gates as long as qubits between gates are not shared. The ZDDs for this task differ from those used to enumerate all mappings, and they do not share any variables. The SWAP circuit ZDDs are defined over the |E||E| variables ee for each eEe\in E since SWAP gates can only be placed on certain edges connecting physical qubits according to the quantum device operational characteristics. We initialize the ZDD base, or the 1-terminal node, with the following ZDD. For each pPp\in P, the ZDD

edges(p)={ϵ\lx@text@underscoreeeE s.t. pe}\textit{edges}(p)=\bigcup\{\epsilon_{\lx@text@underscore}e\mid\text{$e\in E$ s.t. $p\in e$}\} (8)

contains all SWAPs that interact with qubit pp.

All possible subsets of SWAP gates that can be executed in parallel (i.e., in depth 1) are described by the ZDD

layers=\lx@text@underscorepP(edges(p)2).\textit{layers}=\wp\mathbin{\text{\raisebox{1.0pt}{$\scriptstyle\searrow$}}}\bigcup_{\lx@text@underscore}{p\in P}\binom{\textit{edges}(p)}{2}. (9)
Example 10.

The set of SWAP gates that can be parallelized for the topology in Fig. 2(b) can be determined using Eqn. 9. First, the set of edges for all physical qubits pp in PP must be defined:

edges(A)={{AB},{AD}},edges(A)=\{\{AB\},\{AD\}\},
edges(B)={{AB},{BC}},edges(B)=\{\{AB\},\{BC\}\},
edges(C)={{BC},{CD}},edges(C)=\{\{BC\},\{CD\}\},
edges(D)={{CD},{AD}}.edges(D)=\{\{CD\},\{AD\}\}.

Next, a set must be created that consists of the union of all of the (Nk)\binom{N}{k} operations where N=edges(p)N=edges(p) and k=2k=2:

\lx@text@underscorepP(edges(p)2)={{AB,AD},{AB,BC},{BC,CD},{CD,AD}}.\bigcup_{\lx@text@underscore}{p\in P}\binom{\textit{edges}(p)}{2}=\{\{AB,AD\},\{AB,BC\},\{BC,CD\},\{CD,AD\}\}.

Finally, the nonsupersets operation is implemented between the tautology, or universal family of all subsets for the physical qubit edges. The set \wp is defined as

={,{AB},{BC},{CD},{AD},{AB,BC},{AB,CD},{AB,AD},{BC,CD},{BC,AD},{CD,AD},{AB,BC,CD},{AB,BC,AD},{AB,CD,AD},{BC,CD,AD},{AB,BC,CD,AD}},\wp=\{\emptyset,\{AB\},\{BC\},\{CD\},\{AD\},\{AB,BC\},\{AB,CD\},\{AB,AD\},\{BC,CD\},\{BC,AD\},\\ \{CD,AD\},\{AB,BC,CD\},\{AB,BC,AD\},\{AB,CD,AD\},\{BC,CD,AD\},\{AB,BC,CD,AD\}\},

allowing the layers for the device in 2(b) to be calculated as

layers={,{AB},{BC},{CD},{AD},{AB,CD},{BC,AD}}.\textit{layers}=\{\emptyset,\{AB\},\{BC\},\{CD\},\{AD\},\{AB,CD\},\{BC,AD\}\}.

Not all combinations of SWAP gates in layers may be useful for extending a partition of gates. For example, some SWAP circuits may allow the partition G\lx@text@underscorejG_{\lx@text@underscore}j to extend further and have greater depth while others provide more mapping options within Φ\lx@text@underscorej\Phi_{\lx@text@underscore}j. As a result, a scoring function is calculated for each member of layers to determine the optimal SWAP decision every time it is desired to extend a circuit partition. The function of

score=(Aα+Bβ)γCscore=\left(A\alpha+B\beta\right)\frac{\gamma}{C} (10)

is used to select the optimal SWAP circuit according priority weights set by the user and feature counts of the circuit being mapped. In Eqn. 10, α\alpha is depth weight and AA is depth count where depth count in this case describes how many additional two-qubit gates the current partition could cover until the end of the partition is reached if a specific SWAP circuit is implemented. The variable β\beta is map weight and BB is map count that describes how many maps of pseudo to physical qubits, φ:VP\varphi:V\to P, will be available in Φ\lx@text@underscorej\Phi_{\lx@text@underscore}j if a specific swap circuit is implemented. Finally γ\gamma is SWAP weight and and CC is SWAP operation count of the implemented SWAP circuit. In Eqn. 10, SWAP count has an inverse relationship with a layer’s score as lower overall gate counts, or gate volume, in a technology-mapped implementation are preferred. The parameter γ\gamma, however, can be adjusted to make the cost of an additional SWAP operations less severe. The weights of this function can be tuned to prioritize the growth of the partition with respect to either gate coverage or available mappings if a SWAP circuit layer in layers is implemented. In the case that score for each layer is zero, the current partition cannot be extended and a new partition must start to continue to map the circuit.

Algorithm 1 implements ZDD data structures and the aforementioned ZDD operations to compute maximal partitions of quantum circuits starting from the first gate. A counter jj indicates the current partition number as the algorithm parses through the operators in the network. In mm, a set of mappings are stored and updated as the current partition increases in size. These maps are eventually stored in Φ\lx@text@underscorej\Phi_{\lx@text@underscore}j. For each gate ii we try to extend mm by adding the gate using map(i)\textit{map}(i), and storing the resulting mappings in mm^{\prime}. If mm^{\prime} is empty, layerslayers will be used to determine if a SWAP operation can be implemented in order to increase the current partition. The scoresscores for all of the sets in layerslayers are calculated, and the SWAP circuit with the largest scorescore is used to extend the partition. After the SWAP is implemented, the topology of the device is updated, maximum scorescore mm^{\prime} is calculated, and mm is updated with mm^{\prime}. If the maximum scorescore is zero, then the then the current partition ends at i1i-1, and a new partition j+1j+1 starts at gate ii.

5 ZDD mapping in the quantum compilation flow

The algorithm discussed in the previous section implements the mapping of pseudo qubits in a quantum circuit specification to physical qubits on a real device. While the mapping procedure is essential for for quantum compilation, additional optimization steps can further improve the technology-mapped logic. For this reason, we propose the incorporation of the ZDD mapping techniques into a larger logic synthesis flow. In this procedure, mapping would occur after a circuit has been decomposed into one- and two-qubit operators and before a specification is compiled by a device’s custom compilation tool. Completing synthesis with available compilation tools allows the opportunity to take advantage of existing optimization algorithms while the operators of the circuit are transformed into a platform’s native gate library. Additionally, if the maximal partition found by the ZDD mapper does not cover the entire circuit, the native compiler of the technology platform is required to ensure that the placement of the two-qubit operators does not violate the coupling constraints of the device. It should be noted that although the ZDD mapping algorithm was evaluated using superconducting qubits as a target platform, the techniques described here are applicable to other quantum technologies that have coupling restrictions.

6 Experimental results

The ZDD quantum mapping algorithm was developed in C++ and was incorporated in the tweedledum logic synthesis library found in reference [11]. A subset of benchmarks from [2] were selected to evaluate the methods described in this work. These benchmarks contain a variety of reversible arithmetic and quantum algorithms such as a Grover’s algorithm oracle, a demonstration of the Quantum Fourier Transform (QFT), and various Toffoli implementations. The benchmark set was chosen for experimentation because they are functions commonly seen in quantum synthisis literature and are publicly available for use. These benchmarks are originally specified in a .qc file format with a gate set that contains physically unrealizable multi-qubit gates. Thus, the specifications are transformed into the Clifford+T library of single- and two-qubit gates using the “phasefold” pass of the Feynman toolkit [2] . After this procedure, the benchmarks are in a technology-independent form that consists of elementary gates. Mapping to a target quantum device may now begin.

A ring topology was chosen as the target device during synthesis. A ring structure was chosen because this type of architecture is seen in commercial QPUs like in Rigetti’s Agave and Aspen quantum machines. Additionally, the benefit of this structure is that it allows for a homogeneous testing environment that is flexible in size while using benchmarks that vary in number of pseudo qubits. Each benchmark was targeted to a device that contained nn physical qubits where nn is the number of pseudo qubits in a quantum algorithm. In these devices, all qubits are connected to their two adjacent neighbors, as seen in Fig. 2(b), and the connections are bidirectional with respect to the placement of the two-qubit CXCX gate. Once the circuit and topology are selected, Algorithm 1 is applied to map the pseudo qubits in the design to physical qubits. The scoring operation of Eqn. 10 that chooses between the SWAP circuits in layerslayers to extend the partition is set to zero, one, and one for the depth, map, and SWAP weights, respectively. If the benchmark can be covered by an entire partition during the application of Algorithm 1, then the resulting specification is in a fully technology-mapped form and therefore compatible with the available connections of the target device. If multiple partitions are needed for a benchmark, the resulting specification is mapped using a permutation of the largest partition, making additional SWAP operations required for the design to be fully compatible with the target technology. This additional circuit modification is accomplished by the custom compilers that are provided with the Rigetti and IBM SDKs. Compiling the ZDD mapped circuits into the selected device topology with the available Rigetti and IBM compilers is the final procedure in the mapping flow. This step also ensures that all algorithm operations are translated into gates appropriate for the target device. Note that such a translation cannot lead to any further violations of the coupling constraints. After the final compilation step, the circuits are ready for execution on their respective platform since they are in a technology-mapped and optimized form. Details about the benchmarks along with experimental results of the mapping and compilation procedures can be found in Table 1.

In Table 1, details about gate depth, gate volume, and two-qubit gate count have been included for the ZDD mapped and compiled circuits. Metrics for the benchmarks after transformation with just the ZDD mapping procedures are also shown for reference. It should be noted that circuits transformed with only the ZDD mapper can include additional SWAP circuitry to expand the mapping partitions, and only if the maximal partition covers the entire benchmark is the resulting circuit fully mapped for the target technology. Because it is often the case that multiple partitions cover a benchmark and the maximum partition must be chosen for pseudo to physical qubit mapping, transformation by the native compiler is required. This synthesis procedure also confirms that the benchmark circuits use the appropriate gate library for the targeted technology. The benchmarks were compiled with and without preprocessing the circuit with the ZDD mapper. Circuits that improved in metrics for a particular device and benchmark whenever ZDD mapping was implemented are emphasized. On average, benchmarks mapped to a Rigetti ring topology saw a decrease of around 10% with respect to gate depth, gate volume, and two-qubit gate count whenever ZDD mapping was included in technology-dependent logic synthesis flow before compilation. The IBM-compiled circuits, however, only saw an average decrease of 2.3% in gate depth, gate volume, and two-qubit gate count whenever ZDD mapping was used. Individual improvements in circuit metrics of up to approximately a 50% decrease was seen in gate volume on the Rigetti devices and up to approximately a 44% decrease was seen in depth on the IBM devices. These findings demonstrate the potential that ZDD mapping techniques have with respect to finding more optimal solutions whenever generating technology-dependent forms of quantum circuits.

Table 1: Gate depth, gate volume, and two-qubit metrics of benchmarks after zdd mapping, IBM compiling, and Rigetti compiling. Values that decreased whenever ZDD mapping was implemented before compilation have been emphasized.
Benchmark No. Original ZDD Original Rigetti Original IBM ZDD Mapped/ ZDD Mapped/
Name Qubits Mapped Compiled Compiled Rigetti Compiled IBM Compiled
barenco_tof_3 5 depth: 64 118 62 98 (-16.95%) 84 (+35.48%)
vol.: 95 446 180 221 (-50.45%) 165 (-8.33%)
2q gates: 73 68 67 58 (-14.71%) 63 (-5.97%)
barenco_tof_4 7 depth: 94 230 131 155 (-32.6%) 130 (-0.76%)
vol: 190 763 462 449 (-41.15%) 335 (-27.49%)
2q gates: 152 123 177 117 (-4.88%) 132 (-25.42%)
barenco_tof_5 9 depth: 94 231 121 155 (-32.9%) 130 (+7.44%)
vol.: 285 1136 528 682 (-39.96%) 505 (-4.36%)
2q gates: 231 184 201 177 (-3.8%) 201 (+0%)
gf2\wedge4_mult 12 depth: 46 337 251 361 (+7.12%) 354 (+41.03%)
vol: 232 2319 1450 2593 (+11.82%) 1511 (+4.21%)
2q gates: 145 363 557 430 (+18.46%) 587 (+5.39%)
gf2\wedge5_mult 15 depth: 64 422 259 504 (+19.43%) 342 (+32.05%)
vol: 363 3747 2212 4510 (+20.36%) 2351 (+6.28%)
2q gates: 230 596 842 775 (+30.03 %) 910 (+8.07%)
grover_5 9 depth: 210 968 989 872 (-9.92%) 552 (-44.19%)
vol: 777 4857 2909 4484 (-7.68%) 2590 (-10.97%)
2q gates: 441 781 1096 739 (-5.38%) 1011 (-7.76%)
hwb6 7 depth: 113 449 269 432 (-3.79%) 290 (+7.81 %)
vol: 303 2032 1049 2027 (-0.25%) 1101 (+4.96%)
2q gates: 185 332 404 338 (+1.81%) 422 (+4.46%)
mod_mult _55 9 depth: 49 189 123 177 (-6.35 %) 144 (+17.07 %)
vol: 155 978 500 850 (-13.09 %) 469 (-6.2%)
2q gates: 88 151 193 143 (-5.3 %) 176 (-8.81%)
mod_5 _4 5 depth: 60 115 94 95 (-17.4%) 92 (-2.13%)
vol: 121 459 229 308 (-32.9%) 239 (+4.37%)
2q gates: 98 73 88 79 (+8.21%) 92 (+4.55%)
qft _4 5 depth: 142 162 155 137 (-15.43%) 105 (-32.26%)
vol: 247 447 322 433 (-3.13%) 293 (-9.01%)
2q gates: 120 79 126 92 (+16.46%) 114 (-9.52%)
tof_3 5 depth: 39 98 62 72 (-26.53%) 61 (-1.61%)
vol.: 75 309 145 195 (-36.89%) 135 (-6.9%)
2q gates: 54 47 53 45 (-4.26%) 52 (-1.89%)
tof _4 7 depth: 46 117 98 88 (-24.79%) 62 (-36.73%)
vol: 125 505 326 327 (-35.25%) 218(-33.12%)
2q gates: 92 80 121 75 (-6.25%) 84 (-30.58%)
tof _5 9 depth: 46 118 68 89 (-24.58%) 62 (-8.82%)
vol: 175 707 335 459 (-35.08%) 308 (-8.06%)
2q gates: 130 112 132 106 (-5.36%) 118 (-10.61%)
vbe _adder _3 10 depth: 67 216 165 197 (-8.8%) 232 (+40.61%)
vol: 162 1244 765 1131 (-9.08%) 835 (+9.15%)
2q gates: 122 190 294 195 (+2.63%) 329 (+11.9%)

7 Conclusion

We present a method for mapping quantum logic circuits to actual devices using ZDDs. The required operations and algorithm are described, and the implementation is developed and tested in a quantum compilation flow that targets devices meant for the Rigetti and IBM families of superconducting quantum computers. When experimental results are evaluated, it is observed that incorporating ZDD mapping into quantum logic synthesis in many cases allowed for more optimal circuits to be found in their technology-dependent form. These results suggest that the ZDD may be a useful tool for quantum compilation that should be continued to be investigated in the future.

Acknowledgements.

The author thanks Alan Mishchenko for helpful discussion and comments. This work was supported by the Swiss National Science Foundation in the project "Technology-dependent Optimization in Quantum Compilation" (IZSEZ0184016).

Appendix A Implementation of ZDD operations

In [7, Ex. 7.1.4-207], Knuth describes the implementation of a ZDD operation f§kf\mathbin{\S}k, which is similar to the operation (fk)\binom{f}{k}, which is used in this paper. No description of an implementation for (fk)\binom{f}{k} was found in the literature, and therefore we report our implementation here, in a similar style Knuth used to describe the implementation of f§kf\mathbin{\S}k.

CHOOSE(f,k)\text{CHOOSE}(f,k) = “If k=1k=1, return ff. If f=f=\emptyset and k>0k>0, return \emptyset. If f=f=\emptyset and k=0k=0, return {}\{\emptyset\}. If (fk)=r\binom{f}{k}=r is in the cache, return rr. Otherwise set rCHOOSE(f\lx@text@underscorel,k)r\leftarrow\text{CHOOSE}(f_{\lx@text@underscore}l,k). If k>0k>0, set qCHOOSE(f\lx@text@underscorel,k1)q\leftarrow\text{CHOOSE}(f_{\lx@text@underscore}l,k-1) and rZUNIQUE(f\lx@text@underscorev,r,q)r\leftarrow\text{ZUNIQUE}(f_{\lx@text@underscore}v,r,q). Put (fk)=r\binom{f}{k}=r in the cache, and return rr.”

References

  • [1]
  • [2] Matthew Amy (2019): Feynman. Available at https://github.com/meamy/feynman.
  • [3] Adi Botea, Akihiro Kishimoto & Radu Marinescu (2018): On the Complexity of Quantum Circuit Compilation. In: Int’l Symp. on Combinatorial Search, pp. 138–142. Available at https://aaai.org/ocs/index.php/socs/socs18/paper/view/17959.
  • [4] Andrew M Childs, Eddie Schoute & Cem M Unsal (2019): Circuit Transformations for Quantum Architectures. arXiv preprint arXiv:1902.09102.
  • [5] Andrew W Cross, Lev S Bishop, John A Smolin & Jay M Gambetta (2017): Open Quantum Assembly Language. arXiv preprint arXiv:1707.03429.
  • [6] Wakaki Hattori & Shigeru Yamashita (2018): Quantum Circuit Optimization by Changing the Gate Order for 2D Nearest Neighbor Architectures. In: Int’l Conf. on Reversible Computation, pp. 228–243, 10.1007/978-3-319-99498-7_16.
  • [7] Donald Ervin Knuth (2011): The Art of Computer Programming, Volume 4A. Addison-Wesley.
  • [8] Gushu Li, Yufei Ding & Yuan Xie (2018): Tackling the Qubit Mapping Problem for NISQ-Era Quantum Devices. arXiv preprint arXiv:1809.02573.
  • [9] Shin-ichi Minato (1993): Zero-Suppressed BDDs for Set Manipulation in Combinatorial Problems. In: Design Automation Conference, pp. 272–277, 10.1145/157485.164890.
  • [10] John Preskill (2018): Quantum Computing in the NISQ era and beyond. Quantum 2, p. 79, 10.22331/q-2018-08-06-79.
  • [11] Bruno Schmitt et al. (2019): Tweedledum. Available at https://github.com/boschmitt/tweedledum.
  • [12] Marcos Yukio Siraichi, Vinícius Fernandes dos Santos, Sylvain Collange & Fernando Magno Quintão Pereira (2018): Qubit Allocation. In: Int’l Symp. on Code Generation and Optimization, pp. 113–125, 10.1145/3168822.
  • [13] Kaitlin N. Smith & Mitchell A. Thornton (2018): Automated Mapping Methods for the IBM Transmon Devices. In: International Workshop on Post-Binary ULSI Systems (ULSI-WS), pp. 12–17. Available at https://s2.smu.edu/˜mitch/ftp_dir/pubs/ulsiws18.pdf.
  • [14] Robert S Smith, Michael J Curtis & William J Zeng (2016): A Practical Quantum Instruction Set Architecture. arXiv preprint arXiv:1608.03355.
  • [15] Alwin Zulehner, Alexandru Paler & Robert Wille (2018): An Efficient Methodology for Mapping Quantum Circuits to the IBM QX Architectures. arXiv preprint arXiv:1712.04722v3.