# Unitary Averaging with Fault and Loss Tolerance

Ryan J. Marshman  Centre for Quantum Computation and Communication Technology,
School of Mathematics and Physics, University of Queensland, Brisbane,
Queensland 4072, Australia.  Deepesh Singh  Centre for Quantum Computation and
Communication Technology, School of Mathematics and Physics, University of
Queensland, Brisbane, Queensland 4072, Australia.  Timothy C. Ralph  Centre
for Quantum Computation and Communication Technology, School of Mathematics
and Physics, University of Queensland, Brisbane, Queensland 4072, Australia.
Austin P. Lund  Dahlem Center for Complex Quantum Systems, Freie Universität
Berlin, 14195 Berlin, Germany  Centre for Quantum Computation and
Communication Technology, School of Mathematics and Physics, University of
Queensland, Brisbane, Queensland 4072, Australia.

###### Abstract

We consider the impact of the unitary averaging framework on single and two-
mode linear optical gates. We demonstrate that this allows a trade-off between
the probability of success and gate fidelity, with perfect fidelity gates
being achievable for a finite decrease in the probability of success, at least
in principle. Furthermore, we show that the encoding and decoding errors in
the averaging scheme can also be suppressed up to the first order. We also
look at how unitary averaging can work in conjunction with existing error
correction schemes. Specifically, we consider how parity encoding might be
used to counter the extra loss due to the decreased probability of success,
with the aim of achieving fault tolerance. We also consider how unitary
averaging might be utilised to expand the parameter space in which fault
tolerance may be achievable using standard fault tolerant schemes.

##  I Introduction

With noisy, intermediate-scale quantum (NISQ) devices becoming more common the
attention is shifting to the creation of full-scale quantum computing devices
[1]. These future devices will differ to current technology in their scale,
which necessitates the development of practical methods of dealing with noise
in quantum devices. Specifically, full scale quantum computation will require
the used of fault-tolerant schemes. However, these require an enormous
overhead in resources to be implemented. Quantum computing architectures and
error-correction schemes that offer a reduction in this overhead will be
necessary for at least near future quantum computing devices and is thus the
focus of much interest. Indeed, improvements in this space which are easily
implementable would be useful both in the NISQ-era and in the longer term.

Linear optics provides a promising platform for achieving the transition from
existing technologies like Boson sampling [2] to universal quantum computing
realisations, like fusion-based quantum computing [3]. The implementation of
deterministic two-qubit entangling gates with non-interacting photons, photon
loss, and the build up of errors throughout the quantum circuits represent
some of the major challenges for optical quantum computers. The first two
issues can be addressed by loss tolerant encoding [4] to enable recovery from
failed probabilistic components. As such loss tolerance must be a fundamental
component of any optical quantum computer, a fact that our scheme relies on to
address the limitation of its probabilistic nature.

We explore the framework of Unitary Averaging (UA) [5, 6, 7] which allows one
to alleviate the effect of imperfections within the applied transformations.
UA employs redundancy in the transformation circuit to passively, but
probabilistically, reduce the build up of errors. The scheme has a simple
implementation within linear optical systems, and so we will consider this as
the explicit example system. UA a transformation equivalent to the average of
a given set of transformations. In the limit when all the individual
transformations are close approximations of some target, their average is a
good approximation of the target in total variation distance (TVD). The
resulting improvement in the gate fidelity however comes at the cost of
success probability, and we analyse it in all generality in the linear optical
architecture.

As is the case with all error-correction schemes, encoding errors present a
challenge to their practical usefulness. An exploration of the same is
therefore considered for the UA framework here. It is shown that any errors
present in any encoding utilised in the UA scheme, is naturally suppressed to
the first order.

Moreover, the trade-off between gate fidelity and loss may be useful given the
necessity of loss protection in any realistic optical quantum computer due to
both photon absorption and the probabilitic nature of optical quantum
computation [8, 9]. We consider the loss-tolerant parity encoding scheme and
show its compatibility with UA. Thus, in the limit of large redundancy, UA
could be employed to ensure all logical errors are converted into heralded
losses which are recoverable by the parity encoding.

Finally, we consider how UA may be used to expand the parameter space for
which fault tolerance can be achieved by analysing a few example error codes.
Specifically, we consider some older fault tolerant codes (7-qubit Steane code
and the 23-qubit Golay code [10]) for which the benifit of UA is seen to be
significant, as well as more modern surface code based implementations [11, 3]
for which effect of UA is more modest.

The structure of this paper is as follows: we begin by summarising the known
results on UA in section II. Section III explores the suppression of encoding
errors in single-mode unitary averaged gates while section IV details the
effect unitary averaging has on an arbitrary single-mode unitary in terms of
both the gate fidelity and probability of success. Section V discusses how
two-mode gates are implemented and protected in a similar fashion. We then
introduce the loss tolerant scheme of parity encoding in section VI before
highlighting how it can be used together with UA in section VII. Section VIII
then discusses the use of UA with the threshold for fault tolerance before
some concluding remarks in section IX.

##  II Unitary Averaging

Given access to multiple unitaries, the unitary averaging (UA) framework
allows one to apply an average of these unitaries on the intended modes, with
the success probability of this transformation depending on the exact value of
the unitaries.

Unitary Averaging (UA) acts to apply an averaged unitary evolution [5, 6]
given by

$\hat{\mathcal{U}}=\frac{1}{N}\sum_{j=1}^{N}\hat{U}_{j}$ (1)

on a target set of $M$ modes. There is also an accompanying $(N-1)M$ set of
error modes which are post-selected to be in a vacuum state. In this way, if
each applied unitary $\hat{U}_{j}$ are approximately implementing a target
unitary $\hat{U}_{T}$ with a certain unbiased noise, then by the central limit
theorem, UA will instead apply an averaged unitary $\hat{\mathcal{U}}$ which
represents a new, stochastic operator which approximates the target unitary
$\hat{U}_{T}$, with variance reduced by a factor of $N$. As demonstrated
later, we can further write the individual transformation in the form
$\hat{U}_{j}=\hat{U}_{T}+\hat{E}_{j}$ where $\hat{E}_{j}$ is the stochastic
operator containing all of the noise terms. Note that the use of $\mathcal{U}$
rather than $U$ is to remind the reader that the resulting transformation is
non-unitary, but aims to be as close to unitary as possible. Specifically, the
target unitary can be implemented arbitrarily accurately using a sufficiently
large $N$. The cost of this reduction in variation of the applied
transformation is that it is implemented probabilistically. The probability of
success $P_{S}(N)$ depends on both the variance in the individual unitaries,
and number of copies used $N$. The decoding produces $N-1$ error heralding
modes. Detecting a photon at the error heralding modes applies the
transformation

$\hat{\mathcal{U}}_{e}=\frac{1}{N}\sum_{j=1}^{N}f_{j}\hat{U}_{j}$ (2)

where the weights $f_{j}$ are real numbers such that $0\leq f_{j}\leq
1,\forall j$ and $\sum_{j=1}^{N}f_{j}=1$. The values $f_{i}$ are entirely
depending on the encoding and decoding used in the averaging process. When the
encoding unitary is $H^{\otimes k}$ for any $k$, $f_{j}=\pm 1$ such that at
least one $f_{j}=-1$, as will be used throughout this paper. As such,
observing a photon in the heralding modes applies an unintended
transformation, furthermore, depending on the nature of the detectors used, it
may destroy the state. As such, UA can be viewed as mapping logical errors to
heralded loss and phase error imprinted on the remainder of the state. The
probability of such a heralded error scales proportionally to the variance of
the applied unitaries $\hat{U}_{j}$ and the amount of averaging, $N$.

Throughout this manuscript we are concerned only with the success modes. As
such, we consider the output state to only be the correct modes, dropping the
error heralding modes. The output state is thus

$\hat{\rho}(N)=\,\hat{\mathcal{U}}(N)\left|\psi\right\rangle\left\langle\psi\right|\hat{\mathcal{U}}^{\dagger}(N)$
(3)

which is an unnormalised state, and where $\left|\psi\right\rangle$ is the
initial state. The normalisation is returned though the post selection
process, which is then the source of the probabilistic nature of the
correction being applied. This is characterised by the probability of success
$P_{s}(N)$. In fact, we can define this the probability of success by the
amplitude of the un-normalised state which in this case can be calculated for
a general input state using

$\displaystyle P_{s}(N)=$
$\displaystyle\left|\hat{\mathcal{U}}(N)\left|\psi\right\rangle\right|^{2}$
$\displaystyle=$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle\psi\right|\hat{U}_{j}^{\dagger}\hat{U}_{k}\left|\psi\right\rangle$
(4)

The density operator after the post selection step is then given by

