Introduction

Quantum walks (QWs) are unitary processes describing the propagation of quantum particles on lattice potentials.1,2,3 Originally described as a quantum-mechanical analog of the classical random walk, QWs were found to exhibit faster propagation and enhanced sensitivity to lattice parameters due to their coherent nature.3 These properties generated broad interest in applying QWs to quantum information processing tasks.4

Experimentally, QWs have been implemented using a wide array of platforms, including photonics,5,6,7,8,9,10,11,12 trapped ions,13,14 and ultra-cold atoms.15,16,17 The current degree of experimental control of these systems is remarkable: it is possible to prepare an initial state with single-site and single-particle resolution, to control almost every aspect of the lattice potential, and to directly monitor the evolving wave function. Early experiments demonstrated the behavior of single-particle QWs; however, these dynamics can be desribed by classical wave equations (indeed, some of these experiments were performed with coherent light)5,6,7,9), and thus cannot display non-classical features. Non-classical behavior can be observed when several indistinguishable particles participate in the QW simultaneously, as was shown both theoretically7,12,18,19,20 and experimentally.8,21 Here, non-classical spatial correlations—i.e., non-trivial dependencies between the positions of different walkers—emerge due to quantum (bosonic or fermionic) statistics.7,19,22 Recent work has investigated the role of interactions in the two-particle quantum walk, finding that they give rise to even more complex correlated dynamics.23,24 These ‘strongly correlated’ QWs were recently observed experimentally in a system of ultra-cold atoms.17

Can the spatial correlations that emerge between several quantum co-walkers be useful for quantum information processing? Recent theoretical work by Childs et. al. demonstrated that, in principle, multi-particle QWs could be used to implement universal quantum computation.25 However, the geometry and complexity of the required lattice potential in the proposed scheme are far beyond current experimental capabilities.

In this work, we show how controlling the lattice potential of a QW can impose certain spatial correlations between walkers. Using this approach, we design quantum logic gates on a simple one-dimensional array of potential wells using minimal resources: one quantum walker and a small number of lattice sites per qubit. For non-interacting bosons (such as photons in waveguide lattices) we find that this approach yields high-fidelity probabilistic logic gates with a similar success rate to those found previously—but with a much simpler physical design. For interacting bosonic quantum walkers (e.g., ultra-cold atoms in optical potentials or photons in non-linear devices) we find that a complete set of high-fidelity quantum logic gates can be realized using a linear array of potential wells with nearest-neighbor coupling and only two sites per qubit, demonstrating the universality of this architecture for quantum computation.

While our analysis is general to any system that can support quantum walk dynamics, here we focus on two physical systems in which our results can be implemented using existing experimental capabilities: non-interacting, indistinguishable photons in waveguide lattices and interacting ultra-cold bosonic atoms trapped in an optical lattice. In the tight-binding limit, both systems can be described by the same time-independent Bose-Hubbard equation:7,23

$$H = \mathop {\sum}\limits_m E_ma_m^\dagger a_m + \mathop {\sum}\limits_{\left\langle {l,m} \right\rangle } J_{l,m}a_l^\dagger a_m + \frac{{\Gamma }}{2}\mathop {\sum}\limits_m \hat n_m(\hat n_m - 1),$$
(1)

where in the atomic (photonic) case, Em is the on-site energy (index of refraction) of site m, \(a_m^\dagger {\mathrm{\backslash }}a_m\) is the creation/annihilation operator for an atom (photon) at site m, \(\hat n_m = a_m^\dagger a_m\) is the number operator, and Jl,m ≤ 0 is the tunneling rate between nearest sites. Finally, Γ is the on-site interaction energy, i.e., an energy cost for the occupancy of two or more bosons on the same site; in the linear photonic case discussed below, Γ = 0, while in the atomic case this value is usually nonzero and can be adjusted experimentally. While the atomic system evolves in time according to the unitary operator U(atomic) = eiHt, the photons also evolve in space along the z direction U(photonic) = eiHz (see Fig. 1d).

Fig. 1
figure 1

Quantum-walk-based quantum logic gates for cold atoms and for photons. a A qubit in the state \(\left| 0 \right\rangle\). b Implementation of a single-qubit gate. c Schematic of a two-qubit system on a lattice. d Schematic of the implementation of a quantum-walk-based photonic CNOT gate in waveguide lattices

Results

