Introduction

Quantum technologies promise to provide speed-up in several fields, ranging from intrinsically secure long-distance quantum communication1 to a novel generation of high-precision sensors2, and enhanced computational and simulation capabilities3. Among the currently developed experimental platforms, in the last few years, photonic technologies have recently experienced a technological boost in all fundamental components, namely photon sources, manipulation, and detection4.

Recent studies have focused on identifying suitable dedicated classically-hard tasks, with the aim of leveraging the necessary technological resources and system size to reach the quantum advantage regime5,6. Such a regime corresponds to the scenario where a quantum device solves a given task faster than any classical counterpart. Within this context, a computational problem named Boson Sampling7 has been defined as a promising approach. This problem, which consists of sampling from the output distribution of a system of n non-interacting bosons undergoing linear evolution, is a classically-hard task (in n) while it can be naturally solved by a linear-optical photonic system. Such sampling problem has also subsequently inspired other classes of sampling problems8,9 suitable to be solved with different quantum hardware5,10,11.

Starting from the original proposal7, several experimental implementations of Boson Sampling instances12,13,14,15,16,17,18,19,20,21,22,23 and of recently proposed variants24,25,26,27,28 have been reported29. In particular, hybrid algorithms based on Gaussian Boson Sampling have been proposed for various tasks: quantum simulation27,30,31,32,33, optimization problems34, point processes35 graph theory36,37,38, and quantum optical neural networks39. Very recently, impressive experimental implementations of Gaussian Boson Sampling have been reported6,40. Besides the technological advances reported in the last few years, several studies have also focused on studying and improving the classical simulation of Boson Sampling41,42,43,44,45,46, and on defining the limits for simulability in the presence of imperfections, in particular losses and partial photon distinguishability47,48,49,50,51,52,53,54. All these studies aimed at establishing a classical benchmarking framework for Boson Sampling, and currently place the threshold for quantum advantage in such a system to n ~50 photons in a network composed of m ~ n2 = 2500 optical modes. Recent improvements in photon sources55,56,57,58,59,60 enabled the first Boson Sampling experiments with a number of detected photons up to n = 1423. However, reaching the quantum advantage regime with a photonic platform solving the original formulation of the task7 still requires a technological leap to enhance single-photon generation rates and indistinguishability, and to reduce losses in the current platforms for linear-optical networks.

Here, we introduce the adoption of non-linear interactions at the few-photon level within the Boson Sampling framework as a route to increase the complexity and reduce the threshold for the quantum advantage regime. This possibility is encouraged by recent advances showing the first experimental demonstrations of non-linear photonic processes with ultra-cold atoms61,62,63,64,65 and solid-state devices66,67. We will first describe the introduction of non-linearities within the otherwise linear evolution. Then, we will provide an upper bound on the complexity of the enhanced devices via a simulation scheme based on auxiliary, linear-optical gadgets. We will discuss both the asymptotic and finite cases, leveraging results from the well-established linear Boson Sampling framework7.

Results

Boson Sampling

Boson Sampling7 is a computational task that corresponds to sampling from the output distribution of n indistinguishable, non-interacting photons after evolution through an m-mode linear network [see Fig. 1a]. Given an interferometer described by a unitary matrix U, the transition amplitude from input \(\left\vert S\right\rangle\) to output state \(\left\vert T\right\rangle\) can be written as:

$${{{{\mathcal{A}}}}}_{U}\left(\left\vert S\right\rangle \to \left\vert T\right\rangle \right)=\left\langle T\right\vert \varphi (U)\left\vert S\right\rangle =\frac{{{{\rm{per}}}}({U}_{S,T})}{\sqrt{\mathop{\prod }\nolimits_{i,j = 1}^{m}{s}_{i}!{t}_{j}!}},$$
(1)