$\hat{\rho}_{ps}=\left(P_{s}(N)\right)^{-1}\hat{\rho}(N).$ (5)

The other figure of merit to characterise the effect UA has on a gate is the
state fidelity. The fidelity encodes how likely it is that, upon measurement,
the transformation returns the target state. The target state in this case is
$\left|\Psi\right\rangle=\hat{U}_{T}\left|\psi\right\rangle$ where
$\left|\psi\right\rangle$ is the initial state and $\hat{U}_{T}$ is the target
unitary, which corresponds to $\hat{U}_{j}$ in the instance of no noise. The
gate fidelity is then defined as

$\displaystyle\mathcal{F}(N)=$
$\displaystyle\left\langle\Psi\right|\rho_{ps}(N)\left|\Psi\right\rangle$ (6)

Before we can start characterising the effect UA has on single and two qubit
gates, we must also consider the encoding and decoding steps and to what
extent they impact on the output.

##  III unitary averaging Encoding Errors

The encoding and decoding can be achieved in multiple different manners,
including using Hadamard encoding [5], or the more general W-state/ quantum
fourier transform encodings [6, 7]. In this instance we will consider the
Hadamard encoding which is simple in its construction and in particular its
scaling to higher levels of encoding ($N$). Specifically, we will take the
single qubit gates to be encoded using only beam splitters, splitting the
input evenly between each redundant physical gate. This can then be performed
iteratively, giving $N=2^{n}$ for $n\in\mathbb{N}$. This process is shown in
Figure 1. This choice of encoding is also optimal in that it maintains
constant optical depth of each interferometric path while minimising the
optical depth. Given the even splitting, the optical depth for each path
increases logarithmically as $2\log_{2}\left(N\right)$ for $N$ copies of the
unitary.

Starting with $N=2$, the output of a single qubit averaged gate after post
selection is determined by

$\left|\psi\right\rangle_{out}=\left\langle\bf{0}\right|_{\epsilon}\hat{B}_{1\xleftrightarrow{}2}^{(2)}\left(\hat{U}_{2}\otimes\hat{U}_{1}\right)\hat{B}_{1\xleftrightarrow{}2}^{(1)}\left|\psi\right\rangle_{in}.$
(7)

where $\hat{B}_{a\xleftrightarrow{}b}^{(j)}$ acts to evenly mix the pair of
modes $a$ and $b$, each of which are then separately acted on by independent
unitary $\hat{U}_{a/b}$ and $\left\langle\bf{0}\right|_{\epsilon}$ represents
the projection onto the vacuum for the error modes. The superscript $j$ serves
to remind that each beam splitter is independent and thus has its own unique
noise associated with it. In dual rail, this can be written as

$\hat{B}_{1\xleftrightarrow{}2}^{(j)}=\begin{bmatrix}\sin\left(\theta_{j}\right)&0&\cos\left(\theta_{j}\right)&0\\\
0&\sin\left(\theta_{j}^{\prime}\right)&0&\cos\left(\theta_{j}^{\prime}\right)\\\
\cos\left(\theta_{j}\right)&0&-\sin\left(\theta_{j}\right)&0\\\
0&\cos\left(\theta_{j}^{\prime}\right)&0&-\sin\left(\theta_{j}^{\prime}\right)\end{bmatrix}$
(8)

where $\theta_{j}^{(^{\prime})}=\frac{\pi}{2}+\delta\theta_{j}^{(^{\prime})}$
for $\delta\theta_{j}^{(^{\prime})}\ll\frac{\pi}{2}$, allowing us to write
$\sin\left(\theta_{j}\right)\approx\frac{1}{\sqrt{2}}+\delta\theta_{j}^{(^{\prime})}$
and
$\cos\left(\theta_{j}\right)\approx\frac{1}{\sqrt{2}}-\delta\theta_{j}^{(^{\prime})}$.
For $N=4$, given the concatinated nature of the encoding choice, single qubit
gate $\hat{U}_{1/2}$ can be be replaced with a $N=2$ circuit
($\hat{B}_{1\xleftrightarrow{}2}^{(2)}\left(\hat{U}_{2}\otimes\hat{U}_{1}\right)\hat{B}_{1\xleftrightarrow{}2}^{(1)}$)
and relabelling the elements. This process can then be further repeated for
higher $N=2^{j}$ where $j\in\mathbb{N}$. However, care is needed when
relabelling each single qubit unitary and beam splitter to ensure each act on
the appropriate modes.

(a) $N=2$

(b) $N=4$

Figure 1: Arbitrary dual-rail, single qubit unitary with unitary averaging.
Figure 1(a) shows $N=2$ levels of redundancy while Figure 1(b) shows how $N=4$
can be viewed similarly, but where each physical unitary $\hat{U}_{1/2}$ as
itself an $N=2$ encoded unitary.

To calculate the transformation implemented in Equation 7 after heralding, but
before renormalisation on no error detection results in

$\displaystyle\hat{a}_{out}\left(N=2\right)=$
$\displaystyle\left[\sin\left(\theta_{1}\right)\sin\left(\theta_{2}\right)\hat{U}_{1}+\cos\left(\theta_{1}\right)\cos\left(\theta_{2}\right)\hat{U}_{2}\right]\hat{a}_{in}+\left[\sin\left(\theta_{1}^{\prime}\right)\sin\left(\theta_{2}^{\prime}\right)\hat{U}_{1}+\cos\left(\theta_{1}^{\prime}\right)\cos\left(\theta_{2}^{\prime}\right)\hat{U}_{2}\right]\hat{b}_{in}$
$\displaystyle\approx$
$\displaystyle\frac{1}{2}\left(\hat{U}_{1}+\hat{U}_{2}\right)\left(\hat{a}_{in}+\hat{b}_{in}\right)+\frac{1}{\sqrt{2}}\left(\hat{U}_{1}-\hat{U}_{2}\right)\left[\left(\delta\theta_{1}+\delta\theta_{2}\right)\hat{a}_{in}+\left(\delta\theta_{1}^{\prime}+\delta\theta_{2}^{\prime}\right)\hat{b}_{in}\right]$
(9)

which can be simplified by taylor expanding the applied single qubit gates,
setting $\hat{U}_{j}=\hat{U}_{T}+\hat{E}_{j}$ (as discussed in more detail
later), and keeping only linear terms simplifies to

$\displaystyle\hat{a}_{out}\left(N=2\right)\approx$
$\displaystyle\left(\hat{U}_{T}+\frac{1}{2}\left(\hat{E}_{1}+\hat{E}_{2}\right)\right)\left(\hat{a}_{in}+\hat{b}_{in}\right)+\mathcal{O}\left(\hat{E}^{2},~{}\delta\theta\hat{E},~{}\delta\theta^{2}\right).$
(10)

with all terms linear in $\delta\theta_{j}$ cancelling. An equivalent
expression can be written for $\hat{b}_{out}$ . Similarly, the $N=4$ result
can be calculated by substituting each single qubit unitary $\hat{U}_{i}$ with
the entire $N=2$ result, with the appropriate re-labelling of the parameters
giving

$\displaystyle\hat{a}_{out}\left(N=4\right)\approx$
$\displaystyle\left(\hat{U}_{T}+\frac{1}{4}\Sigma_{j=1}^{4}\hat{E}_{j}\right)\left(\hat{a}_{in}+\hat{b}_{in}\right)$
$\displaystyle+\mathcal{O}\left(\hat{E}^{2},~{}\delta\theta\hat{E},~{}\delta\theta^{2}\right)$
(11)

where again the linear encoding error terms cancel one another. One can see by
induction that this pattern continues for all $N=2^{i}$ where
$i\in\mathbb{Z}$. Thus encoding errors are naturally suppressed to the first
order. As such, it is sufficient to account for only errors within the
averaged unitaries themselves so encoding errors will not be considered for
the remainder of this manuscript.

One might be tempted to view this suppression of the encoding errors as a
result of the concatenation, however, given the linear encoding errors for the
$N=2$ case (as shown in Eq. 10) this cannot be the full story. While the
concatenation will help further suppress noise, it is the post selection which
removes the last two terms from Eq. 10 combined with the correlated noise in
the encoding resulting here from the use of a single beam splitter for both
polarisation modes. Maintaining this benefit with multiple qubits will require
the noise to again be correlated. This could only be achieved by considering
the implementation specificially. For example, using a single thermal coupling
controller to manipulate both beam-paths if thermal control is used to modify
the distance and hence evanescent coupling strength between two modes may be
sufficient.

##  IV unitary averaged single qubit gates

Here we consider how an arbitrary single physical qubit gate might be
protected using UA. Specifically we detail how phase and bit-flip errors are
converted into heralded loss allowing for a trade-off between fidelity and
known loss. Given the results of the previous section, it is not necessary to
include any encoding errors and so we will consider noise only in the linear
optical unitary.

