Quantum Circuit Mapping for Universal and Scalable Computing in MZI-based Integrated Photonics

Linear optical quantum computing (LOQC) offers a quantum computation paradigm based on well-established and robust technology and flexible environmental conditions following DiVincenzo's criteria. Within this framework, integrated photonics can be utilized to achieve gate-based quantum computing, defining qubits by path-encoding, quantum gates through the use of Mach-Zehnder interferometers (MZIs) as fundamental building blocks, and measurements through single-photon detectors. In particular, universal two-qubit gates can be achieved by suitable structures of MZIs together with post-selection or heralding. The most resource-efficient choice is given by the post-selected CZ gate. However, this implementation is characterized by a design which has a non-regular structure and cannot be cascaded. This limits the implementation of large-scale LOQC. Starting from these issues, we suggest an approach to move toward a universal and scalable LOQC on the integrated photonic platform. First of all, choosing the post-selected CZ as universal two-qubit gate, we extend the path-encoded dual-rail qubit to a triplet of waveguides, composed of an auxiliary waveguide and the pair of waveguides corresponding to the qubit basis states. Additionally, we introduce a swap photonic network that maps the regularly-labeled structure of the new path-encoded qubits to the structure needed for the post-selected CZ. We also discuss the optical swap gate that allows the connection of non-nearest neighbor path-encoded qubits. In this way, we can deterministically exchange the locations of the qubits and execute controlled quantum gates between any path-encoded qubits. Next, by truncating the auxiliary waveguides after any post-selected CZ, we find that it is possible to cascade this optical gate when it acts on different pairs that share only one qubit.


Introduction
In the last decades, quantum computing (QC) [1,2] has been established as a new computational paradigm, whose logic and rules obey the quantum principles.Any quantum algorithm is composed of the preparation, manipulation and measurement stages.The requirements to translate QC from high-level language to its concrete realization are given by DiVincenzo's criteria [3].Thus, these conditions are used to select suitable platforms to build a scalable and universal quantum computer.
Among different candidates, quantum photonics offers an integrated architecture that can be scaled up and satisfies DiVincenzo's criteria potentially at room temperature and without strict environmental conditions.In quantum photonics, physical qubits are given by the photons, or more explicitly by their degrees of freedom.To define photonic qubits, there are different options: time-bin, path, polarization, angular momentum etc [4,5].For each choice, we need to operationally establish the fundamental building blocks for the preparation, manipulation and measurement stages, following DiVincenzo's criteria.In integrated photonics, the spatial degree of freedom is mostly used because of well-established and compact technology that allows the manipulation of single-qubit states.Single-qubit operators in path encoding can be implemented by a Mach-Zehnder interferometer (MZI), whose building blocks are beam splitters and phase shifters [6,7].Moreover, enlarging the number of paths for the photons makes possible to arrange -dimensional qubits, or qudits, with the same resources.Indeed, the manipulation of a qudit is given by a network of MZIs that executes a generic unitary transformation for a -dimensional vector.It is well-known that there are two universal schemes able to make such an operation: Reck [8] and Clements [9] schemes.To realize a universal photonic two-qubit gate [10,11], there are still limitations due to the lack of deterministic structures that operate differently on two-photons states with respect to single-photon states.Of course, linear transformations do not satisfy this request and, naively, one can think that two-photons gates strictly require some non-linear action.An example is provided by a Kerr-nonlinearity that operates at the single photon level [12].However, the breakthrough arrived when it was understood that measurement, post-selection or heralding introduce an effective non-linearity.Thus, it is possible to achieve multi-photon gates by looking at a restricted subset of events, selected by specific criteria.The price for not using non-linear manipulation is given by a probabilistic gate with a success probability lower than 100%.Many successful concepts were demonstrated through linear manipulation of photons [13][14][15][16], such as Knill-Laflamme-Milburn protocol [17,18] and post-selection for Controlled-Z gate (CZ) [19].These introductory results show that linear optical quantum computing (LOQC) promises to implement quantum information processing [20][21][22][23][24].
In the perspective of large-scale fault-tolerant quantum computing, for example achieved through surface codes [25,26], LOQC-based computers have to scale up the capability of computation.Silicon photonics has demonstrated the potential to integrate large-scale computation protocols [27,28], as well as gate-based quantum computing schemes based on simple optical components [29][30][31].However, the scalability condition requires a regular qubit structure and the possibility of connecting all the qubits.Two-qubit gates like the post-selected CZ gate do not satisfy these requirements, and therefore represent an obstacle to scalability.In fact, even though the post-selected CZ gate demonstrates the correct two-qubit operation, the currently implemented structure has trouble in connecting two qubits that are not located in their nearest neighbours.As we discuss here, these problems can be solved by tailored photonic structures based on reconfigurable photonic networks which enable connecting qubits and arranging a regular structure.In addition, we explain how to solve the issues related to the connectivity and the cascading of post-selected CZ gates for two different pairs of qubits that share only one qubit.
The paper is organized as follows.Section 2 reviews the linear optics for quantum computation.We focus on the path encoding in quantum photonics to define the qubit starting from dual-rail representation.Then, we define single-qubit quantum gates by using linear optical components.In the same way, we also explain the photonic implementation of CZ gate, which is achieved through post-selection and MZIs as fundamental ingredients.Based on these backgrounds, Section 3 describes our proposals for scalability in LOQC on the integrated photonic platform.Firstly, we describe the regularly-labeled structure of waveguides.Secondly, we present the optical swap gates, which allow the use of the regular structure or change the location of path-encoded qubits, acting as a generic SWAP quantum gate.As applied examples, Section 4 shows the Bell state and Greenberger-Horne-Zeilinger (GHZ) state generation circuits.Lastly, in Sec. 5 we summarize the results and present perspectives and problems.