where \({{{\rm{per}}}}(A)={\sum }_{\sigma \in {S}_{n}}\mathop{\prod }\nolimits_{i = 1}^{n}{a}_{i,\sigma (i)}\) is the matrix permanent, {si}({ti}) are the occupation numbers of states \(\left\vert S\right\rangle (\left\vert T\right\rangle )\), and US,T is the n × n matrix obtained by selecting rows and columns of U according to the (s1, …, sm) and (t1, …, tm) respectively. Calculation of permanents of matrices with complex entries is in the #P-hard computational complexity class68. In Eq. (1), φ(U) is the unitary transformation acting on the Hilbert space \({{{{\mathcal{H}}}}}_{m,n}\) of n photons in m modes, that corresponds to the linear evolution U in the optical modes. Due to the linearity of the evolution, φ(U) is an homomorphism69. This means that, if a given evolution is the sequence of two linear networks W and V, the overall evolution can be written in terms of permanent of submatrices of U = VW.

Fig. 1: Non-linear Boson Sampling.
figure 1

a Scheme for a Boson Sampling apparatus according to the original formulation7, where n input photons impinge in a linear network described by unitary matrix U. b Scheme for non-linear Boson Sampling, which includes a non-linear evolution step N between two Haar-random linear steps W and V.

In ref. 7 it was shown that sampling (even approximately) from the output distribution of such a system is classically hard if (i) the input state \(\left\vert S\right\rangle =\left\vert {s}_{1},\ldots {s}_{m}\right\rangle\) has at most one photon per mode, (ii) U is drawn randomly from the uniform Haar measure, and (iii) the number of modes m and photons n satisfy mn6.

Non-linear Boson Sampling