The first thing to do is build an error model for an unencoded gate and then
considering the impact of UA on these errors. To do this we will use an over
complete gate description so as to allow errors to arise anywhere within the
unitary. The circuit depth is also then the same regardless of path taken. The
chosen system allows an arbitrary single qubit gate to be implemented, with
specific parameters tuned such that it implements the intended transformation.
The system is shown in Figure 2.

Figure 2: Arbitrary dual-rail, single qubit unitary.

This gate will implement the transformation

$\hat{U}_{j}=\begin{bmatrix}e^{i\phi_{1,j}}e^{i\chi_{1,j}}\sin\left(\theta_{j}\right)&e^{i\phi_{2,j}}e^{i\chi_{1,j}}\cos\left(\theta_{j}\right)\\\
e^{i\phi_{1,j}}e^{i\chi_{2,j}}\cos\left(\theta_{j}\right)&-e^{i\phi_{2,j}}e^{i\chi_{2,j}}\sin\left(\theta_{j}\right)\end{bmatrix}$
(12)

We can then take each parameter $O_{i,j}$ to be given by the intended target
value $O_{i}$ and an additional noise term $\delta O_{i,j}$ where
$O_{i,j}=O_{i}+\delta O_{i,j}$. The appropriate gate parameters for a number
of unitaries of interest are shown in Table 1.

Gate | $\theta$ | $\phi_{1}$ | $\phi_{2}$ | $\chi_{1}$ | $\chi_{2}$
---|---|---|---|---|---
$\hat{I}$ | $\frac{\pi}{2}$ | $0$ | $0$ | $0$ | $\pi$
$\hat{X}$ | $0$ | $0$ | $0$ | $0$ | $0$
$\hat{Y}$ | $0$ | $\frac{\pi}{2}$ | $0$ | $-\frac{\pi}{2}$ | $0$
$\hat{Z}_{\alpha}$ | $\frac{\pi}{2}$ | $0$ | $0$ | $0$ | $\alpha$
$\hat{H}$ | $\frac{\pi}{4}$ | $0$ | $0$ | $0$ | $0$
Table 1: Arbitrary single qubit gate parameters .

We then Taylor expand each parameter around their target value as shown in the
supplemental information for this paper. The applied unitary can in general be
written as $\hat{U}_{j}=\hat{U}_{T}+\hat{E}_{j}$ where $\hat{U}_{T}$ is the
target unitary. Thus, after employing UA, we will have implemented the
transformation on the output mode

$\hat{\mathcal{U}}(N)=\frac{1}{N}\sum_{j=1}^{N}\left(\hat{U}_{T}+\hat{E}_{j}\right)\equiv\hat{U}_{T}+\frac{\hat{\epsilon}(N)}{N}$
(13)

where $\hat{\epsilon}(N)$ is some stochastically varying transformation and we
are not tracking what happens to the error modes as we will post-select these
to be in the vacuum. Thus, so long as each error is unbiased and independent,
we might expect any desired gate fidelity to be achievable with sufficiently
large $N$. Specifically with
$\lim_{N\rightarrow\infty}\hat{\mathcal{U}}(N)=\hat{U}_{T}$, i.e. arbitrarily
high gate fidelity may be possible with sufficient redundancy. However, this
will be at the cost of a decreasing probability of success, $P_{s}(N)$.

As such, we can write the general, unnormalised state at the output modes
(i.e. after post selection but without renormalising the state) as

$\displaystyle\hat{\rho}(N)=$
$\displaystyle\,\hat{\mathcal{U}}(N)\left|\psi\right\rangle\left\langle\psi\right\rangle\hat{\mathcal{U}}^{\dagger}(N)$
$\displaystyle=$
$\displaystyle\left(\hat{U}_{T}+\frac{\hat{\epsilon}(N)}{N}\right)\left|\psi\right\rangle\left\langle\psi\right|\left(\hat{U}_{T}+\frac{\hat{\epsilon}^{\dagger}(N)}{N}\right)$
$\displaystyle=$
$\displaystyle\left|\Psi\right\rangle\left\langle\Psi\right|+\frac{1}{N}\left(\hat{\epsilon}(N)\left|\psi\right\rangle\left\langle\psi\right|\hat{U}_{T}+\hat{U}_{T}\left|\psi\right\rangle\left\langle\psi\right|\hat{\epsilon}^{\dagger}(N)\right)$
$\displaystyle+\frac{1}{N^{2}}\hat{\epsilon}(N)\left|\psi\right\rangle\left\langle\psi\right|\hat{\epsilon}^{\dagger}(N)$
(14)

and the density operator after post selection is again given by

$\hat{\rho}_{ps}=\left(P_{s}(N)\right)^{-1}\hat{\rho}(N).$ (15)

with the associated probability of success as define in Equation 4.

The probability of success can here be explicitly solved as determined by the
moments of the noise distributions under the assumptions that each noise term
is independent. For simplicity we take $\left\langle\delta O\right\rangle=0$,
$\left\langle\delta O^{2}\right\rangle=\nu$, $\left\langle\delta
O^{3}\right\rangle=0$ and $\left\langle\delta O^{4}\right\rangle=3\nu^{2}$,
for all noise terms $\delta O$ to give

$P_{s}\left(N\right)\approx
1-3\nu+\frac{3\nu}{N}+\frac{9\nu^{2}}{2}-\frac{9\nu^{2}}{2N}$ (16)

which is shown in Figure 3. For the details of this calculation up to first
order in $\nu$, see the supplemental information for this paper, the higher
order calculation was performed with the aid of _Mathematica_. We have taken
the noise to be Gaussian to simplify the result, however this could be
replaced by other unbiased probability distributions without significantly
impacting the results.

Figure 3: Probability of success scaling for an unitary averaged single qubit
gate as given by Equation 16. The dashed grey line shows the first order
scaling of $\lim_{N\rightarrow\infty}P_{s}\left(N\right)=1-3\nu$.

The post selected gate fidelity can be calculated similarly with

$\displaystyle\mathcal{F}(N)=$
$\displaystyle\left\langle\Psi\right|\rho_{ps}(N)\left|\Psi\right\rangle$
$\displaystyle=$
$\displaystyle\left(P_{s}(N)\right)^{-1}\left\langle\psi\right|\hat{U}_{T}^{\dagger}\,\hat{\mathcal{U}}(N)\left|\psi\right\rangle\left\langle\psi\right|\hat{\mathcal{U}}^{\dagger}(N)\hat{U}_{T}\left|\psi\right\rangle$
$\displaystyle=$
$\displaystyle\left(P_{s}(N)\right)^{-1}\left(1+\frac{1}{N}\sum_{j=1}^{N}\left\langle\psi\right|\hat{U}_{T}^{\dagger}\hat{E}_{j}\left|\psi\right\rangle\right)^{2}$
(17)

Again, the fidelity is characterised by the moments of the noise probability
distribution with

$\mathcal{F}\left(N\right)\approx\frac{1-3\nu+\frac{9}{4\nu^{2}}}{1-3\nu+\frac{\nu}{N}+\frac{9\nu^{2}}{2}-\frac{9\nu^{2}}{2N}}$
(18)

to the second order in the parameter variance $\nu$. The details of the
calculation are provided in the supplemental information. The fidelity scaling
is shown in Figure 4.

Figure 4: Post-selected Fidelity for an unitary averaged single qubit gate as
given by Equation 18.

##  V Two Qubit Gates

(a) General four mode interferometer.

(b) Reduced four mode interferometer capable of acting as a Type-II fusion
gate.

Figure 5: 5(a) General four mode linear optical gate for two qubits consisting
of beam splitters between pairs of modes and phase shifters marked by their
phase $\phi_{i}$. The Type-II fusion can be implemented with a reduced version
of this as shown in Figure 5(b) with all present beam splitters set to
$50:50$.

To be sufficient for arbitrary quantum computation it is necessary to have a
corrected universal gate set. While we have just shown it is possible to
protect any single qubit gate it is still necessary to provide for two qubit
gates such as the CNOT gate. Two qubit gates under parity encoding (CF Section
VII) can be enacted via single qubit gates and re-encoding using type-I and
type-II fusion gates [12]. As such, to protect against errors in two qubit
gates using unitary averaging, we need to consider how to protect the fusion
gates. Recent work has shown that UA can be employed to correct fusion gates
[7], however, this study was considering the low $N$ limit. A general two,
dual-rail qubit linear optical gate can be implemented by the interferometer
diagram shown in Figure 5. The fusion gates can be implemented by a simplified
version of this system, with additional measurements on the outputs which are
taken to occur separately to the UA protocol.