LOQC system
In the following subsections, we start by defining operationally the qubit in a photonic integrated circuit (PIC) by employing the spatial degrees of freedom of the photons.After that, we show how to describe the fundamental building blocks for a photonic quantum computation.In particular, we present path-encoded single-qubit and two-qubit gates and their implementations.

Bosonic qubits and Path encoding
A physical qubit is the fundamental unit of quantum information defined by two distinct discrete states in any system showing quantum mechanical properties, like superposition.
In quantum photonics, a path-encoded qubit is a bosonic qubit, which is defined by the position of one photon between two waveguides.In other words, this definition utilizes the position of a photon for the two-level system needed for a qubit.For two waveguides, denoted by  0 and  1 and one photon propagating in one of the two waveguides, we define the configurations for the path-encoded or dual-rail computational basis where â † are creation operators related to the photon in a particular waveguide, |Ω⟩ is the vacuum state, and  0 and  1 indicates the upper and the lower waveguide, respectively.In the previous equation and along the work, we denote with bold numbers (0, 1) the occupation numbers and with sans serif numbers (0, 1) the computational basis in the considered set of waveguides.Then, we express an arbitrary quantum state of one bosonic qubit as where the probability amplitudes  and  of |⟩ satisfies the condition Since one qubit consists of one photon and two waveguides,  photonic path-encoded qubits are given by 2 waveguides and  identical photons.Each photon is assigned to a pair of waveguides and such collection of two-level systems determines the set of  qubits.This configuration with one photon in every waveguides' pair defines the qubit structure, that must be preserved during the manipulation and at the measurement stage.Thus, post-selection is needed in order to select the events that satisfy the qubit structure.The dual-rail structure is particularly powerful since losses due to real devices do not preserve the qubit structure and can be easily taken into account by post-selection [32].
The generic path-encoded -qubits state reads where the index  denotes the -th pair of waveguides which is assigned to the the -th path-encoded qubit and it holds Any transformation of single path-encoded qubits can be simply achieved by one MZI (see next subsection for details).The MZIs for single-qubit transformations connect the two waveguides belonging to the same photonic qubit.Consequently, in the ideal case, they preserve the qubit structure since the MZI is a 2 × 2 optical component, i.e. it operates within the single waveguides' pair.In the case of real devices, losses decrease the number of photons and therefore create events outside the qubit structure that can be distinguished.
In addition to single-qubit operations, we need only one controlled two-qubit operation to achieve a set of universal gates.In order to introduce two-qubit gates, the pairs of waveguides need to interact and preserve the qubit structure.To achieve this, we can consider suitable networks of MZIs: in this way we can exploit the same reconfigurable resource used for single-qubit operations.Given a generic set of  waveguides, the universal transformation can be implemented by a  ×  network of MZIs [8,9].The term "universal" does not mean that such a network can execute QC universal gates like CZ and CNOT.It means that any input single-photon state propagating in the -modes circuit can be mapped to any output single-photon state.More rigorously, the MZI network implements a generic unitary transformation for -dimensional complex vector, which represents the probability amplitudes of the single photon propagating in  paths.For example, given a single photon inserted in the -th input, the transformation is where â † s are the creation operator of the network modes ( 1 . . .  ) and    are the matrix elements that describe the action of the MZIs network.The previous equation tells us that the input state with a photon in the -th waveguide is transformed into a generic superposition state of the photon in the set of  waveguides.When we insert more than one photon in a generic network, even if the transformation is linear, the interference between indistinguishable outputs produces not trivial results.Examples of non-triviality are given by the Hong-Ou-Mandel effect [33] and Boson Sampler [34,35].In the first case, two single photons are inserted in the inputs of a balanced beam splitter producing an entangled path-encoded state [36,37], and in the second case, the result is linked to the permanent [38] of the generic unitary transformation represented by the MZI network.The complexity of MZI networks suggests that multi-photon gates can be realized by suitable choices of the MZIs' phases and by post-selection operations to preserve the desired qubit structure.Naively, one can think that a 4 × 4 MZI network connecting two pairs of waveguides with two single photons could implement a universal two-qubit gate such as the CNOT and CZ gates.Unfortunately, as we demonstrate in Appendix A, this does not occur.Larger MZI matrices are needed to implement a controlled two-qubit gate.Noteworthy, from the point of view of resources and within the gate-based approach, the post-selected CZ gate [19] is the most efficient way to implement the CZ operation.
Therefore, we use this gate as a benchmark.The realization of the post-selected CZ gate involves two additional waveguides which are denoted as auxiliary waveguides.Thus, six total waveguides and two photons are required to implement such a CZ gate between two qubits.At the end of the operation, it is also necessary to check that the qubit structure is preserved.This post-selection operation makes probabilistic the correct execution of the gate.The configuration with six waveguides for the CZ gate between two qubits suggests that an auxiliary waveguide can be assigned to each pair of waveguides that defines one dual-rail qubit.In Fig. 1 we report a graphical representation of the chosen photonic qubit.Therefore, the path-encoded qubit is re-defined by one photon that propagates in three waveguides, denoted as (  ,  0 ,  1 ).When we consider  qubits, we denote their triplet of waveguides as (   ,   0 ,   1 ).The qubit structure requires that only one photon is present in each doublet (  0 ,   1 ), which represents the path-encoded computational basis, and no photon in    at the input and output of every gate.This is trivially satisfied by single-qubit gates that operate within every doublet (  0 ,   1 ), but it is not guaranteed by the post-selected CZ.As it is explained later more explicitly, even in the ideal case with no losses, the post-selected CZ gives rise to events with photons in the auxiliary waveguides and zero or two photons in the waveguides' pair corresponding to the same qubit.In the real case with losses, we have also to discard events with a decreased number of photons with respect to the initial ones.
To summarize, whenever the output is composed of at least one photon in any auxiliary ) or by less than  photons due to losses, we discard the event.We note that it is possible to make the events that involve losses and the presence of photons in the auxiliary waveguides equivalent by truncating, or equivalently not connecting, the auxiliary waveguides at the output of every post-selected CZ gates.In this way, the post-selection at the output is simplified since no photons are coming from such waveguides by construction.We denote this procedure of interrupting or not connecting the auxiliary waveguides after any post-selected CZ gate as the truncation trick.
Once the path-encoded qubit structure is set, we can easily define how to initialize and measure the qubits.The initialization stage is straightforward, since we can set the initial state simply by injecting single-photon states in the relative waveguides.For example, if we want to start with the state −1 =0 |0⟩, we prepare the initial configuration with one photon is each waveguide   0 .The measurement stage is implemented by single-photon detectors and the correct events are given by the ones that satisfy the qubit structure.Thus, if we have  qubits, the events that must be considered are only those where each of the  photons is measured between every pair of waveguides (  0 ,   1 ) with the corresponding assignment given in Eq. ( 1).Concerning the manipulation stage, we exploit the tunability and versatility of MZI networks by embedding the path-encoded qubits gates in the Reck [8] and Clements [9] schemes.In particular, since our choice maps  qubits in 3 waveguides, we consider a MZI network with 3 modes to implement the desired operations on the qubits.

