A common approach to quantum circuit transformation is to use the properties of a specific gate set to create an efficient representation of a given circuit's unitary, such as a parity matrix or stabiliser tableau, and then resynthesise an improved circuit, e.g. with fewer gates or respecting connectivity constraints. Since these methods rely on a restricted gate set, generalisation to arbitrary circuits usually involves slicing the circuit into pieces that can be resynthesised and working with these separately. The choices made about what gates should go into each slice can have a major effect on the performance of the resynthesis. In this paper we propose an alternative approach to generalising these resynthesis algorithms to general quantum circuits. Instead of cutting the circuit into slices, we “cut out” the gates we can't resynthesise leaving holes in our quantum circuit. The result is a second-order process called a quantum comb, which can be resynthesised directly. We apply this idea to the RowCol algorithm, which resynthesises CNOT circuits for topologically constrained hardware, explaining how we were able to extend it to work for quantum combs. We then compare the generalisation of RowCol using our method to the naïve “slice and build” method empirically on a variety of circuit sizes and hardware topologies. Finally, we outline how quantum combs could be used to help generalise other resynthesis algorithms.

§ INTRODUCTION

Current quantum computers suffer from severe limitations such as high error rates, low numbers of qubits, and connectivity constraints for multi-qubit operations. Furthermore, without error correction, the poor fidelity of current gate implementations compounds over the execution of the circuit, so it advantageous to find the smallest possible circuit to represent an algorithm.

Using the properties of a specific gate set, an efficient representation of a circuit's unitary can be resynthesised into an improved circuit. For example, the unitary action of CNOT circuits can be fully described by the associated $\mathbb F_2$-linear function over basis vectors on $n$-qubit space, seen as vectors in $\mathbb F_2^n$. In other words, we can represent the action of a CNOT circuit using a matrix over $\mathbb F_2$, called its parity matrix.

Noting that the parity matrix of a single CNOT gate corresponds to an elementary row operation, it is possible to resynthesise a CNOT circuit from its parity matrix by performing Gauss-Jordan elimination to reduce the matrix to identity and introducing one CNOT gate for each corresponding row operation. This method was introduced in [2] and refined in the Patel-Markov-Hayes algorithm [15], which produces asymptotically optimal gate counts for (unconstrained) CNOT synthesis. Similar ideas involving the decomposition of symplectic matrices into basic generators have also been applied for synthesising Clifford circuits from stabiliser tableaux [1, 13, 6, 17].

Some quantum computers, such as some superconducting devices [16], have the additional limitation of restricted connectivity, meaning 2-qubit gates aren't allowed between arbitrary pairs of qubits. By restricting which row operations are possible when reducing a parity matrix to the identity, circuits that obey specific connectivity constraints can be synthesised from ones that don't. A variety of techniques for introducing these constraints based on Steiner trees [14, 11, 18, 10] and integer programming [3] have been introduced in recent years.

General Circuit

Naïve slicing procedure

Alternative slicing procedure

Possible slicing procedures for a synthesis process that can't deal with hadamard gates

These synthesis methods provide a way to optimise circuits that mitigates some of the current limitations of NISQ devices. However, they suffer from relying on the properties of a specific gate set. The conventional generalisation of these methods to arbitrary quantum circuits is to slice the circuit into pieces that can be synthesised, and treat each of them separately[9]. This isn't as straightforward as it might initially sound. Consider for example the circuit in Figure slicecircA and a CNOT circuit synthesis procedure. The synthesis procedure can't deal with the circuit as it currently is due to the gates U and V, so we need to slice the circuit into sections containing just CNOT gates and synthesise those. As some of the gates in a quantum circuit can be moved past each other, there isn't always a unique way to make a slice. Take the two possible slicing options in Figures slicecircB and slicecircC for example. Since the CNOT slices are treated independently during the synthesis procedure, which sides of the slice certain CNOTs end up on can affect the size of the new circuit by allowing/preventing simplifications or cancellations.

In this paper we present a new approach to generalising circuit synthesis that doesn't rely on slicing the circuit into pieces. Instead we remove the gates that can't be synthesised, leaving holes in the circuit and producing what is known as a quantum comb [4, 8]. This quantum comb can be understood as a new circuit with additional qubits, where these new qubits represent the old qubits at different points in time. We then explain how extending the functionality of the CNOT synthesis algorithm RowCol to work quantum combs allows one to route general circuits. Our generalisation is then empirically tested against the naïve slicing process on a variety of circuit sizes and hardware constraints, finding our method has increasingly better performance than the slicing one as circuit sizes increase. Finally, we outline how quantum combs could be used to generalise other circuit synthesis procedures, as well as ways in which our current algorithm could be further optimised.