Defining qubits on a lattice

The continuous-time QW is described by the unitary evolution under the Hamiltonian described in Eq. (1).2,6,7,23 However, the basic element of interest for quantum gates of the type discussed here is the quantum bit or qubit. To define our qubits on the lattice, we use a so-called dual-rail encoding where a qubit is physically implemented by a single boson in a pair of neighboring potential wells (see Fig. 1), with the states \(\left| 0 \right\rangle\) and \(\left| 1 \right\rangle\) of the qubit defined by the particle being in the left or right well. A single quantum particle can occupy the two sites in a superposition, encoding a qubit without the need for additional degrees of freedom. In this way, a system of n qubits can be realized in one dimension using n bosons and N = 2n lattice sites, with one boson in the first two sites (representing the first qubit), one boson in the next two sites (representing the second qubit), and so forth. As we discuss below, in some cases the implementation requires additional auxiliary sites (typically one per qubit). Note that in this geometry, many physically permitted lattice states (e.g., those with more than one particle on the same site) are not members of the logic space (i.e., the multi-qubit tensor-product space). Nevertheless, we show that it is possible to engineer the lattice parameters such that, at time t = t final  = 1, the transformation U = eiH maps logic states to other logic states with high fidelity.

Implementing quantum gates

Having defined our qubits, we turn to the task of designing a universal set of quantum gates, i.e., finding lattice parameters that yield desired unitary transformations on the logical space. Designing and building quantum logic gates remains one of the most difficult aspects of quantum computing, and our case is no exception. The reason for this difficulty is simple: from the physical description of a given device—in our case, the lattice parameters—it is straightforward to write down the many-particle Hamiltonian H and from it to calculate the unitary evolution operator U = eiH that fully describes the operation of the device. The inverse problem, however, is hard: given a desired multi-particle unitary U, it is difficult to find a corresponding Hamiltonian that meets the physical and geometrical constraints of the device, e.g., the one-dimensionality of the lattice. Beyond these restrictions, the primary difficulty from a theoretical perspective is the lack of an analytic inverse to the matrix exponential or to the transformation function from single-particle behavior to multi-particle behavior. Even for a given unitary U there are an infinite number of Hermitian matrices H satisfying eiH = U; it is unclear how to determine constructively which of these satisfies the other system constraints. Furthermore, if the logical quantum states are only a subset of the full Hilbert space, then the quantum gate operation is only a sub-matrix of the overall evolution operator U. In this case, U is not even uniquely defined by the desired gate operation. As described below, we tackle these difficulties using a combined analytical and computational approach that finds appropriate lattice parameters to achieve a given ideal gate operation with high fidelity.

There are many options for the choice of a universal set of gates. One useful choice is the gate set of the controlled-NOT (CNOT) operation, along with either all single-qubit rotations (exactly universal) or the Hadamard and phase-shift single-qubit gates (approximately universal).26 We first discuss the single-qubit gates, which are straightforward to calculate analytically. These gates are applicable to both interacting and non-interacting systems. We then elaborate on the construction of the CNOT gate.

Single-qubit gates

We present the exact construction for a set of single-qubit gates. Since these are one-qubit operations, they are implemented using a single particle in two lattice sites. As such, the interaction (Γ) is irrelevant and the matrix of lattice parameters

$$G = \left( {\begin{array}{*{20}{c}} {E_1} & {J_{12}} \\ {J_{12}} & {E_2} \end{array}} \right)$$

(with J12 ≤ 0) can be directly interpreted as the single-particle Hamiltonian. The unitary gate, obtained by evolving with G for a time t final  = 1, is then U = eiG.

One simple universal quantum gate set includes the Hadamard gate, the phase-shift gate, and the CNOT gate.26 The phase-shift gate is the simplest to implement. It is composed of two decoupled lattice sites in which the on-site energy between the sites is detuned. Specifically, to implement the single-qubit phase-shift operator \(R_\theta = \left( {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & {e^{i\theta }} \end{array}} \right).\), one may apply the single-qubit Hamiltonian

$$G_{R_\theta } = \left( {\begin{array}{*{20}{c}} 0 & 0 \\ 0 & { - \theta } \end{array}} \right){\kern 1pt} .$$
(2)

Next in complexity is the single-qubit Hadamard gate \(H = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1 & 1 \\ 1 & { - 1} \end{array}} \right)\). The Hamiltonian and propagation time that generates the Hadamard transformation can be solved analytically, and is given by