Let us now consider the scheme of Fig. 1b. An input state \(\left\vert S\right\rangle =\left\vert {s}_{1},\ldots {s}_{m}\right\rangle\) of n indistinguishable photons undergoes an m-mode evolution divided into three steps. While steps 1 and 3 are linear evolutions V and W drawn from the Haar ensemble, the intermediate step 2 now consists of a non-linear evolution N. This N transforms a state \(\left\vert R\right\rangle =\left\vert {r}_{1},\ldots {r}_{m}\right\rangle\) as \(\left\vert R\right\rangle \mathop{\to }\limits^{N}{\sum }_{Q\in {{{\Phi }}}_{m,n}}{{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}\left\vert Q\right\rangle\), where \(\left\vert Q\right\rangle =\left\vert {q}_{1},\ldots {q}_{m}\right\rangle\) and Φm,n is the set of tuples corresponding to n photons in m modes. In this equation, function \({{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}\) represents the transition amplitude \({{{{\mathcal{A}}}}}_{N}(\left\vert R\right\rangle \to \left\vert Q\right\rangle )\) determined by the non-linear evolution. We assume \({{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}\) has an efficient classical description, e.g., it is given by the composition of a small number of few-mode non-linear transformations, or by a Hamiltonian with a simple form in terms of the field operators.

Let us now write the overall transformation of the input state \(\left\vert S\right\rangle =\left\vert {s}_{1},\ldots {s}_{m}\right\rangle\) according to the three-step evolution W → N → V, which includes linear transformations W, V of the form given by Eq. (1), and the non-linear \({{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}\):

$${{{{\mathcal{A}}}}}_{W,N,V}\left(\left\vert S\right\rangle \to \left\vert T\right\rangle \right)=\mathop{\sum}\limits_{R\in {{{\Phi }}}_{m,n}}\mathop{\sum}\limits_{Q\in {{{\Phi }}}_{m,n}}\frac{{{{\rm{per}}}}({W}_{S,R}){{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}{{{\rm{per}}}}({V}_{Q,T})}{\sqrt{\mathop{\prod }\nolimits_{i,j,k,l = 1}^{m}{s}_{i}!{r}_{j}!{q}_{k}!{t}_{l}!}}.$$
(2)

The detailed derivation is reported in Supplementary Note 1.

This amplitude is written as a Feynman path sum over all possible basis states just before and after the non-linear evolution step. If the permanent distribution was peaked, it might be possible to obtain a good approximation to Eq. (2) by summing over only the dominant terms. Haar-random matrices, however, display an anti-concentrated, relatively flat distribution7. In Supplementary Note 2 and Supplementary Fig. 1, we provide numerical evidence for this, showing that to account for (90, 95, and 99%) of the total probability mass function, we need to calculate the probabilities associated with respective fractions ~(0.5, 0.6, 0.8) of all possible outcomes; moreover, this behavior is nearly independent of n and m.

Of course, there may be computational shortcuts to evaluating Eq. (2), other than the explicit sum over paths. For example, if we replace the non-linear term N with a linear term, the amplitude can be evaluated as a single permanent. This motivates us to investigate different ways to assess the complexity of non-linear Boson Sampling.

Single-mode non-linear phase shift gate

Let us proceed by studying a specific example of non-linear evolution N consisting of a single non-linear phase gate introduced in mode x. Non-linear phase gates are among the simplest photon number preserving non-linear gates, implemented in various systems61,62,63,64,65,66, and for which strict bounds on the success probability are known70. The unitary operator describing this gate can be written as \({\hat{U}}_{{{{\rm{nlp}}}}}=\exp (-\imath {\hat{n}}_{x}^{2}\phi )\). Its action on a generic m-mode state \(\left\vert R\right\rangle\) leads to a function \({{{\mathcal{N}}}}\) of the form \({{{{\mathcal{N}}}}}_{{r}_{1}\ldots {r}_{m}}^{{q}_{1}\ldots {q}_{m}}=\exp (-\imath {r}_{x}^{2}\phi )\mathop{\prod }\nolimits_{i = 1}^{m}{\delta }_{{r}_{i},{q}_{i}}.\) Inserting this choice of non-linear evolution into the general expression (2), we obtain:

$${{{{\mathcal{A}}}}}_{W,N,V}^{{{{\rm{nlp}}}}}\left(\left\vert S\right\rangle \to \left\vert T\right\rangle \right)=\mathop{\sum}\limits_{R\in {{{\Phi }}}_{m,n}}\exp (-\imath {r}_{x}^{2}\phi )\frac{{{{\rm{per}}}}({W}_{S,R}){{{\rm{per}}}}({V}_{R,T})}{\sqrt{\mathop{\prod }\nolimits_{i = 1}^{m}{s}_{i}!{\left(\mathop{\prod }\nolimits_{j = 1}^{m}{r}_{j}!\right)}^{2}\mathop{\prod }\nolimits_{l = 1}^{m}{t}_{l}!}}.$$
(3)

Eq. (3) can be rearranged in the following form (see Supplementary Note 3):

$${{{{\mathcal{A}}}}}_{W,N,V}^{{{{\rm{nlp}}}}}\left(\left\vert S\right\rangle \to \left\vert T\right\rangle \right)=\frac{{{{\rm{per}}}}({\bar{U}}_{S,T})}{\sqrt{\mathop{\prod }\nolimits_{i = 1}^{m}{s}_{i}!\mathop{\prod }\nolimits_{l = 1}^{m}{t}_{l}!}}+\mathop{\sum}\limits_{{r}_{x} > 1}\frac{{{{\rm{per}}}}({W}_{S,R})[\exp (-\imath {r}_{x}^{2}\phi )-\exp (-\imath {r}_{x}\phi )]{{{\rm{per}}}}({V}_{R,T})}{\sqrt{\mathop{\prod }\nolimits_{i = 1}^{m}{s}_{i}!{\left(\mathop{\prod }\nolimits_{j = 1}^{m}{r}_{j}!\right)}^{2}\mathop{\prod }\nolimits_{l = 1}^{m}{t}_{l}!}}.$$
(4)

Here, \(\bar{U}\) is a unitary transformation composed of the sequence W, F, and V, where F replaces the non-linear phase in layer N with a linear phase shift described by the operator \(\exp (-\imath {\hat{n}}_{x}\phi )\). Equation (4) clearly shows that the departure from linear evolution is due only to bunching terms with more than a single photon in mode x (see Supplementary Note 4 and Supplementary Figs. 25).

Linear-optical simulation using auxiliary photons

A linear-optical scheme for the simulation of non-linear Boson Sampling can be obtained starting from the results due to Scheel et al. These results, reported in ref. 71, describe how auxiliary photons and modes can be used, together with linear optics, to induce effective non-linear gates. In particular, given a single mode state in the photon number basis \(\left\vert {\psi }_{{{{\rm{in}}}}}\right\rangle ={\sum }_{i}{c}_{i}\left\vert i\right\rangle\), it is possible to apply a polynomial of degree k in the photon number operator \({P}_{k}(\hat{n})\) to \(\left\vert {\psi }_{{{{\rm{in}}}}}\right\rangle\) by injecting the state in mode 1 of a suitably chosen (k + 1)-mode linear-optical gadget described by unitary Ueff, where the auxiliary modes j = 2, …, k + 1 are injected with a single-photon state \({\left\vert 1\right\rangle }_{j}\). The desired output state \(\left\vert {\psi }_{{{{\rm{out}}}}}\right\rangle ={P}_{k}(\hat{n})\left\vert {\psi }_{{{{\rm{in}}}}}\right\rangle\) is obtained upon conditional detection of a single photon on each of the auxiliary modes. If the input state has a maximum number of l photons \(\left\vert {\chi }_{{{{\rm{in}}}}}\right\rangle ={c}_{0}\left\vert 0\right\rangle +\ldots +{c}_{l}\left\vert l\right\rangle\), a polynomial of degree l in \(\hat{n}\) is sufficient to obtain the general evolution from \(\left\vert {\chi }_{{{{\rm{in}}}}}\right\rangle\) to \(\left\vert {\chi }_{{{{\rm{out}}}}}\right\rangle ={c}_{0}^{{\prime} }\left\vert 0\right\rangle +\ldots +{c}_{l}^{{\prime} }\left\vert l\right\rangle\) with arbitrary coefficients \(\{{c}_{0}^{{\prime} },\ldots ,{c}_{l}^{{\prime} }\}\). The effective evolution induced by this method must be some degree-l polynomial in \(\hat{n}\), though it remains an open question whether any degree-l polynomial can be implemented using only l auxiliary photons. This can be shown to hold for l = 2. Suppose we have some input \(\left\vert {\chi }_{{{{\rm{in}}}}}\right\rangle ={c}_{0}\left\vert 0\right\rangle +{c}_{1}\left\vert 1\right\rangle +{c}_{2}\left\vert 2\right\rangle\). All ci must be phases. Phase c0 can be fixed by an overall global phase, and the phase c1 can be fixed by applying a (linear) phase shifter. As shown in Supplementary Note 5, there is a gadget that implements any chosen value of c2. Combining these facts, it follows that any non-linear phase acting on states with, at most, two photons can be simulated by using two auxiliary photons. The success probability of the operation is equal to \({\Pr }_{{{{\rm{succ}}}}}=| {{{\rm{per}}}}({U}_{{{{\rm{eff}}}}}^{0,1,\ldots ,1}){| }^{2}\)71, where \({U}_{{{{\rm{eff}}}}}^{0,1,\ldots ,1}\) is the k × k submatrix of Ueff obtained by removing row 1 and column 1 from the full matrix.

Finding the effective linear-optical simulation unitary Ueff has been done previously only for a few types of gates and small k71,72,73,74, as the computational effort seems to scale exponentially with k. Nevertheless, even limited non-linear gate simulations can be quite versatile, as it is known that almost any non-linear gate can be combined with linear optics to generate arbitrary non-linear gates75—for details, see Supplementary Note 5.

In Fig. 2, we describe the linear-optical, post-selection-based gadget that can be used to simulate single-mode non-linear gates. We see that the k-mode linear-optical gadget (with k ≤ n) replaces the single-mode non-linear gate. In the gadget, mode x and the k single photons undergo the effective unitary Ueff. This linear-optical simulation approximates the non-linear Boson Sampling evolution upon detection of k photons at the auxiliary output modes.

Fig. 2: Linear optics simulation of non-linear Boson Sampling.
figure 2

Scheme for linear optics simulation of non-linear Boson Sampling with a single-mode nonlinearity N on mode x between two Haar-random linear unitaries W and V. Mode x after linear transformation W is injected in the first port of a (k + 1)-mode linear-optical gadget described by unitary Ueff, whose other input ports are injected with k single photon states (k ≤ n). Detection of one photon in each of the k auxiliary modes of the gadget heralds a successful simulation of the single-mode non-linearity in mode x of the original interferometer (see inset).

Bounding complexity via classical simulation algorithms

An upper bound on the complexity of non-linear Boson Sampling can be obtained by devising a specific classical simulation algorithm. We define such an algorithm starting from the linear-optical gadget described above. We discuss below the specific case of a single-mode non-linear phase.

Using the state-of-the-art weak classical simulation algorithm of Clifford and Clifford42, we can simulate the enlarged (n + k, m + k) linear-optical system, post-selecting only those events where a single photon is measured in each of the auxiliary modes (m + 1, …, m + k) (see Methods, Supplementary Note 5 and Supplementary Figs. 713 for more details). This results in a classical simulation algorithm for the non-linear Boson Sampling experiment.

Let us now discuss some issues that arise when using this scheme to simulate non-linear Boson Sampling in either the asymptotic regime of large numbers of photons/modes, or in the finite setting.

Non-linearities in the asymptotic setting

Assuming uniformly drawn, Haar-random interferometer unitaries, it has been shown that the appropriate scaling between the original number of modes m and the number of photons n will result in asymptotic suppression of multi-photon collisions. More precisely: if m = O(nj/(j−1)), then (j + 1)-fold collisions are suppressed, when n, m go to infinity76. In particular, this will be true for the photon occupation numbers at the non-linear gates. So, by choosing m = O(nk/(k+1)), at most k photons will asymptotically be present at each non-linear gate, which means the linear-optical simulation (or classical simulation based on it) can be done with only k auxiliary photons per non-linear gate. As we will soon show, such a simulation for small k, e.g., k = 2, 3, 4 can be readily obtained. These simulations using k = 2 are sufficient for an asymptotically perfect simulation for the usual Boson Sampling regime of m = O(n2). In other words, in this setting, there is a precise correspondence between one single-mode non-linear phase gate and two extra auxiliary photons. More generally, the scaling of m with n dictates how many auxiliary photons are needed for an asymptotically perfect simulation of a non-linear phase gate N.

Non-linearities in the finite setting

The setting with finite n, m is experimentally relevant, and in this case, there will be no strict suppression of multi-photon collisions at the nonlinear gates. Setting k = n results in an exact classical simulation of non-linear Boson Sampling. When k < n, we will have only an approximate simulation. As an example, when m ~ n2 numerical results suggest that a number of auxiliary photons equal to k = 2, 3 should provide a sufficiently accurate simulation given the large effective suppression of bunching at the output of Haar-random unitaries (see Supplementary Note 5).

There are two main features that increase the simulation complexity. First, finding an effective unitary Ueff that uses k photons for a linear-optical simulation seems to require the computation of permanents of k × k matrices71 (see also Supplementary Note 5), which results in a classical runtime that increases exponentially with k. The other cost incurred is the post-selection overhead. From all the simulated events on the enlarged linear-optical set-up with (n + k) photons, we only use events where the k auxiliary photons were detected at the linear-optical simulation gadget. This will happen with a probability \({\Pr }_{{{{\rm{succ}}}}}=| {{{\rm{per}}}}({U}_{{{{\rm{eff}}}}}^{0,1,\ldots ,1}){| }^{2}=p\). There is some evidence that the maximum value of p tends to decrease as k increases70. This post-selection overhead arises when using the fast algorithm by Clifford and Clifford42 to classically draw samples from the linear-optical equivalent scheme. This overhead can be reduced by considering an adaption of the first algorithm reported in ref. 42. Such an algorithm, with a slower runtime, can be modified to condition the first k events to occur in a specific set of modes. Finally, in Supplementary Note 6, we provide evidence that this post-selection overhead can be converted to a constant factor by adapting the classical Metropolised Independent Sampling approach41 via an appropriate choice of the candidate mockup distribution. This suggests that it is possible to define classical algorithms that, leveraging on the post-selected linear-optical scheme, can sample by calculating a (constant) number of permanents of matrices with size (n + k), with a simulation cost of O((n + k)2n+k).

We have performed classical simulations of non-linear Boson Sampling with a single non-linear phase in the finite setting, using the classical algorithm based on linear-optical simulation. The results are shown in Fig. 3 and in Supplementary Fig. 13. As expected, having k = n results in exact sampling from the non-linear process, and in fact (once the appropriate gadget Ueff has been determined), is numerically found to be more computationally effective than directly using Eq. (2). For fixed n, k, note that the simulation error decreases with increasing m, since bunching events become rarer. These results suggest that the crucial parameter for the simulation complexity is the scaling between n and m. The regime when m = O(n) is particularly interesting, as there is a trade-off between a faster classical simulation algorithm46, and the increased complexity required to find the linear-optical gadget unitary Ueff for larger k.

Fig. 3: Simulation in the finite setting.
figure 3

Analysis of total variation distance (TVD) between the non-linear process and its linear-optical simulation, and bunching probability at the non-linear phase shift site for n = 4 photons. The TVD is calculated between the exact probability distribution [Eq. (4)], and the post-selected linear-optical simulation using k < n auxiliary photons. In these plots, the exact distribution is calculated using the linear-optical simulation scheme with n auxiliary photons. \({P}_{{{{\rm{bunch}}}}}^{x}\) is the probability of having more than k photons at the nonlinearity site x. a Parametric plot showing a correlation between the mean values \(\overline{{{{\rm{TVD}}}}}\) and \(\overline{{P}_{{{{\rm{bunch}}}}}^{x}}\), averaged over 100 different evolutions W and V for fixed ϕ = π/2. Each point corresponds to a different value of m, in the range [5, 7, …, 45]. be Correlation between TVD and \({P}_{{{{\rm{bunch}}}}}^{x}\) for fixed number of modes m. Here, each point corresponds to different evolutions W and V for fixed ϕ = π/2. In all plots: blue points correspond to k = 1, orange points to k = 2, and green points to k = 3.

If the number of auxiliary photons k < n, the simulation scheme based on linear-optical gadgets will be only approximate, due to non-linear dynamics of more than k photons. The key open point in this scenario is to quantify the simulation error incurred. In Fig. 3, we provide a numerical study on how the simulation error depends on n, m, k, as quantified by the total variation distance (TVD) between the exact non-linear evolution and its simulation using k < n auxiliary photons. We observe a strong correlation between the TVD and the probability of bunching at the non-linearity site x. An open interesting research question is to obtain a quantitative description of this dependence between TVD and bunching, for instance, by using bounds on bunching in the uniformly random, Haar ensemble of unitaries.

Discussion

We have proposed the adoption of non-linear gates within the framework of Boson Sampling as a way to increase the computational complexity of the model. We have shown how to define a hardware-based linear-optical simulation for non-linear Boson Sampling. Furthermore, we upper-bounded the complexity of non-linear Boson Sampling by tailoring a classical simulation algorithm using parallelism to linear optics and post-selection. For large numbers m of modes and n of photons, suppressed bunching allows asymptotically perfect simulation at the cost of two extra photons per non-linear phase gate introduced, if we assume m = O(n2). For finite m, n, and single-mode non-linear phase gates, we identify the probability of bunching, governed by the scaling of m as a function of n, as the key factor affecting the complexity of our proposed simulation scheme.

The non-linear Boson Sampling model we propose is inherently more expressive than linear Boson Sampling. In light of the recent developments regarding the first application of Boson Sampling and its variants for hybrid quantum computational models, we expect that having access to increased functionalities enabled by non-linearities can be turned into a useful advantage for tasks solvable with linear Boson Sampling, as well as propose altogether new tasks solvable by noisy, intermediate-scale quantum (NISQ) devices. Looking at the longer term, it is known that a constant number of initial layers of non-linear gates suffice to create a photonic cluster state and enable universal photonic quantum computation. Our results are an initial step towards understanding the increase in complexity as we start this transition from the linear to the non-linear regime in photonic quantum computation. Some promising architectures for scalable photonic quantum computation77 rely exactly on measurement-induced non-linearities of the type we investigate here.

Finally, an important question that we leave open is the effect of imperfections—such as losses and partial distinguishability—on this model. Modelling these effects is likely to be more intricate in non-linear Boson Sampling than in the standard Boson Sampling proposal. Losses, in particular, are usually assumed to occur at the input or output of the interferometer (at least as long as they can be assumed to affect all modes equally), but that assumption is less benign when non-linear elements are involved. Some versions of it would be easy to recover for the particular case of \({\hat{U}}_{{{{\rm{nlp}}}}}\) we consider here, but not in the more general case of many non-linear and linear interspersed elements.

Methods

Classical simulation algorithms for non-linear Boson Sampling

The scheme of Fig. 2 employs a set of ancillary photons and modes, and an auxiliary transformation Ueff that depends on the nonlinear transformation. This scheme defines both a linear-optical simulation algorithm, which can be implemented by building the corresponding experimental apparatus and thus running the device, and an approach for the classical simulation. We describe here this approach for the classical simulation (more details can be found in Supplementary Notes 5, 6).

Algorithm 1

The second algorithm reported in ref. 42, which provides a classical simulation of linear Boson Sampling with a cost of O(n2n + poly(m, n)) and O(m) additional space, can be employed for the approximate simulation of non-linear Boson Sampling. In particular, given a level of approximation provided by the number k of ancillary photons and modes, one can (i) calculate the effective (m + k) × (m + k) transformation comprising the sequence of W, Ueff, and V, (ii) sample an event via the second algorithm of ref. 42, and (iii) check whether the sample corresponds to a valid outcome considering the post-selection requirements from the linear gadget. If the sample is not valid, iterate point (ii) until a correct outcome is drawn. As discussed above, this implies that the algorithm has a success probability given by Prsucc.

Algorithm 2

The first algorithm reported in ref. 42 for linear Boson Sampling, having a cost of O(mn3n), can be adapted to a conditional scenario. More specifically, if one needs to retain only events where photons on modes (r1, …, rl) are detected, this is obtained by forcing the sampling process to start directly from taking the required vector of output modes as the starting point. Then, the remaining modes are sampled by using the procedure of the first algorithm of ref. 42. The requirement to discard part of the events to avoid multiple occurrences in the conditional modes introduces a failure probability \({\overline{p}}_{{{{\rm{fail}}}}}\) for this sampling process. In Supplementary Note 6A, we analyzed the scaling of the failure probability \({\overline{p}}_{{{{\rm{fail}}}}}\).

Algorithm 3

The metropolised independent sampling algorithm, applied in ref. 41 in the Boson Sampling context, can be adapted to the conditional scenario required for classical simulation of non-linear Boson Sampling exploiting the scheme of Fig. 2. The main idea behind the metropolised independent sampling approach is to construct a Markov chain process. At each step, a candidate sample, generated via a given mockup distribution, is accepted with a certain probability that depends on the probability mass function of Boson Sampling and of the mockup. Adaptation to the conditional scenario can be performed by choosing as a mockup a conditional uniform sampler, that generates samples from the uniform distribution with the correct outcome in the required modes for post-selection. In Supplementary Note 6B, we analyze the scaling of the relevant parameters for this approach.