The same procedure for determining the probability of success for the one
photon gate can be employed, only due to the increased problem size
_Mathematica_ was used to simplify the expressions. It was found that the four
mode interferometer shown in Figure 5, when employing UA, will implement the
target gate with a post selected fidelity of

$\mathcal{F}_{\textrm{4-mode}}(N)=P_{\textrm{s,
4-mode}}(N)^{-1}\left(1-6\nu\right)$ (19)

and a success probability

$P_{\textrm{s,
4-mode}}(N)=1-6\nu+\frac{6\nu}{N}+18\nu^{2}-\frac{18\nu^{2}}{N^{2}}.$ (20)

These can be further improved in systems which do not require the full
generality enabled by such an interferometer. Specifically, when implementing
Type-II fusion gate, no phase manipulation is required, and the central column
of beam splitters can be replaced with a single, physical swapping of the
second and fourth modes. With this reduced system, the post selected fidelity
becomes

$\mathcal{F}_{\textrm{II}}(N)=P_{\textrm{s,
II}}(N)^{-1}\left(1-2\nu+2\nu^{2}\right)$ (21)

with a success probability of

$P_{\textrm{s, 4-mode}}(N)=1-2\nu+\frac{2\nu}{N}+2\nu^{2}-\frac{2\nu^{2}}{N}.$
(22)

It appears that the gate fidelity and probability of success scale linearly
with the optical depth of the circuit, as seen by comparing Equations 18, 19,
and 21 and Equations 16, 20, and 22. We can in general write the probability
of success and fidelity to the first order in the variance as

$\displaystyle P_{\textrm{s, g}}(N)=$ $\displaystyle
1-\mathcal{V}+\frac{\mathcal{V}}{N}$ (23) $\displaystyle\mathcal{F}_{g}(N)=$
$\displaystyle P_{\textrm{s, g}}(N)^{-1}\left(1-\mathcal{V}\right)$
$\displaystyle=$ $\displaystyle
1-\frac{\mathcal{V}}{N+\mathcal{V}-N\mathcal{V}}$ (24)

where $\mathcal{V}=d\times\nu$ is the characteristic noise parameter for a
circuit with an optical depth $d$.

This all suggests that, at the cost of heralded loss, we could achieve
arbitrarily high gate fidelities in linear optics with sufficiently large $N$.
An obvious hypothetical use case is then employing effectively infinite
averaging ($N\rightarrow\infty$) along with loss tolerance to achieve a regime
of _effective_ fault tolerance. By which we mean that, within the bounds of
the error model considered here, each gate implements a logical transformation
with perfect fidelity and so errors do not accumulate. However, perfect
fidelity only truly occurs for infinite averaging ($N=\infty$) and so may not
reasonably constitute true fault tolerance. None the less, the next section
presents how this process with the behaviour of UA within standard fault
tolerant protocols presenting in Section VIII.

##  VI Parity Encoding

Parity encoding (PE) provides a loss tollerant encoding in which extra
physical qubits can be added throughout the computation in responce to the
occurance of loss [4, 13]. Given that UA turns logical errors into heralded
loss, and PE corrects for photon loss, we will here seek to combine the two to
produce a general error correction scheme.

Full parity encoding employs two separate encoding steps, parity (P) type and
redundancy (R) type. P type encodes logical states as

$\displaystyle\left|0\right\rangle_{L}=$
$\displaystyle\left|0\right\rangle^{\left(n\right)}=\left(\left|+\right\rangle^{\otimes
n}+\left|-\right\rangle^{\otimes n}\right)/\sqrt{2}$
$\displaystyle\left|1\right\rangle_{L}=$
$\displaystyle\left|1\right\rangle^{\left(n\right)}=\left(\left|+\right\rangle^{\otimes
n}-\left|-\right\rangle^{\otimes n}\right)/\sqrt{2}$ (25)

where
$\left|\pm\right\rangle=\frac{1}{\sqrt{2}}\left(\left|H\right\rangle\pm\left|V\right\rangle\right)$
as we are considering here polarisation encoded qubits. The R type encoding
uses $q$ copies of each of these P encoded states. With this, an arbitrary
single qubit state is encoded as

$\left|\Psi\right\rangle_{L}=\alpha\bigotimes^{q}\left|0\right\rangle^{\left(n\right)}+\beta\bigotimes^{q}\left|1\right\rangle^{\left(n\right)}$
(26)

Parity encoding in optical quantum computing has been shown to contain a
universal gate set [13] with $\hat{X}$ and $\hat{Z}$ rotations implemented
simply by applying the gate to a single or all physical qubits respectively
while other gates require reencoding.

##  VII Parity Encoded and unitary averaged Single Qubit Gates

In this section we explore how parity encoding can be utilised in conjuction
with unitary averaging to implement high fidelity logical operations with a
high probability of success using only noisy unitary operations. To begin, we
present the case in which $J$ errors occur, but only within a single redundant
encoded state. Consider the initial state

$\left|\psi\right\rangle_{L}=\alpha\left|0\right\rangle^{(n)}\bigotimes^{q-1}\left|0\right\rangle^{(n)}+\beta\left|1\right\rangle^{(n)}\bigotimes^{q-1}\left|1\right\rangle^{(n)}$
(27)

on which we act a single logical qubit unitary
$\hat{U}=\bigotimes_{j=1}^{2n}\hat{u}_{j}$ which has some effect on each
individual, physical qubit. Note that here we have singled out a single
redundant copy of the parity encoding which we will consider to be the
location of the $J<n$ errors. We will take the individual unitaries to be
_unitary averaged_ with $N\rightarrow\infty$ and the error ports monitored
such that the resulting transformation is projected onto either the _correct_
target result, or a _heralded loss_. When a heralded loss occurs a unique
stochastic phase factor will then be written on to the physical qubit. Thus,
unitary averaging acts to transform each physical qubit according to

$\displaystyle\left|H\right\rangle_{i}\rightarrow$
$\displaystyle\hat{u}_{T}\left|H\right\rangle_{i}+\sum_{k=2}^{N}\delta
H_{i,k}\left|\epsilon_{k}\right\rangle_{i}$ (28)
$\displaystyle\left|V\right\rangle_{i}\rightarrow$
$\displaystyle\hat{u}_{T}\left|V\right\rangle_{i}-\sum_{k=2}^{N}\delta
V_{i,k}\left|\epsilon_{k}\right\rangle_{i}$ (29)

where we have neglected normalisation as after projecting on either the error
or no error result, it will not be important. Here each $\delta H_{i,k}$ and
$\delta V_{i,k}$ is the unique, stochastic phase factor and
$\left|\epsilon_{k}\right\rangle_{i}$ represents the photon in the $k$th error
mode which are to be measured, heralding a photon loss.

Any parity encoded state can be expanded, using the identity

$\displaystyle\left|0\right\rangle^{(j+k)}=$
$\displaystyle\frac{1}{\sqrt{2}}\left(\left|0\right\rangle^{(j)}\left|0\right\rangle^{(k)}+\left|1\right\rangle^{(j)}\left|1\right\rangle^{(k)}\right)$
(30) $\displaystyle\left|1\right\rangle^{(j+k)}=$
$\displaystyle\frac{1}{\sqrt{2}}\left(\left|0\right\rangle^{(j)}\left|1\right\rangle^{(k)}+\left|1\right\rangle^{(j)}\left|0\right\rangle^{(k)}\right).$
(31)

which, in the instance of $J$ errors occurring in only the first redundant
encoding, allows us to write

$\displaystyle\left\langle\mathbf{\epsilon}\right|_{\epsilon}^{1\rightarrow
J}\left\langle\mathbf{0}\right|_{\epsilon}^{J+1\rightarrow
n}\hat{U}\left|\psi\right\rangle_{L}=$
$\displaystyle\frac{\alpha}{\sqrt{2}}\left(\bigotimes^{k}\hat{u}_{T}\right)\left(\delta\Theta\left|0\right\rangle^{(k)}+\delta\Phi\left|1\right\rangle^{(k)}\right)\bigotimes^{q-1}\left[\left(\bigotimes^{n}\hat{u}_{T}\right)\left|0\right\rangle^{(n)}\right]$
$\displaystyle+\frac{\beta}{\sqrt{2}}\left(\bigotimes^{k}\hat{u}_{T}\right)\left(\delta\Theta\left|1\right\rangle^{(k)}+\delta\Phi\left|0\right\rangle^{(k)}\right)\bigotimes^{q-1}\left[\left(\bigotimes^{n}\hat{u}_{T}\right)\left|1\right\rangle^{(n)}\right]$
$\displaystyle=$
$\displaystyle\frac{\alpha}{2}\left(\bigotimes^{k}\hat{u}_{T}\right)\left[\left(\delta\Theta+\delta\Phi\right)\left|+\right\rangle^{\otimes
k}+\left(\delta\Theta-\delta\Phi\right)\left|-\right\rangle^{\otimes
k}\right]\bigotimes^{q-1}\left[\left(\bigotimes^{n}\hat{u}_{T}\right)\left|0\right\rangle^{(n)}\right]$
$\displaystyle+\frac{\beta}{2}\left(\bigotimes^{k}\hat{u}_{T}\right)\left[\left(\delta\Theta+\delta\Phi\right)\left|+\right\rangle^{\otimes
k}-\left(\delta\Theta-\delta\Phi\right)\left|-\right\rangle^{\otimes
k}\right]\bigotimes^{q-1}\left[\left(\bigotimes^{n}\hat{u}_{T}\right)\left|1\right\rangle^{(n)}\right]$
(32)