$$G_H = \frac{\pi }{{2\sqrt 2 }}\left( {\begin{array}{*{20}{c}} {\sqrt 2 - 1} & { - 1} \\ { - 1} & {\sqrt 2 + 1} \end{array}} \right).$$
(3)

Note that a simple tunneling between two identical wells for half the tunneling time is not exactly analogous to the operation of a beam-splitter in linear optics, as it does not reproduce the Hadamard gate. Under our Hamiltonian dynamics the splitting is symmetric in phase and therefore modified tunneling rates and additional diagonal terms are required to adjust the output phases. As a result, the operation of the CNOT gate constructed using integrated waveguide beam-splitters27 is not identical to previous implementations that used the same design in bulk optics.28 The difference between these implementations becomes apparent when comparing the complex values of the unitary operations rater then the transition probabilities.

An alternative (exactly) universal gate set includes the CNOT together with all single-qubit unitaries. Any single-qubit unitary, U, can be implemented by first decomposing it in the form26

$$U = e^{i\alpha }R_z(\beta )R_x(\gamma )R_z(\delta ) = e^{i\alpha }R_z(\beta )HR_z(\gamma )HR_z(\delta )$$

where the z-rotation \(R_z(\theta ) = \left( {\begin{array}{*{20}{c}} {e^{ - i\theta /2}} & 0 \\ 0 & {e^{i\theta /2}} \end{array}} \right)\) can be implemented with the Hamiltonian

$$G_{R_z(\theta )} = \frac{\theta }{2}\left( {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & { - 1} \end{array}} \right){\kern 1pt} ,$$

and the x-rotation \(R_x(\theta ) = {\mathrm{exp}}\left( {\begin{array}{*{20}{c}} 0 & { - i\theta {\mathrm{/}}2} \\ { - i\theta {\mathrm{/}}2} & 0 \end{array}} \right)\) can be implemented either with the Hamiltonian

$$G_{R_x(\theta )} = \frac{{4\pi - \theta }}{2}\left( {\begin{array}{*{20}{c}} 0 & { - 1} \\ { - 1} & 0 \end{array}} \right)$$
(4)

or by conjugating R z (θ) by the Hadamard operation H described earlier. The phase e can be implemented with \(G_\alpha = - \alpha \left( {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & 1 \end{array}} \right)\).

CNOT gate using interacting QWs

We first consider the case in which the quantum-walking particles interact when occupying the same lattice site, i.e., Γ ≠ 0. To design the two-qubit CNOT gate using the dual-rail encoding, we consider a lattice with four sites and two bosons. This problem then is defined by eight lattice parameters: four on-site potential terms (E m in Eq. (1)), three tunneling terms (Jl,m), and the interaction parameter (Γ). The complete two-body Hamiltonian H is described by a 10 × 10 matrix (the size of the Hilbert space for two bosons in four modes). To perform the logical gate operation, the system evolves according to U = eiH. The CNOT gate operation is then given by a 4 × 4 sub-matrix of U over the logical states \(\left| {1010} \right\rangle\), \(\left| {1001} \right\rangle\), \(\left| {0110} \right\rangle\), \(\left| {0101} \right\rangle\) (presented here in the photon occupation-number basis); the other six basis states, while physically allowed, are not members of the logical basis.

As mentioned above, finding the physical lattice parameters from the desired gate is a non-trivial inverse problem. Using non-linear optimization techniques29,30,31,32 (detailed in the methods section), we optimized the eight parameters of the system to maximize the fidelity of the gate when acting on the logical input states under the constraints that the parameters represent a physical one-dimensional lattice, meaning that the on-site parameters are real, that the tunneling parameters are real, non-positive, and connect only nearest-neighboring sites, and that the values of the on-site, tunneling, and interaction terms are within experimentally relevant bounds. Specifically, we demand that 0 ≥ Jl,m ≥ −Jmax, −Jmax ≥ E m  ≥ Jmax, and Γ ≤ Γmax, where Jmax and Γmax are the largest allowed tunneling rate and interaction level in the optimization protocol. In our optimization we set Jmax = 4π, limiting the maximal number of tunneling events (or Rabi-oscillations) to 4. In practice, this experimental bound is dictated by the loss and decoherence rate of the system, determining the maximal relevant propagation time. We also set Γmax = 10Jmax.