Single-qubit operators
This subsection describes single-qubit quantum gates in LOQC.To achieve this, we introduce the fundamental building blocks, needed to linearly manipulate photon states inside a PIC.
The first building block is the 50:50 beam splitter (BS) [22].This component has two inputs and two outputs and can be realized by utilizing two optical phenomena: evanescent wave or self-imaging.In the first case, we have directional couplers, while in the second case multimode-interferometer-based devices (MMIs).The action of BS is well described by its name: if light is injected in one of the two entries, the outputs' intensities are half of the initial one.BS can be characterized by an unbalanced condition between the two outputs and insertion loss, which is the amount of power that is lost in the photonic device.We can describe this situation as where the label "gen" stands for generic and  and  are the amplitudes of the two outputs and they are denoted as transmittance and reflectance.Unbalance means that || ≠ | | and insertion loss implies that modulo a global phase.The plus sign corresponds to the MMIs case, while the minus sign to the directional coupler case.It is interesting to note that the conditions to be balanced, lossless and unitary fixes all the relative phases of the device.
The second component is given by the phase shifter (PS) [22].This component is used to change the relative phase of different spatial degrees of freedom belonging to the same dual-rail qubit.When photons propagate in a waveguide for a distance , they accumulate an overall phase given by 2   eff /.The effective index  eff is a parameter that depends on all the characteristics of the waveguide: in particular if all the waveguides are identical, no relative phase can be induced.However, by changing external parameters like temperature, pressure, etc., we can locally vary the effective index.Therefore, if we have a couple of waveguides and one photon, PSs on each path introduce two different phases.This configuration involves two inputs and two outputs and it can be described by the following matrix where  = ( 1 ,  2 ).Note that after this operation, we can measure only the relative phase  1 −  2 , if we look just at one waveguides' pair.These two optical linear components constitute the building blocks to manipulate photon states through a MZI.As it is shown in Fig. 2, two BSs and two pairs of PSs constitute a MZI.Consequently, the unitary matrix for a MZI is where  = ( 1 ,  2 ) and  = ( 1 ,  2 ).Note that Eq. ( 8) has the same representation of Eq. ( 5), that describes a generic beam splitter.This means that the MZI is equivalent to a beam splitter with tunable parameters.
(, −/4) Moreover, Eq. ( 8) implies that we can execute single-qubit gates.We list some commonly used single-qubit gates in Table .1.Most of the quantum gates can be evaluated by the phases' configuration depicted in Fig. 2. The rotation around the -axis of the Bloch sphere   is achieved by setting ( 1 −  2 ,  1 −  2 ) = (,  − ).However, the other rotations   and   require an additional pair of PSs at the output of the MZI.In this way, we have an extended version of the MZI, whose matrix reads Through this addition,   and   can be achieved by the phases configurations ( 1 −  2 ,  1 −  2 ,  3 −  4 ): ( − , /2, /2) and ( − , 0, ), respectively.The previous matrix representation can be used following the recipe given in App.B. Therefore, to keep a compact notation, we create a vector with all the creation operators associated with the inputs and simply multiply such vector by the matrix that describes the desired device.In the case of a MZI, the transformation can be written as â † and this can be generalized to a generic  mode network by creating a vector containing all the creation operators.
The MZI structure can be easily embedded into the three-waveguide structure as illustrated in Fig. 1.The auxiliary waveguide is left alone and the waveguides corresponding to the computational basis are connected through the MZI.One can follow the procedure reported in App.B to find the matrix corresponding to the single-qubit manipulation implemented by a MZI for the three-waveguide structure.