This paper has the following structure. Section sec:paritymatrix explains how the parity matrix representation of a CNOT circuit works. Section sec:rowcol introduces the idea behind CNOT synthesis algorithms, with a focus on the circuit routing algorithm RowCol. In Section sec:combs we introduce quantum combs, as well as language specific to this paper that will be helpful in explaining our algorithm. Section sec:combsynth explains our extension to RowCol that allows working with quantum combs. Empirical results comparing our quantum combs method to the slicing process are presented in Section sec:resandcon. Finally, Section sec:futurework concludes the paper and outlines possible future works for using quantum combs to generalise other synthesis procedures.

§ PRELIMINARIES

§.§ CNOT Circuit as a Parity Matrix

In this paper, we will use the phrases “CNOT circuit” or “CNOT comb” which refer to circuits or quantum combs entirely made of CNOTS. CNOT stands for “controlled not” and is a quantum gate that acts on 2-qubits: the control $c$ and the $t$, CNOT($c$, $t$). It acts in such a way that a NOT gate is applied to the target qubit only if the control qubit is in state $|1\>$, CNOT$|0\>|0\> = |0\>|0\>$ and CNOT$|1\>|0\> = |1\>|1\>$. When we refer to states in this section we mean computational basis states and the behaviour for general superpositions can be inferred from the linearity of quantum operations. An alternative way of thinking about about CNOTs is as modulo 2 addition: the target qubit changes state to the sum of the control and target values modulo 2, CNOT$|c\>|t\> = |c\>|c\oplus t\>$. This idea is represented as a circuit diagram in Figure fig:cnotmoduloexample. A CNOT gate can therefore be written as a list of which qubits are present in the parity equations of the output states: a representation of this is given by the matrix over $\mathbb{F}_{2}$ in Figure fig:cnotparitymatrix. By reasoning about CNOT gates in this way we can write an entire CNOT circuit as a list of parity equations, Figure fig:paritycircuitexample, then represent that circuit by an invertible element of $\mathbb F^{n\times n}_{2}$ (i.e a parity matrix), Figure fig:paritymatrixexample. One way to construct this matrix is by traversing the circuit and applying row operations for each CNOT, CNOT($c$, $t$) corresponds to R($c$, $t$), where R($c$, $t$) means setting row $t$ the sum of rows $c$ and $t$ modulo 2. By identifying a set of row operations that reduce a parity matrix to the identity, a CNOT circuit can be generated: this is the core principle behind the CNOT circuit synthesis algorithms discussed in the next section.

CNOT gate as modulo 2 addition of basis states

\[
\begin{pmatrix}
1 & 0  \\
1 & 1  \\
\end{pmatrix}
\]

Parity matrix for a CNOT gate

Parity representations of a CNOT gate

CNOT circuit described as parity equations

\[
\mathbf{P}
\ =\
\begin{pmatrix}
1 & 0 & 0 & 1 \\
1 & 1 & 1 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pmatrix}
\]

Parity matrix corresponding to circuit in fig:paritycircuitexample

Parity representation of a CNOT circuit

§.§ CNOT Circuit Synthesis Algorithms

Synthesis algorithms provide a means of reducing the size of CNOT circuits[15], or allow the resynthesis of circuits under topological constraints[11, 14, 10]. The ability to perform both of these tasks efficiently is vital for NISQ computing, as it provides a way to best utilise the machines we have available whilst minimising the consequences of their limitations. These CNOT synthesis methods work by converting the circuit into a parity matrix, as described in Section <ref>, then identifying which row operations convert the matrix back to the identity. This sequence of row operations corresponds to the generated CNOT circuit.

For some quantum computers, superconducting ones, for example [16], CNOT gates may be restricted to only be possible between nearest neighbour qubits. These computers are said to be topologically constrained, with graphs representing the allowed CNOTs called the topology, and the problem of converting a circuit to one that obeys these constraints known as quantum circuit routing. The systematic introduction of SWAPs into the circuit is one way to overcome this problem[5]. However, in this paper we will focus on the circuit synthesis approaches to finding a solution, specifically the ones that use parity matrices, as there are other alternative approaches that synthesise from different representations [3]. By restricting the possible row operations when reducing a parity matrix to the identity, circuit synthesis methods can be also used to produce circuits that obey topological constraints. One of these synthesis algorithms is known as RowCol, and will be the focus of the rest of this section.