where $J+k=n$, $\left|\mathbf{0}\right\rangle_{\epsilon}^{a\rightarrow b}$
corresponds to error modes $a$ through to $b$ in the vacuum (no errors) while
$\left|\epsilon\right\rangle_{\epsilon}^{a\rightarrow b}$ corresponds to an
error occuring in modes $a$ through to $b$. Also

$\displaystyle\delta\Theta=$
$\displaystyle\left\langle\mathbf{\epsilon}\right|_{\epsilon}^{1\rightarrow
J}\left(\bigotimes_{i=1}^{J}\hat{\mathcal{U}}_{i,e}\right)\left|0\right\rangle^{(J)}$
(33) $\displaystyle\textrm{and }\delta\Phi=$
$\displaystyle\left\langle\mathbf{\epsilon}\right|_{\epsilon}^{1\rightarrow
J}\left(\bigotimes_{i=1}^{J}\hat{\mathcal{U}}_{i,e}\right)\left|1\right\rangle^{(J)}$
(34)

are stochastic $\mathbb{C}$ numbers whose value depends on the specific
location of the errors and the individual operations implemented on the
qubits. After renormalisation, these factors randomly take the values $\pm 1$.

If any one of the remaining $k$ physical qubits of the first redundant
encoding are measured in the
$\hat{u}_{T}\left|\pm\right\rangle^{(1)}=\frac{1}{\sqrt{2}}\hat{u}_{T}\left(\left|0\right\rangle^{(1)}\pm\left|1\right\rangle^{(1)}\right)$
basis, the state gains a corresponding and unimportant global phase factor of
$\left(\delta\Theta+\delta\Phi\right)$ for $\left|+\right\rangle^{(1)}$ and
$\left(\delta\Theta-\delta\Phi\right)$ for $\left|-\right\rangle^{(1)}$ and if
$\left|-\right\rangle^{(1)}$ is returned there will also be a sign error on
the logical $\left|1\right\rangle_{L}$ state. Thus, dropping the global phase,
the final state after projective measurements on all error channels and a
single un-errored channel, produces the final state after renormalisation

$\displaystyle\left|\psi_{out}(\pm)\right\rangle_{L}=$
$\displaystyle\left(\bigotimes^{k-1}\hat{u}_{T}\left|\pm\right\rangle\right)$
$\displaystyle\otimes\hat{U}_{T}\left(\alpha\bigotimes^{q-1}\left|0\right\rangle^{(n)}\pm\beta\bigotimes^{q-1}\left|1\right\rangle^{(n)}\right).$
(35)

That is to say, the partially errored, redundent state is unentangled from the
remainder of the state which successfully has the target unitary applied,
although with a potential known phase error. This can be repeated for any of
the remaining $q-1$ redundant copies in the parity encoding in which an error
is detected. Provided at least one entire redundant copy is heralded as error
free, the target unitary will be successfully applied, with a potential phase
error if an odd number of $\left|-\right\rangle$ states are returned during
the projective measurements. We therefore have the set of success criteria as

  1. 1.

At most $q-1$ redundant copies of the encoding are heralded to have
encountered an error. This ensures there remains a logical state on which the
gate is successfully applied.

  2. 2.

For all redundant copies of the encoding which are heralded to have
encountered an error, at least one physical qubit must not have been heralded
to be in error so that the projected measurement can be performed.

##  VIII unitary averaging and Standard Fault Tolerance

Now that we have established the action of UA on single and two cubit gates
and considered how it can be integrated into existing loss correction schemes,
it would be useful to attempt to translate these results into fault tolerant
error correction. The purpose here is to explore the benefits of employing UA
within existing error correction schemes to expand the parameter space for
which fault tolerance can be achieved. That is, we will consider how the fault
tolerant parameter space changes if the operations performed on each physical
qubit are done utilising UA. Specifically we will concern ourselves with the
per gate depolarisation probability $\varepsilon$ and per qubit, per gate loss
rate $\gamma$.

The easiest consideration is that of photon loss. This is because the UA
scheme does nothing to correct for losses, but does increase the optical depth
due to the encoding and decoding circuits. As discussed earlier, it will
increase the optical depth per gate by $2\log_{2}\left(N\right)$. Furthermore,
any heralded error will result in an effective loss, although a located one.
Here, we will not seek to use the located nature of this loss to our advantage
and treat it similarly to all other optical losses. As such, the UA scheme
acts to increase the effective loss rate depending on the depth of encoding
and decoding steps, and the probability of success. If the original loss rate
was $\gamma$ per qubit per gate, then we can approximate the new effective
loss rate for a gate as
$\Gamma=\frac{\gamma}{3}\left(3+2\log_{2}\left(N\right)\right)+\left(1-P_{s}(N)\right)$
per qubit per gate. Here, we have assumed all gates to have an optical depth
of a single qubit gate ($3$) and that encode and decode steps are as lossy as
each individual component within the gate. Given some gates are likely to be
much deeper than this we are likely over estimating the relative loss
introduced by the additional encoding.

We next turn our attention to the error rates. To achieve this, consider that
the gate fidelity relates to the probability that the qubit(s) it acts on
would be measured in the incorrect state. After the gate is applied, with
probability $\mathcal{F}(N)=1-\varepsilon$, the correct transformation is
applied, and thus with probability $\varepsilon$ any syndrome measurement will
herald an error. This suggests an equivalence between our characteristic noise
parameter ($\mathcal{V}$) and the typical noise parameter considered in fault
tolerance ($\varepsilon$) (the per qubit, per gate depolarisation rate). This
typical noise parameter corresponds to the more general depolarisation errors
occurring, which are not present in this model. However, if we take the
depolarisation effects as sourced by these same stochastic noises, we can
indeed treat these two noise terms as equivalent. Comparing to the fidelity
shown in Equation 24, we have an effective gate error rate of
$\mathcal{E}=\frac{\mathcal{\varepsilon}}{N+\varepsilon-N\varepsilon}$.

(a) FBQC 4-star architecture.

(b) FBQC 6-ring architecture.

(c) 7-qubit Steane code.

(d) 23-qubit Golay code.

Figure 6: Fault tolerant parameter space improvement estimation when employing
unitary averaging in a FBQC utilising a 4-star (6(a)) and 6-ring (6(b))
architecture, data taken from Figure 3 in [3], a 7-qubit Steane code (6(c))
and the 23-qubit Golay code (6(d)). $N=1$ data taken from [10] for the surface
code and the Steane and Golay codes respectively. Fault tolerance is achieved
within the shaded region for each value of $N$.

In the same manner as we discussed above with the loss tolerant parity code,
we can consider UA to sit within existing algorithms and serve to reduce the
effective gate error at the cost of increasing loss. We will use the above
results in conjunction with existing fault tolerant thresholds for some
example error correction schemes. If we take the earlier results of Dawson,
Haselgrove and Nielsen [10] and Fujii and Tokunaga [11], we can estimate the
effect UA has on the fault tolerant parameter space for a 7-qubit Steane code
and 23-qubit Golay code using Equations 24 and 23. We can also consider its
effect on a more modern fault tolerant architecture such as Fusion-based
Quantum Computation (FBQC) [3]. The results are shown in Figure 6. This
suggests a significant improvement in the parameter space at which fault
tolerance can be achieved despite the increase in effective loss due to a
lossy encoding circuit and the probabilistic nature of unitary averaging. This
improvement primarily arises due to the difference in scaling between the
effective loss rate $\Gamma$ and the gate error rate $\mathcal{E}$:

$\displaystyle\Gamma=$
$\displaystyle\frac{\gamma}{3}\left(3+2\log_{2}\left(N\right)\right)+\varepsilon\left(1-\frac{1}{N}\right)$
(36) $\displaystyle\mathcal{E}=$
$\displaystyle\frac{\mathcal{\varepsilon}}{N+\varepsilon-N\varepsilon}$ (37)

Specifically, for large $N$ we see loss scales logarithmically while the error
scales as $\propto 1/N$.