Two-qubit operators
Among the various CZ implementations in LOQC, we embrace the post-selected method, implemented in previous studies [13,39,40].The main idea of the post-selected CZ consists of adding two auxiliary waveguides to the four waveguides belonging to the two dual-rail qubits.Then, the post-selected CZ gate is implemented by a layer of three beam splitters with 1/3 transmittance, which we denote as 1/3-BS.Additionally, the CNOT gate can be realized by inserting the 1/3-BS between two 50:50 BSs acting on the waveguides relative to the target qubit.50:50 BS performs the analogous role as the H gate by the equality of gate decomposition [41,42].Fig. 3 graphically reports the structure of the post-selected CNOT, composed of post-selected CZ and single-qubit gates with MZIs.Here, we detail the post-selected CZ and CNOT.
First of all, we represent two-qubit states | 0 ⟩ and | 1 ⟩ in the computational basis {|0⟩ , |1⟩} through the path-encoded correspondence given in Eq. ( 3).The basis states read as where the two pairs of waveguides associated with the qubits are ( 0 0 ,  0 1 ) and ( 1 0 ,  1 1 ).These two doublets are put between two auxiliary waveguides  0  ,  1  , as shown in the input and output of scheme 3(b).Note that this structure is not regular.
Then, we introduce the operators  1/3 and  ′ 1/3 that describe the 1/3-BSs present in the post-selected CZ.The values of s and s and the corresponding  1/3 and  ′ 1/3 reads as modulo a global phase.The state evolution associated with the post-selected CZ can be written as where the superscript "T" denotes the transpose and the bar is inserted as a reminder of the non-regularlylabeled structure of the gate.Note also that CZ ps is the inverse matrix of the block matrix composed by  1/3 and  ′ 1/3 , following the procedure explained around Eq. ( 10) and in App.B. The elements corresponding to the auxiliary waveguides in V 2 are prepared to have zero probability, since there is no photon in the two ancillary waveguides  0  ,  1  .Indeed, the generic initial state is where we follow the prescriptions given in Sec.2.1 and the probability of finding a photon in the auxiliary waveguides is zero.We assign the control to the first qubit and the target to the second one, called | 0 ⟩ and | 1 ⟩ in Fig. 3. Applying the linear transformation in Eq. ( 13), the state |Ψ⟩ in evolves to |Ψ⟩ out , which reads modulo global phase as where the dots contain all the terms that do not preserve the initial qubit structure.In particular, among these terms we find events with 1. one photon in  0  and one photon in the doublet  0 0 ,  0 1 or  1 0 ,  1 1 ,
The post-selection discards these events.In the presence of losses, we also discard events with one or no photon in the six waveguides set.Finally, we can rewrite the Eq. ( 16) using the assignment with computational basis, given Eq. ( 11): where we neglect the contributions that are non-preserving the qubit structure.
Apart from a global phase, the result shows the correct CZ operation on |Ψ⟩ in : there is a sign change when both qubits are in the state |1⟩.Once we have the CZ gate, the CNOT gate is simply achieved by performing the H gate on the target qubit before and after the CZ.The H gate is simply achieved by setting phase parameters denoted in Table 1 to a MZI under the 50:50 BS configuration.The CNOT gate is shown in Fig. 3 and its action can be described as where the transformation 1 ⊗ H represents the action of H gate on the second qubit.
If we denote by P the operator that projects on the qubit structure and equivalently eliminates the terms contained in the dots of Eq. ( 16), the success probability P succ of P|Ψ⟩ out is whose value is exactly the square of the coefficient in front of the part of |Ψ⟩ out that preserves the qubit structure.In the case of losses, this value decreases.
It is well known that this implementation of the CZ cannot be cascaded: this means that if this operation is applied twice to the same pair of qubits or to different pairs of qubits that share only one qubit, the correct result cannot be achieved by the post-selection procedure.As explained in Sec.2.1, the truncation trick makes the events with at least one photon in the auxiliary waveguides equivalent to the event where we lose at least one photon because of losses.This is achieved by truncating the auxiliary waveguides at the output of the post-selected CZ.The truncation trick can be described by the following non-unitary matrix for two path-encoded qubits Paux = 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 This form can be easily generalized to any number of qubits.The action of the previous matrix consists of dropping all the terms with at least one photon in the auxiliary waveguides by default.This operation does not include the post-selection procedure completely, since we still have the events with two photons in the pair of waveguides that corresponds to one of the two path-encoded qubits.These events can be distinguished by single-photon detectors, but they are detrimental when two post-selected CZ are cascaded on the same pair of qubits, even if we use the truncation trick.However, as shown in App.C, the truncation trick makes possible the correct operation of two post-selected CZ gates applied to two pairs of qubits that share only one qubit.We conclude this subsection by considering Fig. 4(a), where we report the Clements [9] and Reck [8] schemes.It is possible to note that the post-selected CZ can be embedded in five different ways in the Clements scheme and only one way in the Reck scheme.Indeed, the essential condition consists of a layer composed of three MZI.Therefore, a 6 × 6 universal scheme can be set to execute the QC universal set of gates for two path-encoded qubits.