Starting with a CNOT circuit $\mathcal C$, and a graph $G(V,E)$ representing connectivity of qubits, RowCol synthesises a new circuit as follows:

A circuit $\mathcal C$, and topology $G(V,E)$
A circuit $\mathcal C'$, respecting the topological constraints

* Generate a new empty circuit $\mathcal C'$ with the same number of qubits as $\mathcal C$.

* Compute the parity matrix $P$ of $\mathcal C$.

* Pick a non-cutting vertex of $V$ of $G$, and get its corresponding qubit $q$.

* Apply elementary row operations, restricted to the edges of $G(V,E)$, to reduce row $q$ and
column $q$ to a unit vector.

* Remove vertex $V$ from $G$, and row and column $q$ from $P$.

* Go back to Step 2 and repeat until $G$ has no more vertices.

* Return $\mathcal C'$

Note the column of $q$ is reduced to a unit vector by using row operations to place a $1$ on the diagonal, then adding row $q$ to the other rows to eliminate 1s above and below the diagonal. The row can be made into a unit vector by solving a system of linear equations for other rows to add back on to row $q$.

In order to respect connectivity constraints, row operations might not be performed directly, but via some intermediate operations computed using Steiner trees. While this is an important aspect of RowCol and related algorithms, we can treat this process essentially as a “black box” for the purposes of our algorithm. We refer readers to the paper that introduced RowCol [18] or other Steiner-tree based algorithms [11, 14, 10] for details.

We are now going to step through the RowCol procedure for the matrix in Figure <ref>. We start with qubit 0, meaning we are going to need to eliminate the 0th column, then the 0th row. To eliminate the column we need to perform $R(0,1)$, and to eliminate the row we need to perform $R(3,0)$. This has then reduced the 0th column and row to unit vectors, therefore we can ignore these when eliminating the rest of the matrix.

\[
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{gray!50}{2-1,3-1,4-1}
\Body
1 & 0 & 0 & 1 \\
1 & 1 & 1 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\rowop{0}{1}
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{gray!50}{1-2,1-3,1-4}
\Body
1 & 0 & 0 & 1 \\
0 & 1 & 1 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\rowop{3}{0}
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{red!50}{1-1,1-2,1-3,1-4,2-1,3-1,4-1}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 1 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\]

The column for the 1st qubit is already a unit vector, meaning we can move directly onto the row. To eliminate this row we need to perform $R(2,1)$ and $R(3,1)$: although a specific order is shown on the diagram either will work to eliminate the row. As both the column and row are now eliminated, we can ignore these in the subsequent operations.

\[
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{gray!50}{2-3,2-4}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 1 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\rowop{2}{1}
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{gray!50}{2-3,2-4}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\rowop{3}{1}
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{red!50}{2-2,2-3,2-4,3-2,4-2}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\]

The column is already a unit vector again here, meaning we move to the row, which can be eliminated by $R(3,2)$. This reduces the matrix to the identity meaning the process is over.

\[
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{gray!50}{3-4}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\rowop{3}{2}
\begin{pNiceMatrix}[r,margin]
\CodeBefore
\cellcolor{red!50}{3-3,3-4,4-3}
\Body
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
\end{pNiceMatrix}
\]

The sequence of row operations that converted the matrix to the identity are: $R(0,1)$, $R(3,0)$, $R(2,1)$, $R(3,1)$, $R(3,2)$. This tells us how to construct the resynthesised circuit which is shown in Figure <ref>.

Circuit generated from the step-by-step RowCol procedure

§.§ Quantum Combs

General representation of a quantum comb as quantum circuit with holes

Here we will introduce the concept of a quantum comb, as well as the language and notation used in this paper to discuss specific aspects of them. A quantum comb is a generalisation of a quantum channel that can take other quantum channels as input, rather than states. These can be depicted graphically, as in Figure <ref>, as circuits which not only have open wires at the top and bottom, but certain “holes” in the middle, where other gates can be inserted. The term “comb” comes from the fact that the entire object should no longer be represented as a box, but as an irregular shape resembling a hair comb, where each the of “teeth” corresponds to a distinct time step. See e.g. [4] for the formal definition and many such pictures.