It is worth highlighting that the results in Figure 6 are dependent on some
fairly large assumptions. Specifically that each component that goes into
implementing these encodings and optical circuits can (1) be implemented using
UA and (2) that UA has the same effect on their output as seen above. For
example, implementing a measurement based quantum computer will likely require
many components not considered above such as quantum memories and detectors.
It seems reasonable that memories will be compatible with UA, however
destructive measurements can clearly not be treated as unitaries which can be
averaged, thus these results will likely only apply to the preparation stages
of such a device. Specifically considering the scaling shown in Figures 6(a)
and 6(b), the $N=1$ results are for an implementation agnostic analysis for
FBQC. For an optical implementation, at least some of the photon loss will be
due to the probabilistic nature of fusion gates and imperfect detectors. We
are here treating all loss as due to photon absorption in this situation, and
so are overestimating the additional loss induced with the increased optical
depth of UA. This has the effect of underestimating the tolerable loss to
maintain fault tolerance. As such, these results need to be viewed as
approximate scaling.

We also see a perhaps surprising result in Figures 6(a) and 6(b), where a
benifit is only observed for sufficiently large $N$, When $N\leq 8$, the
additional induced loss eliminates any benefit of improved tolerable error
rates, as a result, only with moderate large $N$ can any benefit from applying
UA be gained.

##  IX Conclusion

This paper has explored the use of UA within the context of applying arbitrary
one and two qubit gate transformations. We have shown that UA can be
implemented in such a way as to avoid encoding errors while also introducing
only a logarithmic number of optical elements to the path depth. Unitary
averaging may enable arbitrary high gate fidelity while at the fixed cost of a
reduced probability of success which is linear in the initial parameter
variance within a single unitary. We have also demonstrated that this loss can
be mitigated by employing existing techniques for loss protection which will
already be necessary in any large scale system. Furthermore, we have shown
that UA can be used within existing fault tolerant schemes to modify and
potentially improve the parameter space for which error tolerance may be
achieved. We have done so considering both early fault tolerant schemes which
can greatly benefit from the use of UA as well as more modern, surface code
based schemes for which the benefit of applying UA appears to be more modest.

## Acknowledgements

APL acknowledges support from BMBF (QPIC) and the Einstein Research Unit on
Quantum Devices. This research was supported by the Australian Research
Council (ARC) under the Centre of Excellence for Quantum Computation and
Communica- tion Technology (Project No. CE170100012).

## References

  * Nielsen and Chuang [2010] M. A. Nielsen and I. L. Chuang,  _Quantum computation and quantum information_ (Cambridge university press, 2010).
  * Broome  _et al._ [2013] M. A. Broome, A. Fedrizzi, S. Rahimi-Keshari, J. Dove, S. Aaronson, T. C. Ralph, and A. G. White, Photonic boson sampling in a tunable circuit, Science 339, 794 (2013).
  * Bartolucci  _et al._ [2023] S. Bartolucci, P. Birchall, H. Bombin, H. Cable, C. Dawson, M. Gimeno-Segovia, E. Johnston, K. Kieling, N. Nickerson, M. Pant, _et al._ , Fusion-based quantum computation, Nature Communications 14, 912 (2023).
  * Ralph  _et al._ [2005] T. C. Ralph, A. Hayes, and A. Gilchrist, Loss-tolerant optical qubits, Physical review letters 95, 100501 (2005).
  * Marshman  _et al._ [2018] R. J. Marshman, A. P. Lund, P. P. Rohde, and T. C. Ralph, Passive quantum error correction of linear optics networks through error averaging, Physical Review A 97, 022324 (2018).
  * Vijayan  _et al._ [2020] M. K. Vijayan, A. P. Lund, and P. P. Rohde, A robust w-state encoding for linear quantum optics, Quantum 4, 303 (2020).
  * Singh  _et al._ [2022] D. Singh, A. P. Lund, and P. P. Rohde, Optical cluster-state generation with unitary averaging, arXiv preprint arXiv:2209.15282 (2022).
  * Knill  _et al._ [2001] E. Knill, R. Laflamme, and G. J. Milburn, A scheme for efficient quantum computation with linear optics, nature 409, 46 (2001).
  * Rudolph [2017] T. Rudolph, Why i am optimistic about the silicon-photonic route to quantum computing, APL photonics 2, 030901 (2017).
  * Dawson  _et al._ [2006] C. M. Dawson, H. L. Haselgrove, and M. A. Nielsen, Noise thresholds for optical quantum computers, Physical review letters 96, 020501 (2006).
  * Fujii and Tokunaga [2012] K. Fujii and Y. Tokunaga, Error and loss tolerances of surface codes with general lattice structures, Physical Review A 86, 020303 (2012).
  * Hayes  _et al._ [2010] A. Hayes, H. Haselgrove, A. Gilchrist, and T. Ralph, Fault tolerance in parity-state linear optical quantum computing, Physical Review A 82, 022323 (2010).
  * Hayes  _et al._ [2008] A. Hayes, A. Gilchrist, and T. C. Ralph, Loss-tolerant operations in parity-code linear optics quantum computing, Physical Review A 77, 012310 (2008).

##  Appendix A Single Qubit Gate Errors Calculation

Here I present the details of so solving for the expectation values used to
calculate the probability of success when error averaging a single qubit gate.

###  A.1 Errored Single Qubit Gate

Here we consider each physical gate to be averaged $\hat{U}_{j}$. Taylor
expanding each parameter and keeping only the terms which are bilinear or
quadratic in the error terms gives

$\displaystyle\hat{U}_{j}=$
$\displaystyle\begin{bmatrix}e^{i\phi_{1,j}}e^{i\chi_{1,j}}\sin\left(\theta_{j}\right)&e^{i\phi_{2,j}}e^{i\chi_{1,j}}\cos\left(\theta_{j}\right)\\\
e^{i\phi_{1,j}}e^{i\chi_{2,j}}\cos\left(\theta_{j}\right)&-e^{i\phi_{2,j}}e^{i\chi_{2,j}}\sin\left(\theta_{j}\right)\end{bmatrix}$
$\displaystyle=$ $\displaystyle\begin{bmatrix}a_{j}&b_{j}\\\
c_{j}&d_{j}\end{bmatrix}$ (38)

where

$\displaystyle a_{j}=$ $\displaystyle
e^{i\phi_{1}}e^{i\chi_{1}}\sin\left(\theta\right)+\Bigg{[}e^{i\phi_{1}}e^{i\chi_{1}}\sin\left(\theta\right)\left(i\delta\phi_{1,j}+i\delta\chi_{1,j}-\delta\phi_{1,j}\delta\chi_{1}-\frac{\delta\phi_{1,j}^{2}}{2}-\frac{\delta\chi_{1,j}^{2}}{2}-\frac{\delta\theta_{j}^{2}}{2}\right)$
$\displaystyle+e^{i\phi_{1}}e^{i\chi_{1}}\cos\left(\theta\right)\delta\theta_{j}\left(1+i\delta\phi_{1,j}+i\delta\chi_{1,j}\right)\Bigg{]}\equiv
a+\left[\delta a_{j}\right]$ (39) $\displaystyle b_{j}=$ $\displaystyle
e^{i\phi_{2}}e^{i\chi_{1}}\cos\left(\theta\right)+\Bigg{[}e^{i\phi_{2}}e^{i\chi_{1}}\cos\left(\theta\right)\left(i\delta\phi_{2,j}+i\delta\chi_{1,j}-\delta\phi_{2,j}\delta\chi_{1,j}-\frac{\delta\phi_{2,j}^{2}}{2}-\frac{\delta\chi_{1,j}^{2}}{2}-\frac{\delta\theta_{j}^{2}}{2}\right)$
$\displaystyle-e^{i\phi_{2}}e^{i\chi_{1}}\sin\left(\theta\right)\delta\theta_{j}\left(1+i\delta\phi_{2,j}+i\delta\chi_{1,j}\right)\Bigg{]}\equiv
b+\left[\delta b_{j}\right]$ (40) $\displaystyle c_{j}=$ $\displaystyle
e^{i\phi_{1}}e^{i\chi_{2}}\cos\left(\theta\right)+\Bigg{[}e^{i\phi_{1}}e^{i\chi_{2}}\cos\left(\theta\right)\left(i\delta\phi_{1,j}+i\delta\chi_{2,j}-\delta\phi_{1,j}\delta\chi_{2,j}-\frac{\delta\phi_{1,j}^{2}}{2}-\frac{\delta\chi_{2,j}^{2}}{2}-\frac{\delta\theta_{j}^{2}}{2}\right)$
$\displaystyle-e^{i\phi_{1}}e^{i\chi_{2}}\sin\left(\theta\right)\delta\theta_{j}\left(1+i\delta\phi_{1,j}+i\delta\chi_{2,j}\right)\Bigg{]}\equiv
c+\left[\delta c_{j}\right]$ (41) $\displaystyle d_{j}=$
$\displaystyle-e^{i\phi_{2}}e^{i\chi_{2}}\sin\left(\theta\right)+\Bigg{[}-e^{i\phi_{2}}e^{i\chi_{2}}\sin\left(\theta\right)\left(i\delta\phi_{2,j}+i\delta\chi_{2,j}-\delta\phi_{2,j}\delta\chi_{2,j}-\frac{\delta\phi_{2,j}^{2}}{2}-\frac{\delta\chi_{2,j}^{2}}{2}-\frac{\delta\theta_{j}^{2}}{2}\right)$
$\displaystyle-e^{i\phi_{2}}e^{i\chi_{2}}\cos\left(\theta\right)\delta\theta_{j}\left(1+i\delta\phi_{2,j}+i\delta\chi_{2,j}\right)\Bigg{]}\equiv
d+\left[\delta d_{j}\right].$ (42)