Issues in large-scale photonic QC
The post-selected CZ gate, shown in Fig. 3(b), has the limitation that does not satisfy scalability, since it involves a non-regularly-labeled structure.Indeed, its structure is composed of the two pairs of waveguides ( 0 0 ,  0 1 ) and ( 1 0 ,  1 1 ) corresponding to the two qubits | 0 ⟩ and | 1 ⟩, that are located between the auxiliary waveguides ( 0  ,  1  ).The waveguides' assignment is not regular and it only permits an operation between nearest-neighbor qubits.This hinders the flexibility of two-qubit operations.For instance, if we want to sequentially apply CNOT gates on the pairs of qubits ( | 0 ⟩, | 1 ⟩ ), ( | 1 ⟩, | 2 ⟩ ), the current scheme cannot be applied due to the lack of correspondence between the qubit structure, i.e the path assignment does not match among different sequential post-selected CZ gates.Therefore, the irregular configuration of waveguides in the post-selected CZ prevents satisfying the scalability property in MZI networks.
Large-scale QC requires quantum operations between non-adjacent qubits.Suppose that we would operate two-qubit gates on three qubits, | 0 ⟩, | 1 ⟩, and | 2 ⟩, where ( | 0 ⟩, | 1 ⟩ ) and ( | 1 ⟩, | 2 ⟩ ) are adjacent.In this situation, we need to exchange the location of | 0 ⟩ or | 2 ⟩ with | 1 ⟩ to connect | 0 ⟩ and | 2 ⟩.The SWAP gate performs this operation and it can be realized by three successive CNOT gates on the same pair of qubits.However, the CZ implementation, discussed in Sec.2.3, does not allow to cascade more CZ gates on two qubits, even if we use the truncation trick.In integrated photonics, the swapping of spatial degrees of freedom is typically done by waveguide crossings [43].This optical component achieves the same operation that a MZI performs in the cross configuration, but in a passive way and with a more compact footprint.SWAP between qubits or waveguides given by the cross configuration, or equivalently Pauli- gate, is achieved without setting any relative phases in the MZI unit (see Table .1).This means that also MZIs do not need external power to work in the cross configuration.Even though, in a real MZI, spurious phases, coming from imperfections, must be compensated and external power to set the correct configuration is needed, the advantage of using MZI networks to execute the swapping of path degrees of freedom comes from their reconfigurability.
In the following section, we present the regularly-labeled structure and the optical swap gate to solve the previously reported scalability issues.

Method for scalability
In a photonic network consisting of MZIs, we describe two criteria to improve the scalability of LOQC: on the implementation level and on the quantum gate level.We demonstrate the post-selected CZ gate on a regularly-labeled structure with one ancillary waveguide and one dual-rail as data qubit, as shown in Fig. 1.We refer to recent work on bulk optics [44] to introduce an optical SWAP gate, which maps the regular structure to the standard structure needed to execute the post-selected CZ gate.

Regular labelling
Maintaining a regularly-labeled structure for the path-encoded qubits is a requirement to compute massive quantum algorithms.The regularly-labeled universal scheme of a MZI network is depicted in Fig. 4(b).The labeling sequentially allocates one ancillary waveguide and a pair of waveguides for path-encoded computational state |0⟩, |1⟩ so that ( 0  ,  0 0 ,  0 1 ) corresponds to qubit | 0 ⟩, ( 1  ,  1 1 ,  1 1 ) to | 1 ⟩ and so on.Thus, as described in Sec.2.1, every path-encoded qubit is composed of one photon and three waveguides.Once the qubits are initialized, there are two universal schemes of reconfigurable MZI networks that perform quantum operations: the Reck and Clements schemes.Fig. 4(a) reports their 6 × 6 configuration.
Quantum gates in a regularly-labeled structure are equally implemented by MZIs.Single-qubit gates can be trivially achieved through a MZI and their action is described by Eq. ( 8).This operation connects two waveguides represented in the computational basis |0⟩, |1⟩ of a given qubit and leaves untouched the ancillary waveguides.Two-qubit gates, like the post-selected CZ, operate with a non-regular structure, where ancillary waveguides are located on both sides of the two pairs of path-encoded qubit waveguides.Thus, we have to adapt the post-selected CZ to the chosen regular structure.In the next subsection, we henceforth present an optical SWAP gate that changes the pathways of photons to make compatible the use of post-selected CZ and the regularly-labeled structure.

Optical SWAP by Pauli-𝑋 gate
The SWAP operation for a dual-rail qubit is achieved by utilizing a MZI with phases that correspond to a Pauli- matrix.Given the generic initial quantum state |Ψ⟩ in , shown in Eq. ( 2), we apply the Pauli- gate â † 1 operation which switches the order between one ancilla waveguide   and the pair of waveguides ( 0 ,  1 ).The latter operation is needed to achieve a post-selected CZ gate with a regularly-labeled structure.
and we obtain the output state We can see that the probability amplitudes of the states are swapped, as depicted in Fig. 5(a).,  0 1 ) and ( 1 0 ,  1 1 ) and, only in this case, we do not consider the auxiliary waveguides.The transformation given by such a MZI network operates as where and X (,−1)