Rather than defining combs in general, we will focus on combs arising from quantum circuits where certain single-qubit gates have been removed. The restriction to single-qubit holes is not essential, but it suffices for our purposes and will make certain aspects of our algorithm simpler. These can be described as normal quantum circuits with some extra information about time ordering of qubits, subject to some constraints. To motivate the definition, we will look at an example circuit, consisting of CNOT gates and several single-qubit gates we wish to remove:

\begin{equation}\label{quantumcircuithighlighted}
\tikzfig{unroutedCircuitHighlightedHoles}
\end{equation}

Note that we have labelled the inputs and outputs by the same indices $\{0,1,2,3\}$. We call these labels for the qubits in our original circuit the logical qubits. If we remove the gates $U, V, W, H$ from the circuit, we obtain something that looks like this:

\begin{equation}\label{quantumcomb}
\tikzfig{unroutedCircuitHolesRemoved}
\end{equation}

We can break the data represented by the picture above into two parts. First, we can see this as just a normal quantum circuit $\mathcal C$, but now acting on more qubits:

\begin{equation}\label{quantumcombunfolded}
\tikzfig{unroutedComb}
\end{equation}

Notice how this circuit is over more qubits than just the original logical qubits. The indices above refer to a qubit at a particular point in time, and hence have a many-to-one relationship with the logical qubits. We call these the temporal qubits.

There is also a binary relation telling us which temporal qubits come directly before others, which we call the holes. We can represent the holes indicated in (<ref>) as the set $\mathcal H = \{ (1,4), (2,6), (6,7), (4,5) \}$.

We can also define what it means to plug single-qubit gates into each of these holes. That is, for any set $\mathcal G$ of single-qubit gates and a plugging map $p : \mathcal H \to \mathcal G$, we can unambiguously reconstruct a circuit. For example, we can reconstruct our original circuit using the plugging map

\[ p :: \{ (1,4) \mapsto V, (4,5) \mapsto H, (2,6) \mapsto U, (6,7) \mapsto W \}. \]

To define what it means to be a valid comb, we will formalise the process of plugging in gates, and require this to result in a well-defined circuit.

Comb composition

A pair $(\mathcal C, \mathcal H)$ of a circuit $\mathcal{C}$ on a set of qubits $Q = \{0,\ldots,n-1\}$ and a binary relation $\mathcal H \subseteq Q \times Q$, as well as a plugging function $p: \mathcal H \to \mathcal G$
A circuit $\mathcal C'$ or FAIL

For each $(q_1, q_2) \in \mathcal H$:

* Re-order non-interacting gates in $\mathcal C$ such that all gates on qubit $q_1$ appear before gates on
qubit $q_2$. If this is not possible, FAIL.

* Insert $p((q_1, q_2))$ into $\mathcal C$ directly before the first gate to refer to qubit $q_2$.

* Remove $(q_1, q_2)$ from $\mathcal H$.

* Rename $q_2 \mapsto q_1$ in $\mathcal C$ and $\mathcal H$ and remove $q_2$ from $\mathcal C$.

* If this renaming produces a hole of the form $(q,q) \in \mathcal H$, then FAIL, otherwise continue to
the next hole.

Return $\mathcal C' := \mathcal C$.

A pair $(\mathcal C, \mathcal H)$ is called a comb if Algorithm <ref> succeeds for any plugging map $p$.

Note that this Algorithm <ref> can fail if the pair $(\mathcal C, \mathcal H)$ introduces cyclic dependencies between temporal qubits. However, when we obtain such pairs by “cutting out” the non-CNOT gates from a circuit, this algorithm will always succeed. We can formalise this “cutting out” process with the following procedure:

Comb decomposition

A circuit $\mathcal C'$
A comb $(\mathcal C, \mathcal H)$ and a plugging map $p: \mathcal H \to \mathcal G$.

* Create an empty comb $(\mathcal{C}, \mathcal H)$ where $\mathcal C$ is an empty circuit with as many qubits as $\mathcal C'$ and $\mathcal H = \{ \}$.

* Create a mapping $t$ for temporal qubits, where initially $t(q) = q$ for all qubits $q \in \mathcal C'$ and
$p$ is the empty map $\mathcal H \to \mathcal G$.

* For each gate $g$ in $C'$:

* if $g$ is a CNOT on qubits $q_{1}$ and $q_{2}$, add $g$ to $\mathcal{C}$ on qubits $t(q_{1}), t(q_{2})$