Each term within the square bracket represents the noise term unique to each
physical copy of the unitary while the preceding term is the intended value of
each matrix element. Thus we can write

$\hat{U}_{j}=\begin{bmatrix}a&b\\\ c&d\end{bmatrix}+\begin{bmatrix}\delta
a_{j}&\delta b_{j}\\\ \delta c_{j}&\delta
d_{j}\end{bmatrix}=\hat{U}_{T}+\hat{E}_{j}.$ (43)

###  A.2 Solving For Probability of Success

To solve for the probability of success $P_{s}(N)$ we assume each noise term
is independent, with $\left\langle\delta O\right\rangle=0$ and
$\left\langle\delta O^{2}\right\rangle=\nu$ for all terms $\delta O$ and use
the Taylor expanded form of the applied transformations as given above. We
also consider the general input state

$\left|\psi\right\rangle=\begin{bmatrix}\alpha\\\ \beta\end{bmatrix}.$ (44)

The probability of success is then given by

$\displaystyle P_{s}(N)=$
$\displaystyle\left\langle\psi\right|\hat{\mathcal{U}}^{\dagger}(N)\hat{\mathcal{U}}(N)\left|\psi\right\rangle$
$\displaystyle=$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle\psi\right|\hat{U}_{j}^{\dagger}\hat{U}_{k}\left|\psi\right\rangle$
$\displaystyle=$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\Bigg{[}\left|\alpha\right|^{2}\left\langle
a_{j}^{*}a_{k}+c_{j}^{*}c_{k}\right\rangle$
$\displaystyle+\left|\beta\right|^{2}\left\langle
b_{j}^{*}b_{k}+d_{j}^{*}d_{k}\right\rangle+\alpha^{*}\beta\left\langle
a_{j}^{*}b_{k}+c_{j}^{*}d_{k}\right\rangle$
$\displaystyle+\alpha\beta^{*}\left\langle
b_{j}^{*}a_{k}+d_{j}^{*}c_{k}\right\rangle\Bigg{]}$ (45)

Going term-by-term through this gives

$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
a_{j}^{*}a_{k}\right\rangle=$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\Bigg{\\{}\sin^{2}\left(\theta\right)\bigg{[}\left\langle
1-\frac{1}{2}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}+\delta\theta_{1,j}^{2}\right)-\frac{1}{2}\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}+\delta\theta_{1,k}^{2}\right)\right\rangle$
$\displaystyle+\left\langle\frac{1}{4}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\theta_{1,j}^{2}\right)\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}^{2}+\delta\theta_{1,k}^{2}\right)\right\rangle+\delta_{j,k}\left\langle\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\phi_{j}^{2}\delta\chi_{1,j}^{2}\right\rangle\bigg{]}$
$\displaystyle+\cos^{2}\left(\theta\right)\delta_{j,k}\left\langle\theta_{j}^{2}\right\rangle\left\langle
1+\delta\phi_{j}^{2}+\delta\chi_{j}^{2}\right\rangle\Bigg{\\}}$
$\displaystyle=$
$\displaystyle\sin^{2}\left(\theta\right)\left(1-3\nu+\frac{9}{4}\nu^{2}+\frac{2\nu+\nu^{2}}{N}\right)+\cos^{2}\left(\theta\right)\frac{\nu+2\nu^{2}}{N}=\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
d_{j}^{*}d_{k}\right\rangle,$ (46)
$\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
b_{j}^{*}b_{k}\right\rangle=\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
c_{j}^{*}c_{k}\right\rangle=\cos^{2}\left(\theta\right)\left(1-3\nu+\frac{9}{4}\nu^{2}+\frac{2\nu+\nu^{2}}{N}\right)+\sin^{2}\left(\theta\right)\frac{\nu+2\nu^{2}}{N}$
(47)

and

$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
a_{j}^{*}b_{k}\right\rangle=$
$\displaystyle\frac{e^{i\left(\phi_{2}-\phi_{1}\right)}}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\Bigg{\\{}\sin\left(\theta\right)\cos\left(\theta\right)\bigg{[}\left\langle
1-\frac{1}{2}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}+\delta\theta_{1,j}^{2}\right)-\frac{1}{2}\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}+\delta\theta_{1,k}^{2}\right)\right\rangle$
$\displaystyle+\left\langle\frac{1}{4}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\theta_{1,j}^{2}\right)\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}^{2}+\delta\theta_{1,k}^{2}\right)\right\rangle+\delta_{j,k}\left\langle\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\phi_{j}^{2}\delta\chi_{1,j}^{2}\right\rangle\bigg{]}$
$\displaystyle-\sin\left(\theta\right)\cos\left(\theta\right)\delta_{j,k}\left\langle\theta_{j}^{2}\right\rangle\left\langle
1+\delta\phi_{j}^{2}+\delta\chi_{j}^{2}\right\rangle\Bigg{\\}}$
$\displaystyle\implies$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\alpha^{*}\beta\left\langle
a_{j}^{*}b_{k}\right\rangle+\alpha\beta^{*}\left\langle
a_{j}b_{k}^{*}\right\rangle=2\left|\alpha\right|\left|\beta\right|\cos\left(\gamma\right)\sin\left(\theta\right)\cos\left(\theta\right)\left(1-3\nu+\frac{9}{4}\nu^{2}+\frac{\nu-\nu^{2}}{N}\right)$
(48)

where $\gamma=\phi_{1}-\phi_{2}-\theta_{\alpha}+\theta_{\beta}$ for
$\alpha=\left|\alpha\right|e^{i\theta_{\alpha}}$ and
$\beta=\left|\beta\right|e^{i\theta_{\beta}}$. Similarly

$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\left\langle
c_{j}^{*}d_{k}\right\rangle=$
$\displaystyle-\frac{e^{i\left(\phi_{2}-\phi_{1}\right)}}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\Bigg{\\{}\sin\left(\theta\right)\cos\left(\theta\right)\bigg{[}\left\langle
1-\frac{1}{2}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}+\delta\theta_{1,j}^{2}\right)-\frac{1}{2}\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}+\delta\theta_{1,k}^{2}\right)\right\rangle$
$\displaystyle+\left\langle\frac{1}{4}\left(\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\theta_{1,j}^{2}\right)\left(\delta\phi_{1,k}^{2}+\delta\chi_{1,k}^{2}+\delta\theta_{1,k}^{2}\right)\right\rangle+\delta_{j,k}\left\langle\delta\phi_{1,j}^{2}+\delta\chi_{1,j}^{2}+\delta\phi_{j}^{2}\delta\chi_{1,j}^{2}\right\rangle\bigg{]}$
$\displaystyle-\sin\left(\theta\right)\cos\left(\theta\right)\delta_{j,k}\left\langle\theta_{j}^{2}\right\rangle\left\langle
1+\delta\phi_{j}^{2}+\delta\chi_{j}^{2}\right\rangle\Bigg{\\}}$
$\displaystyle\implies$
$\displaystyle\frac{1}{N^{2}}\sum_{j=1}^{N}\sum_{k=1}^{N}\alpha^{*}\beta\left\langle
c_{j}^{*}d_{k}\right\rangle+\alpha\beta^{*}\left\langle
d_{j}c_{k}^{*}\right\rangle=-2\left|\alpha\right|\left|\beta\right|\cos\left(\gamma\right)\sin\left(\theta\right)\cos\left(\theta\right)\left(1-3\nu+\frac{9}{4}\nu^{2}+\frac{\nu-\nu^{2}}{N}\right).$
(49)

Putting this all together yields

$P_{s}\left(N\right)=1-3\nu+\frac{3\nu}{N}+\frac{9\nu^{2}}{4}+\frac{3\nu^{2}}{N}$
(50)