An example of a resulting lattice that yields the two-qubit CNOT gate is given (to two decimal places) by

$$G_{CNOT} = \pi \left( {\begin{array}{*{20}{c}} {0.40} & 0 & 0 & 0 \\ 0 & {1.82} & { - 1.03} & 0 \\ 0 & { - 1.03} & { - 0.37} & { - 3.80} \\ 0 & 0 & { - 3.80} & { - 0.66} \end{array}} \right)$$
(5)

with interaction strength Γ = 21.68π. Here, the diagonal and off-diagonal entries of GCNOT represent the parameters E m and Jl,m, respectively, of the Hamiltonian H. Eq. (5) represents a recipe for a four-site lattice that yields a CNOT gate with fidelity (as defined in the methods section) of 99.6%. This gate’s operation is summarized in Fig. 2.

Fig. 2
figure 2

An implementation of the controlled-NOT (CNOT) gate according to the recipe in Eq. (5). a The real part and b the imaginary part of the two-particle unitary transform, U. The CNOT gate operation corresponds to the sub-matrix of the logic states, shown in solid-color bars and marked with red axis labels. Plots cf show the position (in terms of the lattice sites, 1–4) of the two-boson particle density as a function of time, t, revealing the operation principle of the gate on each logical state (\(\left| {00} \right\rangle\), \(\left| {10} \right\rangle\), \(\left| {01} \right\rangle\), and \(\left| {11} \right\rangle\) respectively). One observes that the target qubit (in sites 3–4) performs Rabi-oscillations that are perturbed by the state of the control qubit (in sites 1–2): the target qubit performs one fewer Rabi-flip if the control qubit is in the \(\left| 1 \right\rangle\) state

If the bounds on the parameters are relaxed, the fidelity moves even closer to 100%. Figure 3 summarizes the optimization results. Figure 3a shows the convergence of independent runs with random starting points to the same final result. Figure 3b presents the expected gate fidelity vs. the maximally allowed values of the interaction Γmax. For a fixed maximal tunneling of Jmax = 4π, the fidelity achieves a value close to 0.95 at Γmax/Jmax = 0.5 and then slowly approaches unity as this value is further increased. In a system with a given Γmax, it is still possible to improve the fidelity further by increasing the rate of the coupling between sites, i.e., increasing Jmax; see Fig. 3c.

Fig. 3
figure 3

Optimization of the CNOT gate fidelity. a Convergence of different optimization runs to the optimal gate fidelity. The solid black line and the shaded area represents the average and the standard deviation values over 512 runs. Seven example runs are shown in the background (dotted lines). b Gate fidelity versus the maximum allowed interaction level Γmax, at a constant Jmax = 4π. c Gate fidelity for different maximal tunneling rates Jmax at a constant maximal interaction level of Γmax = 20π

Based on a basic analysis of the effect of imperfections and noise, we found that within the experimental parameters, these are expected to have a negligible effect on the fidelity of the CNOT gate. These results are presented in the Supplementary Information. We therefore expect the main reduction in fidelity to occur between the application of sequential gates, when the parameters of the system are modified—encouragingly, an experimental demonstration of high-fidelity switching between potentials was reported recently.33

CNOT gate for non-interacting QW

A related procedure can be derived to generate a new type of QW-based photonic logic gates. The use of single photons in linear-optical setups for implementing quantum gates is a fast-developing branch of quantum information science.28,34 As photons do not easily interact, the devices are usually linear, and as a result can perform quantum operations only probabilistically, i.e., with a non-zero probability of having an output that does not correspond to a valid logical state. However, as shown by Knill et al.,35 by combining these probabilistic gates with effective non-linearities induced by measurement, it is in principle possible to build a quantum computation device that scales efficiently.

In linear optics, the entries of the multi-particle unitary can be calculated as functions of the single-particle unitary that describes the evolution of one particle in the device.20 Given this single-particle unitary, Reck et al. showed how to configure a network of beamsplitters and phase-shifters to implement the unitary physically. Following this finding, current quantum photonic gates—whether using bulk or integrated optics—are usually based on the beamsplitter architecture. For example, Ralph et al.36 proposed a probabilistic CNOT gate for photons with a success probability of 1/9, based on the beamsplitter architecture. This gate was successfully implemented using bulk optics.28 Later, the same design was reimplemented in integrated photonics,27 where a different hardware (waveguide couplers) was used to implement the same beamsplitter arrangement on a chip. However, in the case of integrated photonics, mimicking the beamsplitter architecture is not obviously the best choice: it utilizes only pairwise waveguide couplings, and it introduces bends to the waveguide design, and as the bends cannot be too sharp, this results in longer devices with increased losses.