* if $g$ is not a CNOT and acting on qubit $q$, introduce a fresh qubit $q'$ to $\mathcal{C}$, add $(t(q),q')$ to $\mathcal H$, set $p((t(q),q')) := g$, and let $t(q) := q'$

* Return $(\mathcal{C}, \mathcal H)$ and $p$.

§ ALGORITHM: COMBSYNTH

Our main algorithm proceeds by decomposing a circuit into a comb consisting of just CNOT gates and a plugging map for all the additional single-qubit gates. It then resynthesises the comb using a variation of the RowCol algorithm which preserves the comb structure, then plugs the single-qubit gates back in to give a fully routed circuit.

The RowCol algorithm works by eliminating qubits one by one. To apply this idea to quantum combs we need to know what it means to remove one temporal qubit at a time. As temporal qubits represent sections of the “lifetime” of the original logical qubits, not all of them can exist at the same time. This means that, although we may write the comb as one large circuit, it is not possible to perform CNOTs between all the temporal qubits at any given time. This idea needs to be carried forward into the synthesis by restricting row operations to only be between qubits in the same sections of time.

For a comb $(\mathcal C, \mathcal H)$, a temporal qubit $q$ is called available if it does not appear as the first part of a hole. That is, there exists no $q'$ such that $(q, q') \in \mathcal H$. It is extractible if its row and column can be made into a unit vector using the RowCol algorithm restricted only to row operations between available qubits.

Finally, to track topological constraints, which may be relevant for RowCol, we maintain a connection between logical and available temporal qubits. For each logical qubit $q_0$, let $t(q_0)$ be its associated available temporal qubit. That is, let $t(q_0) = q_0$ if $q_0$ does not appear in any holes, otherwise, let it be $q_k$ for the maximal transitive chain of holes $(q_0, q_1), (q_1, q_2), \ldots, (q_{k-1}, q_k)$. Therefore, the mapping $t$ is determined by a collection of holes, meaning as we update $\mathcal H$ in the algorithm below we are also updating $t$.

Our main algorithm, CombSynth, works as follows:

A comb $(\mathcal C, \mathcal H)$ with temporal qubits $Q = \{0, \ldots, n-1\}$, topology graph $G(V, E)$
A comb $(\mathcal C', \mathcal H')$, respecting topological constraints for any plugging $p$

* Create a new comb $(\mathcal{C}', \mathcal H')$ with $\mathcal C'$ initially empty and $\mathcal H' = \mathcal H$

* Compute the parity matrix $P$ of $\mathcal C$.

* Identify an extractible temporal qubit $e$ in comb $(\mathcal C, \mathcal H)$.

* Produce a rectangular sub-matrix $P'$ with columns the same as $P$ and rows labelled by $t(q)$ for each logical qubit $q$.

* Run an iteration of RowCol on row $t(e)$ and column $e$ of $P'$, with topology $G$, updating $\mathcal C'$.

* Update the corresponding rows of $P$ using $P'$.

* Remove $e$ from the qubits of $\mathcal C$ and any hole of the form $(e',e)$ for some $e'$ from $\mathcal H$.

* Repeat from Step 3 until no qubits remain in $\mathcal C$.

* Return $(\mathcal C', \mathcal H')$.

Note that if $(\mathcal C, \mathcal H)$ arose from a circuit by cutting single-qubit gates out, as in Algorithm <ref>, there will always be at least one extractible temporal qubit. We simply need to choose one corresponding to the latest gate that has been cut out of the circuit.

The core of the RowCol algorithm is used to reduce the row and column of the chosen temporal qubit to unit vectors. Applying this procedure iteratively, removing the temporal qubits in an allowed order, and updating the sub-matrix as you go, will reduce the overall parity matrix to the identity whilst ensuring that no row operations happen between qubits that exist at different points in time. Therefore we have a procedure for synthesising quantum combs from their parity matrices. This method eliminates rows and columns of a matrix in the same way as RowCol, and the rows of rectangular sub-matrix $P'$ always correspond to the same logical qubits, even though we are swapping the temporal qubits in and out. Hence, our algorithm can be used to route to constrained topologies in the same way as RowCol, but now it can be done for general unitaries by converting to a quantum comb. Comparisons of our generalisation of RowCol to a simple slicing procedure are presented in the next section.

\[
\begin{pNiceMatrix}[r,margin,first-row,first-col]
\CodeBefore
\cellcolor{blue!50}{1-,6-,8-,4-}% Colour the rows that will go into the sub matrix
\Body
& 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\
1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
2 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
3 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\
4 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 0 \\
5 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
6 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 \\
7 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 \\
\end{pNiceMatrix}
\matrixop{Generate sub-matrix}
\begin{pNiceMatrix}[r,margin,first-row,first-col]
& 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\
5 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
7 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 \\
3 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\
\end{pNiceMatrix}
\]

Generation of sub-matrix from full parity matrix

To illustrate how CombSynth works, we'll work through an example, showing each of the steps explicitly, similar to what we did for RowCol. In doing so, we will look at the circuit in (<ref>), which has a quantum comb shown in (<ref>). We will apply this process without topological constraints as these aren't necessary for showing how our generalisation works. The quantum comb is made of 8 temporal qubits, however, our initial circuit is made of 4 logical ones. This means that only 4 of the 8 temporal qubits in our quantum comb can exist at any one time, and a $4\times8$ rectangular matrix will then be used for the elimination steps. The sub-matrix will initially take the form in Figure fig:submatrixgen. Note that the rows are not in the same order as they were in the larger matrix: this is because they are placed in the position of their corresponding logical qubit. A table of the elimination steps is presented in Figure fig:submatrixrowop, which highlights the row and column that get reduced to unit vectors and lists the row operations needed to do this. The elimination order of the temporal qubits is $5,7,6,3,4,0,1$.

Initial sub-matrix     Eliminated sub-matrix     Row operations
required for reduction

$\submatrixAi$     $\submatrixAii$     N/A

$\submatrixBi$     $\submatrixBii$     $R(7,0),R(3,7),$

$\submatrixCi$     $\submatrixCii$     $R(6,4),R(3,6)$

$\submatrixDi$     $\submatrixDii$     $R(3,4),R(0,3)$

$\submatrixEi$     $\submatrixEii$     $R(0,4)$

$\submatrixFi$     $\submatrixFii$     $R(0,2),R(1,0)$

$\submatrixGi$     $\submatrixGii$     $R(1,2)$

Row operations on sub matrices that reduce the parity matrix to the identity

To complete the CombSynth algorithm, the comb generated from the row operations in Figure fig:submatrixrowop is filled with the gates removed from the original circuit. This circuit, shown in Figure fig:generatedcircuit, is smaller than the original, though only by 1 gate, but this effect grows as the circuit size increases due to more CNOT cancellations.

Circuit generated from the CombSynth procedure in Section sec:combsynth

§ RESULTS

We have conducted a series of computational experiments to compare our generalisation of RowCol to a circuit slicing procedure. For the slicing we have used a naïve algorithm that cuts the circuit where the gates are found, similar to that shown in Figure slicecircB. 20 random circuits with CNOT counts of $4,8,16,32,64,128,256,512$ and $1024$ were generated, and a set of non-CNOT gates distributed uniformly throughout them. The number of non-CNOT gates was set to be proportional to the number of CNOTs, with the proportionality factor varying from $5\%$ to $50\%$. The percentages of non-CNOTs in the table and graphs below are therefore the proportion of non-CNOTs to CNOTs, not the proportion of non-CNOTs to the total number of gates in the circuit. A range of architectures, popular for conducting similar computational experiments, was then selected to route our circuits onto. These were the 9-qubit square grid, 16-qubit square grid, Rigetti 16-qubit Aspen, 16-qubit IBM QX5 and 20-qubit IBM Tokyo. For each set of experimental parameters we recorded the proportional change in CNOT gates (CNOT overhead) due to the synthesis algorithms.

Graphs showing the change in CNOT overhead when increasing the size of the circuit. This selection of graphs was chosen because it covers a wide range of the parameters of the computational experiment, however all the graphs still broadly have the same behaviour. They start off with a larger overhead, fluctuate a bit for the small circuit sizes, then approach some some constant value. With this approached value being smaller for the comb routing process then the slicing one.

A set of graphs with different parameters for the computational experiment is shown in Figure fig:realarchoverhead. These graphs are illustrative of the behaviour of all of the experiments: the overhead is high for small circuits with the slicing procedure sometimes being better, but as the circuit size increases both overheads approach a constant value, with the comb algorithm outperforming the slicing one. This is to be expected as using quantum combs allows for better cancellations than the slicing process, due to each slice being routed independently. The overheads for the largest circuit sizes, 1024 CNOTs, are shown in Table tab:overhead, giving a comparison of the asymptotic behaviour of each algorithm. It can be seen that larger proportions of non-CNOT gates reduce the advantage of using the comb algorithm: however it still outperforms the slicing method for all architectures and gate proportions tested.

2-1Architectures           1-25%
Non-CNOT Gates         1-215%
Non-CNOT Gates        1-225%
Non-CNOT Gates        1-250%
Non-CNOT Gates

Comb     Slice     Comb     Slice     Comb     Slice     Comb     Slice

9q-square              -43.1%    80.79%    34.12%    208.7%    91.93%    255.9%    182.1%    306.8%

16q-square             13.11%    344.5%    154.4%    511.1%    263.9%    564.6%    437.0%    606.9%

16q_aspen    47.31%    555.4%    231.2%    893.1%    379.6%    1027%     614.9%    1119%

bm_qx5                32.27%    461.9%    197.2%    698.8%    322.4%    783.6%    527.8%    837.7%

ibm_q20_tokyo        33.17%    393.1%    183.6%    481.0%    289.3%    500.2%    440.7%    498.2%

CNOT overhead when routing to different architectures and proportions of non-CNOT gates. The values above are for the largest circuits tested: 1024 CNOTs

§ CONCLUSION AND FUTURE WORK

We have proposed an alternative to slicing the circuit, using quantum combs, for generalising synthesis algorithms to arbitrary circuits. This idea was then concretely outlined for the case of CNOT synthesis by developing a generalisation of RowCol that works for quantum combs, and showing this allows the routing of arbitrary circuits. Finally, through a series of computational experiments, we demonstrated that for large circuits our quantum comb generalisation of RowCol outperforms the slicing procedure on a range of architectures and  CNOT/non-CNOT proportions.
Work has recently been done on improving the performance of RowCol by allowing the qubits to be permuted by the synthesis algorithm [10], investigating whether the performance of CombSynth could be improved in a similar way would be an interesting research direction. Currently, comb synthesis is designed to work with a subroutine that only works with one qubit (and hence one row/column) at a time, but it would be worth adapting it to work with synthesis algorithms which operate one more than one row or column at once, like the Patel-Markov-Hayes algorithm. Along a similar vein, it appears that our algorithm could be generalised to deal with multi-qubit holes by introducing some extra requirements than certain sets of temporal qubits should be extracted simultaneously.

Throughout this paper, we compared our quantum comb approach to that of slicing for generalising synthesis algorithms, however there have been some recent approaches that don't use slicing to perform circuit optimisation. These are lazy synthesis [12] and ZX circuit extraction [7], our approach differs from these as we focused on the utility of the higher order structure quantum combs for quantum compilation. Although a comparative analysis between our approach and these would be an interesting topic for further research. We focused on using quantum combs to generalise a CNOT synthesis algorithm in this paper: a natural next step would be to try and apply this idea to other synthesis algorithms such as the synthesis of Clifford circuits from stabiliser tableaux
or CNOT+phase circuits from phase polynomials. Finally, quantum combs allow for routing of circuits with “black box” operations, where you may not know what operation will eventually be performed at the time of compilation. This may be useful for compilation in the context of parameterised circuits such as those used in variational algorithms, or for classical-quantum algorithms where you want to route around mid-circuit measurements.

[1]
authorScott Aaronson &
authorDaniel Gottesman
(year2004): titleImproved simulation of
stabilizer circuits.
journalPhysical Review A
volume70(number5), p. pages052328,

[2]
authorGernot Alber,
authorThomas Beth,
authorMichał Horodecki,
authorPaweł Horodecki,
authorRyszard Horodecki,
authorMartin Rötteler,
authorHarald Weinfurter,
authorReinhard Werner,
authorAnton Zeilinger,
authorThomas Beth et al.
(year2001): titleQuantum algorithms: Applicable
algebra and quantum physics.
journalQuantum information: an introduction to
basic theoretical concepts and experiments, pp. pages96–150,

[3]
authorTimothée Goubault de Brugière, authorMarc Baboulin, authorBenoît Valiron, authorSimon Martiel
& authorCyril Allouche
(year2022): titleDecoding techniques applied to
the compilation of CNOT circuits for NISQ architectures.
journalScience of Computer Programming
volume214, p. pages102726,

[4]
authorGiulio Chiribella,
authorG Mauro D’Ariano &
authorPaolo Perinotti
(year2008): titleQuantum circuit architecture.
journalPhysical review letters
volume101(number6), p. pages060401,

[5]
authorAlexander Cowtan,
authorSilas Dilkes,
authorRoss Duncan,
authorAlexandre Krajenbrink,
authorWill Simmons &
authorSeyon Sivarajah
(year2019): titleOn the Qubit Routing Problem.
In editorWim van Dam &
editorLaura Mancinska, editors:
booktitle14th Conference on the Theory of Quantum
Computation, Communication and Cryptography (TQC 2019), seriesLeibniz International Proceedings in Informatics (LIPIcs)
volume135, publisherSchloss Dagstuhl–Leibniz-Zentrum
fuer Informatik, addressDagstuhl, Germany, pp.
pages5:1–5:32, 10.4230/LIPIcs.TQC.2019.5.

[6]
authorJeroen Dehaene &
authorBart De Moor
(year2003): titleClifford group, stabilizer
states, and linear and quadratic operations over GF (2).
journalPhysical Review A
volume68(number4), p. pages042318,

[7]
authorRoss Duncan, authorAleks
Kissinger, authorSimon Perdrix & authorJohn Van
De Wetering (year2020):
titleGraph-theoretic Simplification of Quantum Circuits with
the ZX-calculus.
journalQuantum volume4, p.
pages279, 10.22331/q-2020-06-04-279.

[8]
authorTilo Eggeling, authorDirk
Schlingemann & authorReinhard F
Werner (year2002):
titleSemicausal operations are semilocalizable.
journalEurophysics Letters
volume57(number6), p. pages782,

[9]
authorVlad Gheorghiu,
authorJiaxin Huang,
authorSarah Meng Li,
authorMichele Mosca &
authorPriyanka Mukhopadhyay
(year2022): titleReducing the CNOT count for
Clifford+ T circuits on NISQ architectures.
journalIEEE Transactions on Computer-Aided
Design of Integrated Circuits and Systems, 10.1109/TCAD.2022.3213210.

[10]
authorArianne Meijer-van de Griend &
authorSarah Meng Li
(year2022): titledynamic qubit allocation and
routing for constrained topologies by cnot circuit re-synthesis.
In: booktitleQuantum Physics and Logic,
publisherElectronic Proceedings in Theoretical Computer Science,

[11]
authorAleks Kissinger &
authorArianne Meijer
(year2020): titleCNOT circuit extraction for
topologically-constrained quantum memories.
journalQuantum Information and Computation
volume20, pp. pages581–596,

[12]
authorSimon Martiel &
authorTimothée Goubault de Brugière (year2022):
titleArchitecture aware compilation of quantum circuits via
lazy synthesis.
journalQuantum volume6, p.
pages729, 10.22331/q-2022-06-07-729.

[13]
authorDmitri Maslov &
authorMartin Roetteler
(year2018): titleShorter stabilizer circuits via
Bruhat decomposition and quantum circuit transformations.
journalIEEE Transactions on Information Theory
volume64(number7), pp. pages4729–4738,

[14]
authorBeatrice Nash, authorVlad
Gheorghiu & authorMichele Mosca (year2020): titleQuantum
circuit optimizations for NISQ architectures.
journalQuantum Science and Technology
volume5(number2), p. pages025010,

[15]
authorKetan N. Patel,
authorIgor L. Markov &
authorJohn P. Hayes
(year2008): titleOptimal Synthesis of Linear
Reversible Circuits.
journalQuantum Info. Comput.
volume8(number3), pp. pages282–294,

[16]
authorRoberto Stassi,
authorMauro Cirio &
authorFranco Nori
(year2020): titleScalable quantum computer with
superconducting circuits in the ultrastrong coupling regime.
journalnpj Quantum Information
volume6(number1), p. pages67,

[17]
authorMaarten Van Den Nest
(year2010): titleClassical Simulation of Quantum
Computation, the Gottesman-Knill Theorem, and Slightly Beyond.
journalQuantum Info. Comput.
volume10(number3), p. pages258–271,

[18]
authorBujiao Wu, authorXiaoyu
He, authorShuai Yang, authorLifu Shou,
authorGuojing Tian,
authorJialin Zhang &
authorXiaoming Sun
(year2023): titleOptimization of CNOT circuits
on limited-connectivity architecture.
journalPhys. Rev. Res. volume5, p.
pages013065, 10.1103/PhysRevResearch.5.013065.