Note that this function is only accurate up to $\mathcal{O}(\nu)$ as $\nu^{2}$
terms can arise due to $\left\langle\mathcal{O}(\delta
x^{4})\mathcal{O}(\delta x^{0})\right\rangle$ which have not been included.
For this reason a calculation including fourth order in $\delta x$ was
completed as above to yield

$\displaystyle P_{s}\left(N\right)\approx$ $\displaystyle
1-3\nu+\frac{3\nu}{N}+4\nu^{2}-\frac{4\nu^{2}}{N}$
$\displaystyle-\frac{21\nu^{3}}{8}+\frac{\nu^{3}}{12N}+\frac{49\nu^{4}}{64}+\frac{13\nu^{4}}{6N}$
(51)

which is similarly only complete up to $\mathcal{O}(\nu^{2})$. This is the
cause of the erroneous behaviour where $P_{s}\left(N=1\right)<0$ for $\nu>0$.

###  A.3 Solving For Fidelity

To solve for the fidelity can be done in much the same manner. Particularly as
after re-normalisation the corrected state will be pure. As such we can write
the corrected state fidelity as

$\displaystyle\mathcal{F}(N)=$
$\displaystyle\left\langle\Psi\right|\hat{\rho}_{ps}(N)\left|\Psi\right\rangle$
$\displaystyle=$
$\displaystyle\left(P_{s}(N)\right)^{-1}\left(1+\frac{1}{N}\sum_{j=1}^{N}\left\langle\psi\right|\hat{U}_{T}^{\dagger}\hat{E}_{j}\left|\psi\right\rangle\right)^{2}$
$\displaystyle=$
$\displaystyle\left(P_{s}(N)\right)^{-1}\Bigg{(}1+\frac{\mathcal{N}}{N}\sum_{j=1}^{N}\bigg{[}\left|\alpha\right|^{2}\left\langle
a^{*}\delta a_{j}+c^{*}\delta
c_{j}\right\rangle+\left|\beta\right|^{2}\left\langle b^{*}\delta
b_{j}+d^{*}\delta d_{j}\right\rangle+\alpha^{*}\beta\left\langle a^{*}\delta
b_{j}+c^{*}\delta d_{j}\right\rangle$
$\displaystyle+\alpha\beta^{*}\left\langle b^{*}\delta a_{j}+d^{*}\delta
c_{j}\right\rangle\bigg{]}\Bigg{)}$ (52)

So once again going term-by-term, and here expanding $\delta a_{j}/\delta
b_{j}/\delta c_{j}/\delta d_{j}$ up to fourth order in the error terms give

$\frac{1}{N}\sum_{j=1}^{N}\left\langle a^{*}\delta
a_{j}\right\rangle=\frac{1}{N}\sum_{j=1}^{N}\left\langle d^{*}\delta
d_{j}\right\rangle=\sin^{2}\left(\theta\right)\left(-\frac{3\nu}{2}+\frac{7\nu^{2}}{8}\right),$
(53) $\frac{1}{N}\sum_{j=1}^{N}\left\langle b^{*}\delta
b_{j}\right\rangle=\frac{1}{N}\sum_{j=1}^{N}\left\langle c^{*}\delta
c_{j}\right\rangle=\cos^{2}\left(\theta\right)\left(-\frac{3\nu}{2}+\frac{7\nu^{2}}{8}\right),$
(54)

and

$\displaystyle\frac{1}{N}\sum_{j=1}^{N}\alpha^{*}\beta\left\langle a^{*}\delta
b_{j}\right\rangle+\alpha\beta^{*}\left\langle b^{*}\delta
a_{j}\right\rangle=$ $\displaystyle
2\left|\alpha\right|\left|\beta\right|\cos\left(\gamma\right)\sin\left(\theta\right)\cos\left(\theta\right)\left(-\frac{3\nu}{2}+\frac{7\nu^{2}}{8}\right)$
(55)

where $\gamma=\phi_{1}-\phi_{2}-\theta_{\alpha}+\theta_{\beta}$ for
$\alpha=\left|\alpha\right|e^{i\theta_{\alpha}}$ and
$\beta=\left|\beta\right|e^{i\theta_{\beta}}$. Similarly

$\displaystyle\frac{1}{N}\sum_{j=1}^{N}\alpha^{*}\beta\left\langle c^{*}\delta
d_{j}\right\rangle+\alpha\beta^{*}\left\langle d^{*}\delta
c_{j}\right\rangle=$
$\displaystyle-2\left|\alpha\right|\left|\beta\right|\cos\left(\gamma\right)\sin\left(\theta\right)\cos\left(\theta\right)\left(-\frac{3\nu}{2}+\frac{7\nu^{2}}{8}\right)$
(56)

Putting this all together yields

$\displaystyle\mathcal{F}\left(N\right)\approx$
$\displaystyle\left(P_{s}(N)\right)^{-1}\left(1-\frac{3\nu}{2}+\frac{7\nu^{2}}{8}\right)^{2}$
$\displaystyle\approx$
$\displaystyle\left(1-3\nu+\frac{3\nu}{N}+4\nu^{2}-\frac{4\nu^{2}}{N}\right)^{-1}\left(1-3\nu+4\nu^{2}\right)$
(57)

##  Appendix B Fusion Gates

The Type-II gate is implemented by the transformation

$\displaystyle F_{II}=$
$\displaystyle\begin{bmatrix}\sin\left(\theta_{3}\right)&\cos\left(\theta_{3}\right)&0&0\\\
\cos\left(\theta_{3}\right)&-\sin\left(\theta_{3}\right)&0&0\\\
0&0&\sin\left(\theta_{4}\right)&\cos\left(\theta_{4}\right)\\\
0&0&\cos\left(\theta_{4}\right)&-\sin\left(\theta_{4}\right)\end{bmatrix}\begin{bmatrix}1&0&0&0\\\
0&0&0&1\\\ 0&0&1&0\\\
0&1&0&0\end{bmatrix}\begin{bmatrix}\sin\left(\theta_{1}\right)&\cos\left(\theta_{1}\right)&0&0\\\
\cos\left(\theta_{1}\right)&-\sin\left(\theta_{1}\right)&0&0\\\
0&0&\sin\left(\theta_{2}\right)&\cos\left(\theta_{2}\right)\\\
0&0&\cos\left(\theta_{2}\right)&-\sin\left(\theta_{2}\right)\end{bmatrix}$
$\displaystyle=$
$\displaystyle\begin{bmatrix}\sin\left(\theta_{1}\right)\sin\left(\theta_{3}\right)&\cos\left(\theta_{1}\right)\sin\left(\theta_{3}\right)&\cos\left(\theta_{2}\right)\cos\left(\theta_{3}\right)&-\sin\left(\theta_{2}\right)\cos\left(\theta_{3}\right)\\\
\sin\left(\theta_{1}\right)\cos\left(\theta_{3}\right)&\cos\left(\theta_{1}\right)\cos\left(\theta_{3}\right)&-\cos\left(\theta_{2}\right)\sin\left(\theta_{3}\right)&\sin\left(\theta_{2}\right)\sin\left(\theta_{3}\right)\\\
\cos\left(\theta_{1}\right)\cos\left(\theta_{4}\right)&-\sin\left(\theta_{1}\right)\cos\left(\theta_{4}\right)&\sin\left(\theta_{2}\right)\sin\left(\theta_{4}\right)&\cos\left(\theta_{2}\right)\sin\left(\theta_{4}\right)\\\
-\cos\left(\theta_{1}\right)\sin\left(\theta_{4}\right)&\sin\left(\theta_{1}\right)\sin\left(\theta_{4}\right)&\sin\left(\theta_{2}\right)\cos\left(\theta_{4}\right)&\cos\left(\theta_{2}\right)\cos\left(\theta_{4}\right)\\\
\end{bmatrix}$ (58)

Preceeding as before, but with the aid of _Mathematica_ , we can see for a
general two photon input state the probability of success is given by

$P_{\textrm{s,
II}}(N)=1-2\nu+\frac{2\nu}{N}+\frac{5\nu^{2}}{3}-\frac{5\nu^{2}}{3N}$ (59)

and the post selected fidelity of

$\mathcal{F}_{\textrm{II}}(N)=P_{\textrm{s,
II}}(N)^{-1}\left(1-2\nu+\frac{5\nu^{2}}{3}\right)$ (60)

where once again, each parameter is taken to have an equal but independent
noise spectrum with the parameter $O=O_{T}+\delta O$, $\left\langle
O\right\rangle=O_{T}$, $\left\langle\delta O\right\rangle=0$,
$\left\langle\delta O^{2}\right\rangle=\nu$, $\left\langle\delta
O^{3}\right\rangle=0$, $\left\langle\delta O^{4}\right\rangle=\nu^{2}$.