In this section we show how to implement the quantum CNOT gave using the QW of photons on a small lattice. In photonics, continuous-time QWs are implemented on a waveguide lattice in which all the waveguides are straight and laid out in parallel (see Fig. 1d).6,7 Photons are injected into lattice sites and hop between the waveguides as they propagate along the lattice, according to Eq. (1). One-dimensional photonic walks are especially versatile, as this approach for integrated photonic devices allows for various additional components to be added, such as integrated sources, detectors, and modulators.

Since we expect that only a probabilistic CNOT gate is attainable, we allow for vacuum ancilla lattice sites. Thus, our Hamiltonian H defines a one-dimensional QW of 2 particles in n sites, and is described by n on-site terms and n − 1 coupling coefficients, where n may exceed the four sites defining two qubits. The multi-particle unitary evolution operator U = eiHT is an \(\frac{{n(n + 1)}}{2} \times \frac{{n(n + 1)}}{2}\) matrix that, as before, contains the CNOT gate as a 4 × 4 sub-matrix.

Using both global and local non-linear optimization procedures (see Methods), we optimized the gate fidelity and success probability over a space of lattice parameters, restricted to physically reasonable values, that would yield the correct many-particle operation. The results of this optimization for the CNOT gate are presented in Fig. 4. The curve shows the maximum fidelity of the obtained gate operation as a function of required success probability. Here our lattice contains six sites—the 4 sites required for two qubits, as well as two auxiliary sites—as sketched in Fig. 1d. A 100.00% fidelity gate can be found for a success probability of 1/9 (as in the beamsplitter approach), with the lattice (to two decimal places):

$$h = \pi \left( {\begin{array}{*{20}{c}} 0 & { - 1.27} & 0 & 0 & 0 & 0 \\ { - 1.27} & { - 0.73} & 0 & 0 & 0 & 0 \\ 0 & 0 & {0.67} & { - 0.51} & 0 & 0 \\ 0 & 0 & { - 0.51} & {0.01} & { - 1.69} & 0 \\ 0 & 0 & 0 & { - 1.69} & { - 1.01} & { - 0.52} \\ 0 & 0 & 0 & 0 & { - 0.52} & { - 1.67} \end{array}} \right)$$
(6)
Fig. 4
figure 4

Fidelity of the photonic CNOT gate as a function of success probability. The Fidelity peaks at 1 for success probability of 1/9

Again, the diagonal and off-diagonal entries of h CNOT represent the parameters E m and Jm,l, respectively, for the six-lattice sites, and sites 1 and 6 are the auxiliary sites. The gate operation and expected output probabilities are depicted in Fig. 5. It is interesting to note that while the peak of the curve in Fig. 4 is found at 1/9, the fidelity starts to fall significantly only at around 2/9, suggesting the possibility of systems that trade single-gate fidelity for higher success probabilities. The gate operation at the highest fidelity is presented in Fig. 5, depicting the real and imaginary matrix entries in the logical basis (Fig. 5a, b), as well as the photon density evolution (Fig. 5c–f).

Fig. 5
figure 5

A quantum-walk-based photonic CNOT gate. a, b The real and imaginary values of the relevant sub-matrix of the two-particle unitary generated by the Hamiltonian in Eq. (6), yielding a photonic CNOT gate with success probability of 1/9. Plots cf show the photon amplitudes as a function of time

Compiling a three-qubit primitive