𝑚
represents the single MZI Pauli- action on the k-th and (k+1)-th waveguides embedded in the  ×  network.In App.B, embedding a 2 × 2 MZI in a generic  ×  structure is presented in more detail.Given the initial state as in Eq. ( 15), the output state reads Fig. 6.Qubit SWAP operation SWAP  2 in a regularly-labeled structure.This gate exchanges the positions of the ancillary waveguides, i.e.  0  ↔  1  , and the waveguides of the first and second qubits, i.e. ( 0 0 ,  0 1 ) ↔ ( 1 0 ,  1 1 ).The state | ⟩ is used to denote the state corresponding to one photon in the auxiliary waveguide, and it is outside the set of states that defines the qubit structures.The MZIs represented by light grey boxes are set in the identity configuration, while the others with darker grey and the letter "X" in the Pauli- setting.
In other words, the operation swaps the two qubits with respect to the computational basis.We can note that the transformation is completed only by three layers of MZIs.
Finally, Fig. 5(c) shows the optical SWAP on one photonic qubit composed of the ancillary waveguide and the two waveguides ( 0 ,  1 ).This process shifts the position of the ancilla waveguide and the quantum states' paths such that where This operation is required to implement the post-selected CZ in a regularly-labeled structure as we derive in the next subsection.

Qubit SWAP by optical SWAP gate
In this subsection, we perform not only the optical SWAP to switch the location of waveguides, but also a general quantum SWAP operation, which extends this concept.Two SWAP operations are described in Fig. 6 and 7, the former can be embedded in 6 × 6 Clements scheme with regularly-labeled waveguides and the latter can be embedded in both of 6 × 6 Clements and Reck schemes.
The Pauli- network shown in Fig. 6 acts as ( 0 0 ,  0 1 ) ↔ ( 1 0 ,  1 1 ), in a regularly-labeled structure.In particular, we report the embedding of this SWAP gate (a) in 6 × 6 Clements scheme and (b) in 6 × 6 Reck scheme.The state | ⟩ denotes the state corresponding to one photon in the auxiliary waveguide, and it is outside the states that define the qubit structures.The MZIs represented by light grey boxes are set in the identity configuration, while the others with darker grey and the letter "X" in the Pauli- setting.where Given the generic initial state of two qubits as in Eq. ( 15), the action of this transformation consists of the SWAP between qubits in a regularly-labeled structure.However, its action is more general than the one reported in Eq. (23)(24) and, since the MZI network shown in Fig. 6 performs also the swapping between the auxiliary waveguides, or equivalently ( 0  ↔  1  ).The network of Fig. 6 is implemented by setting 13 MZIs in the Pauli- configuration and 2 MZIs as the Identity in the 6 × 6 Clements scheme.This network cannot be embedded in the 6 × 6 Reck scheme, since two layers with 3 MZIs are required.
It is important to note that the swapping of auxiliary waveguides is not needed, because the qubit structure selects the events with no photons in the auxiliary waveguides.Indeed, post-selection implies that when a photon remains in any auxiliary waveguide after a two-qubit gate, we do not count the corresponding event on the detectors.Therefore, we can optimize the resources as in the Pauli- network shown in Fig. 7, whose action can be written as where 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 , In this way, the action of this transformation involves the SWAP between qubits in a regularlylabeled structure without affecting the auxiliary waveguides.This network is composed of 10 MZIs in the Pauli- configuration and 5 as the Identity gate and it can be embedded in both the 6 × 6 Clements and Reck schemes as shown in Fig. 7(a) and (b).

Two-qubit gate in regularly-labeled waveguides
In this subsection, we derive the regularly-labeled post-selected CZ by restoring the labeling of waveguides using the optical SWAP proposed in the previous subsection.Firstly, we consider the initial state of two qubits given in Eq. ( 15), and we apply the optical SWAP to the target qubit.The state evolves through the transformation given in Eq. (26) as The previous transformation maps the regularly-labeled pathway of photons into the positions required by the post-selected CZ.Then, we act with the CZ, as it is explained in Sec.2.3, and lastly we again apply the optical SWAP symmetrically.The final state reads This result is exactly the one reported in Eqs. ( 16) and (17).This gate can be realized only in the 6 × 6 Reck scheme as it is shown in Fig. 8(a).However, we can shrink the full depth of post-selected CZ.To do this, we note that the bottom  † 1/3 of the post-selected CZ is located between two Pauli- MZI.Thus, we can do the three operations simultaneously by introducing the new rotation operator  regularly-labeled CZ gate as depicted in Fig. 8(b).The operator can be derived by multiplying Pauli- on each side of  1/3 and it is achieved by setting and  1 −  2 = 0.This new gate replaces three MZIs, since no quantum gate is applied between CZ and optical SWAP.
Finally, we consider the generic state given in Eq. ( 26) and the action of the regularly-labeled CZ, which reads where It is straightforward to check that the transformation gives the same result of Eqs. ( 16), (17) and also (33).From Fig. 8(b), we can observe that the structure of the new post-selected CZ, also called regularly-labeled post-selected CZ, can be easily embedded in the 6 × 6 universal schemes.In particular, there is one way of embedding it in the Reck scheme and two ways in the Clements one.We conclude this section by showing that a regularly-labeled CNOT can be realized as where the transformation 1 ⊗ H represents the action of H gate on the target qubit.

Bell state and GHZ state
This section shows examples of quantum circuits based on our proposed regularly-labeled structure.We present the circuits to generate the Bell and the GHZ states.In both examples, all the qubits are initially prepared in the |0⟩ state.The Bell state generation is described in Fig. 9(a): the circuit is composed of one H gate that is applied to the first qubit | 0 ⟩ and a CNOT gate bonding the pair (| 0 ⟩, | 1 ⟩), where the first qubit acts as the control and the second as the target.We propose to implement this circuit by utilizing the path-encoded qubits made of bundles of three waveguides and a 6 × 6 regularly-labeled MZI network.Thus, we assign the qubits | 0 ⟩ and | 1 ⟩ to the triplets of waveguides ( 0  ,  0 0 ,  0 1 ) and ( 1   ,  1 0 ,   by using the notion of Sec.2.2 for the single-qubit gates and the regularly-labeled compressed post-selected CNOT, discussed in Sec.3.2.2 and illustrated in Fig. 8. Fig. 9(b-c) shows the embedding of the Bell state generation circuit in 6 × 6 universal MZI networks.More explicitly, given the initial state |00⟩, the scheme is described by the following transformation: where we use the regularly-labeled compressed post-selected CNOT given in Eq. (38).We point out that the post-selection is required and the success probability of this Bell state generation circuit is 1/9.Next, GHZ state generation circuits, whose gate-based circuit is shown in Fig. 10(a), are shown as an example of computational scalability in photonic integrated circuits.We use the same strategy as in the previous example, so we map the qubits | 0 ⟩, | 1 ⟩ and | 2 ⟩ to the three bundles of waveguides, ( 0  ,  0 0 ,  0 1 ), ( 1  ,  1 0 ,  1 1 ), ( 2  ,  2 0 ,  2 1 ), respectively.Then, we consider 9 × 9 universal MZI networks.The circuit involves an additional CNOT gate to the pairs (| 1 ⟩, | 2 ⟩) or (| 0 ⟩, | 2 ⟩) compared to the previous case, as depicted in Fig. 10.The first case is shown in Fig. 10(b-c): we can note that it is possible to embed such GHZ state generation circuit in 9 × 9 universal MZI networks.The second case is illustrated in Fig. 11 and it shows an example of SWAP operation between qubits, described in Eq. (31) and represented in Fig. 7.In this case, applying the SWAP operation is needed because the physical implementation of CNOT does not allow for operations between non-nearest-neighbor path-encoded qubits.In both cases, the truncation trick is required since it allows to cascade the post-selected CZ in the utilized configurations.Again, given the initial state |000⟩, the schemes in Fig. 10 where Paux represents the action of the truncation trick and the upper indexes in parenthesis denote the qubits involved in the operation.We utilize the regularly-labeled compressed post-selected CNOT given in Eq. ( 38) and the optical SWAP given Eq.(31).We point out that the post-selection together with the truncation trick is required and the success probability of this circuit is 1/81.Moreover, in the circuit reported in Fig. 10(b-c)-11(b) we note that the truncation is necessary only on the waveguide  1  between the two CNOT gates.We insert all the truncation after any two-qubit gate, since we follow the prescription of the truncation trick and we allow the possibility of different compositions of CNOT gates between the three qubits.
A generic -dimensional GHZ state, can be obtained by iterating the previous circuits.Its success probability would be 9 1− , for  bigger than 2. We conclude this section by emphasizing that the truncation trick, also shown in Fig. 10, is compulsory in order to cascade the post-selected CZ between different pairs of qubits that share only one qubit.Indeed, without this procedure we do not achieve the correct result for the GHZ state generation circuit, as shown in App. C. The truncation trick makes possible the cascading of the post-selected CZ on the pairs of qubits that share only one qubit, but we cannot cascade it on the same pair of qubits twice.

Conclusion
Our work presents a scalable possibility of integrated photonic circuits for LOQC.Regularlylabeled structure for path-encoded qubits and optical SWAP operations are needed.Based on these primitives, we demonstrate qubit SWAP gates to enable universal programming and post-selected CZ gates.The compressed version of regularly-labeled post-selected CZ is also presented to decrease the depth of the MZI network and to minimize quantum resource consumption.Finally, we propose a new way of using the post-selected CZ: indeed, through the truncation trick this gate can be sequentially applied on two pairs of qubits that share only one qubit.Formally, we present two exemplary quantum circuits: the Bell and the GHZ state generation circuits.
Our approach is still characterized by some problems that must be mitigated in order to reach large-scale computation.First of all, the success probability scales with multiples of 1/9 every time a post-selected CZ is used.Moreover, such a gate cannot be cascaded twice to the same pair of qubits, even if we apply the truncation trick.This implies the impossibility of generating the most general multipartite entangled state.From this perspective, the measurement-based approach [32,45,46] through fusion gates has better performances on the integrated photonic platform.

Fig. 1 .
Fig.1.Graphical representation of three waveguides that define the chosen photonic path-encoded qubit.The upper waveguide   is the auxiliary waveguide needed for CZ gates, and the doublet ( 0 ,  1 ) composes the computational basis states of the path-encoded photonic qubit.We also report a box that connects the waveguides ( 0 ,  1 ) and represents a generic single-qubit gate implemented by a MZI.

Fig. 2 .
Fig.2.One Mach-Zehnder interferometer unit.This building block is composed of two beam splitters (white square boxes labeled with BS) and four phase shifters (yellow square boxes labeled with s and s), located at the inputs and in the internal arms.In all the following images, we represent the MZI photonic unit with the light grey box.

Fig. 3 .
Fig. 3. CNOT implementation through MZI units for path-encoded photonic qubits.(a) Gate decomposition of CNOT with the combination of H and CZ.(b) CNOT implementation with MZIs.( 0  ,  1  ) are the ancillary waveguides, ( 0 0 ,  0 1 ) and ( 1 0 ,  1 1 ) indicate the waveguides of the control and target qubits, respectively.Postselected CZ is located in the center of the MZI network, and Hadamard gates needed for CNOT are positioned on the left and right of the post-selected CZ.The MZIs are set in such a way to have the transformation H,  1/3 and  ′ 1/3 : the values for the phases can be found in Table. 1, and in Eqs.(12).The MZIs represented with light grey boxes are set in the identity configuration.

Fig. 4 .
Fig. 4. (a) 6 × 6 Clements scheme, upper part, and Reck scheme, lower part, where we embed the regularly-labeled structure of two path-encoded qubits.(b) A 3 × 3 scheme together with the regular labeling of  path-encoded qubits.

Fig. 5 .
Fig. 5. (a) Basic optical SWAP operation on a pair of waveguides.(b) SWAP ′ 2 operation which changes the position between two pairs of waveguides.(c) SWAP 1 operation which switches the order between one ancilla waveguide   and the pair of waveguides ( 0 ,  1 ).The latter operation is needed to achieve a post-selected CZ gate with a regularly-labeled structure.

Fig. 5 (
b) shows a two-qubit SWAP gate realized with 4 MZIs, that are configured as Pauli- gates.The path-encoded qubits | 0 ⟩ and | 1 ⟩ are defined by the position of one photon in each pair of waveguides ( 0

Fig. 7 .
Fig. 7. Qubit SWAP operation SWAP 2 that leaves untouched the ancillary waveguides and exchanges the positions of the waveguides of the first and second qubits, i.e.( 0 0 ,  0 1 ) ↔ ( 1 0 ,  1 1 ), in a regularly-labeled structure.In particular, we report the embedding of this SWAP gate (a) in 6 × 6 Clements scheme and (b) in 6 × 6 Reck scheme.The state | ⟩ denotes the state corresponding to one photon in the auxiliary waveguide, and it is outside the states that define the qubit structures.The MZIs represented by light grey boxes are set in the identity configuration, while the others with darker grey and the letter "X" in the Pauli- setting.

Fig. 8 .
Fig. 8. CZ gate implementation in a regularly-labeled structure.(a) Post-selected CZ operation together with optical SWAP that changes the positions of waveguides to map the regular structure to the structure needed for the standard post-selected CZ. Green contours show the 6 × 6 Clements scheme and orange contours the 6 × 6 Reck scheme.(b) Compressed CZ implementation in the regularly-labeled structure.The MZIs represented with light grey boxes are set in the identity configuration, while the colored ones are set in the configurations X,  1/3 ,  ′ 1/3 and  † 1/3 , marked with the corresponding label.

HFig. 9 .
Fig. 9. Bell state generation in both quantum circuit representation and MZI network.(a) Gate-based Bell state generation circuit.The corresponding embedding of Bell state generation circuit (b) in the 6 × 6 Clements scheme and (c) in the 6 × 6 Reck scheme.The MZIs represented with light grey boxes are set in the identity configuration, while the colored ones are set in the configurations X, H and the different 1/3-BSs.The yellow contour enclosing the MZI, which is set in the H configuration, corresponds to the H gate of the gate-based Bell state generation circuit.Analogously, the green contour enclosing the MZI network corresponds to the CNOT gate of the gate-based Bell state generation circuit.

Fig. 10 .
Fig. 10.GHZ state generation in a first example of quantum circuit representation and corresponding MZI networks.(a) A first example of gate-based GHZ state generation circuit.The corresponding GHZ state generation circuit embedded in universal 9 × 9 (b) Clements and (c) Reck MZI networks.The MZIs represented with light grey boxes are set in the identity configuration, while the colored ones are set in the configurations X, H and the different 1/3-BSs.The red diagonal lines on auxiliary waveguides represent the truncation trick: in such positions the waveguides are not connected.The yellow contour enclosing the MZI, which is set in the H configuration, corresponds to the H gate of the gate-based GHZ state generation circuit.Analogously, the green and blue contours enclosing the MZI networks correspond to the first and second CNOT gates of the gate-based GHZ state generation circuit.

Fig. 11 .
Fig. 11.GHZ state generation in a second example of quantum circuit representation and corresponding MZI networks.(a) A second example of gate-based GHZ state generation circuit, that involves the use of the SWAP gate.(b) The corresponding GHZ state generation circuit, embedded in a MZI network.The MZIs represented with light grey boxes are set in the identity configuration, while the colored ones are set in the configurations X, H and the different 1/3-BSs.The red diagonal lines on auxiliary waveguides represent the truncation trick: in such positions the waveguides are not connected.The yellow contour enclosing the MZI, which is set in the H configuration, corresponds to the H gate of the gate-based GHZ state generation circuit.Analogously, the green and blue contours enclosing the MZI networks correspond to the first and second CNOT gates of the gate-based GHZ state generation circuit.Finally, the grey contour stands for the SWAP gate implemented by 6 × 6 Clements scheme to connect non-nearest neighbour path-encoded qubits.

Table 1 .
Collection of commonly used single qubit gates evaluated by specific phase values.Through changing two parameters  and  in Eq. (8), quantum gates are determined, modulo a global phase.Quantum gates Matrix form MZI phases ( 1 −  2 ,  1 −  2 )