Implementing a quantum algorithm using the scheme presented in this paper will involve several lattice configurations operating in sequence, as gates are sequentially applied in the algorithm. In principle, because the gate set presented in this work is universal, any multi-qubit operation can be broken down into a sequence of single-qubit and two-qubit gates, and thus implemented using the gates already presented. However, compiling common multi-step operations into a single primitive based on a single, time-independent Hamiltonian could reduce the possibility of errors arising from dynamic changes to the lattice. As an example, we constructed a three-qubit gate, shown in Fig. 6. This gate is useful, for instance, in the 2-bit Deutsch-Jozsa algorithm,37 performing the oracle for the function f(x,y) = x y. (All other oracles for the 2-bit Deutsch-–Jozsa algorithm are either a simple variation of this oracle or require only single-qubit gates plus at most one CNOT gate.) Our computational approach allowed us to find a set of lattice parameters that realizes the complete three-qubit operation in a single gate. We focus on the interacting boson case; as linear optical gates are post-selected, finding a multiparticle gate that is of high fidelity and also satiesfies unknown post-selection criteria requires a non-trivial amount of work beyond the scope of this article. Figure 6 presents an implementation of this three-qubit operation, at a fidelity of 99.8%, using a single, one-dimensional six-site lattice:

$$G = \pi \left( {\begin{array}{*{20}{c}} {5.98} & 0 & 0 & 0 & 0 & 0 \\ 0 & {7.13} & { - 1.21} & 0 & 0 & 0 \\ 0 & { - 1.21} & {0.14} & { - 12.04} & 0 & 0 \\ 0 & 0 & { - 12.04} & {0.18} & { - 1.37} & 0 \\ 0 & 0 & 0 & { - 1.37} & {11.69} & 0 \\ 0 & 0 & 0 & 0 & 0 & { - 8.03} \end{array}} \right)$$
(7)

with interaction strength Γ = 108.24π. In this case as well, the fidelity could be improved by allowing larger tunneling rates.

Fig. 6
figure 6

A 3-qubit operation of 2 CNOT gates (inset), compiled into a single gate U. a The real and b imaginary parts of our implementation of U. Only the logical basis states are shown

Discussion

We have shown that multi-particle continuous-time QWs in one dimension can implement quantum logic gates. For QWs of interacting bosons—a situation that arises for ultra-cold atoms in optical potentials—QWs yield universal deterministic quantum logic gates. For non-interacting photonic walks, our approach yields physically simpler probabilistic quantum logic gates than previously found. Our results can be implemented in integrated quantum photonic devices and ultra-cold atom systems that allow for single-particle manipulation and detection.

Methods

In this section, we detail the numerical methods used to find the gates presented in this work. We used a free-software implementation of a variety of numerical optimization algorithms.29 This software provides black box optimizers; this enabled us to, with a single specification of cost function and constraints, compare the success and computational cost of a number of different optimization approaches. We found that a randomly seeded global optimization algorithm30,31 combined with a gradient-free local algorithm32 gave the best performance, both in terms of number of iterations and computational run-time.

Careful selection of the cost function was crucial to the success of this work, and interacted with the choice of optimization algorithms, particularly the local optimizer. Throughout the paper, we define the fidelity of the gate in terms of the Hilbert–Schmidt inner-product between the target unitary gate operation U0 and the unitary operation U generated by the Hamiltonian at a given step of the optimization (restricted to the logical subspace). Specifically, the fidelity is defined to be

$$F(U_0,U) = \left| {\left\langle {U_0,U} \right\rangle _{\mathrm{C}}} \right|$$
(8)

with

$$\left\langle {U_0,U} \right\rangle _{\mathrm{C}} = \frac{{{\mathrm{Tr}}(U_0^\dagger U)}}{N},$$

where N is the dimension of the logical space (4 for two-qubit gates). This fidelity can be interpreted as a lower-bound average fidelity of the gate.

To be specific about the iterative numerical process, at each step we generated U from a vector corresponding to lattice parameters and calculated F(U0, U). Numerically, we found that minimizing the function 1 − F2, rather than 1 − F, gave superior performance. In the case of the algorithm given in ref. 32 the reason for this is clear: the algorithm assumes a quadratic cost function. However, we found that even with algorithms designed for linear cost functions (e.g., 38), convergence was much slower than for the quadratic cost function.

Finally, in order to ensure that U has the same global phase as U0 (this is for esthetic purposes, as F(U0, U) is invariant under multiplication by a global phase), we placed a cost on the phase of the matrix element u1,1. We found this to be most efficiently implemented by adding the term sin(arg(u1,1))2 to the cost function. This function is quadratic when perturbed about zero, is non-negative, and is symmetric about for all \(n \in {\Bbb Z}\), making it an ideal candidate function. We verified that the introduction of this additional cost both yielded a U with appropriate phase (see Fig. 2) and did not result in a decreased fidelity compared to optimization without this constraint.

Data availability

Source code and data are available from the authors upon reasonable request.