Quantum computer-aided design of quantum optics hardware

The parameters of a quantum system grow exponentially with the number of involved quantum particles. Hence, the associated memory requirement to store or manipulate the underlying wavefunction goes well beyond the limit of the best classical computers for quantum systems composed of a few dozen particles, leading to serious challenges in their numerical simulation. This implies that the verification and design of new quantum devices and experiments are fundamentally limited to small system size. It is not clear how the full potential of large quantum systems can be exploited. Here, we present the concept of quantum computer designed quantum hardware and apply it to the field of quantum optics. Specifically, we map complex experimental hardware for high-dimensional, many-body entangled photons into a gate-based quantum circuit. We show explicitly how digital quantum simulation of Boson sampling experiments can be realized. We then illustrate how to design quantum-optical setups for complex entangled photonic systems, such as high-dimensional Greenberger–Horne–Zeilinger states and their derivatives. Since photonic hardware is already on the edge of quantum supremacy and the development of gate-based quantum computers is rapidly advancing, our approach promises to be a useful tool for the future of quantum device design.

While quantum experiments historically have been designed by experienced human experts, their non-intuitive nature has led to the emergence of computational methods for designing quantum experiments [18][19][20][21][22][23][24][25].However, as the dimension of state space grows exponentially with the number of photons, this approach is limited to small systems.Consequently, while the abilities of photonic hardware constantly improve [26][27][28][29][30], there is no efficient computational method that can take advantage of the vast resources provided by these systems.Furthermore, photonic quantum supremacy experiments are close to the point where they cannot be calculated with classical hardware [31].How can one verify their correct execution when such calculations step beyond the point of classical calculation?
Here we illustrate a solution to solve the verification and the design processes of quantum optical setups.We demonstrate how quantum optical systems can be recast in the language of digital quantum computers and use the state-of-the-art simulators of quantum computers to design experiments for complex multiphoton entangled quantum systems.Furthermore, we showcase the quantum simulation for one of the first demonstrations of Boson sampling [32], illustrating that digital quantum computers can function as witnesses for photonic quantum supremacy experiments that are expected in the near future.
Due to the rapid progress in the development of gate based quantum computers in the recent years [33,34], we estimate that the design of photonic hardware with quantum computers will become a realistic scenario in the near future.In the meantime, the optimization strategies presented here could also serve as valuable benchmarks complementary to quantum chemistry [35].While the latter mainly focuses on determining an energy for an unknown ground state, the optimization of an optical setup focuses on determining its parameters for a desired target quantum state.
We propose the design and simulation of general quantum hardware as a new application for quantum computers.In this manuscript, we focus on photonic quantum hardware by translating optical elements and measurement techniques into gate based quantum computers language.In a separate paper, some of us target the de-arXiv:2006.03075v2[quant-ph] 3 May 2021 sign of efficient superconducting qubit architectures by translating the corresponding Hamiltonians into a digital quantum circuit [36].

II. QUANTUM SIMULATION OF OPTICAL ELEMENTS
In the following, we will explain the mapping from quantum optics onto quantum circuits.A quantum optical setup consists of multiple optical path modes (paths) which can be occupied by multiple photons with additional internal degrees of freedom (modes) like for example orbital angular momentum of light [37][38][39].The photonic occupation number of each internal degree of freedom is represented by a set of qubits.We will use binary encoding and we refer to the Ref. [40] for detailed analyses of other encodings (see also Refs.[41,42] for unary encodings).In this representation, the number of qubits needed to represent an optical setup is given by where N γ is the maximum number of photons in one mode and we have used the integer ceiling function.With this encoding, a basis state of the photonic setup can be represented as p m |n m,p where p, m, n represent path, mode and number of photons, respectively.Take as an example a setup with N paths = 1 path, and N modes = 3 internal degrees of freedom, denoted as {−1, 0, 1}, where each can be occupied by up to N γ = 3 photons.A state in this setup can then be represented by N qubit = 6 qubits.Assuming that 2 of the photons occupy the mode −1 and 1 photon occupies mode 1, the state can then be denoted as These photonic states can be transformed by optical elements which can be represented by digital quantum gates.In Fig. 1 we show gate based representations of important optical elements for high-dimensional quantum optics and provide further details in the appendix.

A. Implementation
One of the advantages of simulating the optical setups on a digital quantum computer is the direct access to gradients of parametrized elements within a fully automatically differentiable framework.[43,44] This fulfills all necessary conditions to replace the classical simulation module of topological optimizers such as theseus [45] as illustrated in Fig. 2. We will illustrate the underlying framework here using the phase shifter of Fig. 1 as an explicit example.The phase shifter is shifting the relative phase of the photonic state depending on the number of photons occupying the photonic path onto which the element acts.Using the Bosonic number operator, a phase shifter acting on path mode a can then be written as with the associated relative phase e iφ .With the mapping of Fig. 5 an n-qubit implementation of the phase shifter can be realized by a collection of single qubit operations where the S(φ) = e −i φ 2 (σz−1) gate adds the phase e iφ to the state |1 and leaves |0 invariant (see the appendix for more details).In the optimization of a quantum optical setup, we aim to optimize the fidelity of the state, created by the setup, with a specific target state.In the next section (Eqs.( 3) and ( 5)) we will construct this fidelity as a function of expectation values E = H U (φ) depending on the phase shifter parameter φ through the unitary U (φ) that encodes the quantum optical setup, and a Hamiltonian H that encodes the measurements.In order to compute the gradient of the fidelity with respect to the phase shifter parameter φ, we need the gradients of the expectation value ∂ φ E. Following Schuld et.al.[43] those gradients can be obtained with the parameter-shift rule, which allows the evaluation of the analytical gradients via a finite-difference like procedure as In order for this technique to be applicable, the generator of the parametrized quantum gate is required to have only two distinct eigenvalues with distance 2r.Quantum gates that do not fulfill this condition can be decomposed into more primitive gates, which allows to evaluate their gradients by combining the parameter-shift rule with the product rule of calculus (see [46] for illustrations).In our explicit example the phase shifter is represented by a set of S(φ) gates with the generator 1  2 (σ z − 1).These gates fulfills the condition (r = 1  2 ) and no further decomposition is necessary.Gradients of the other parametrized optical elements, such as the beam splitter or the heralding process are obtained in an analogue fashion.The parametrized part of the beam splitter is represented by single qubit rotations which fulfill the requirements for the parameter-shift rule and also do not require further decomposition.In our example in Fig. 3 the heralding process contains a controlled rotation that needs to be further decomposed (see [46] for an explicit example).In our implementation we use tequila [46], a high level python package that automatizes the illustrated gradient compilation and associated gate decompositions.We refer to Refs.[46,47] for more details on the implementation of the automatically differentiable framework.Note that the evaluation of the gradient in this way would not be possible on an actual quantum optical setup, since the decomposition of the optical elements into more primitive gates is not possible as those elements are already the primitive building blocks.This constitutes one of the main advantages of our approach.Here we use the orbital angular momentum of photons as a high dimensional degree of freedom.In general, this approach can be applied to any discrete high dimensional quantum numbers.Each internal mode is represented by several qubits representing the photon occupation number (see Supplementary Information for additional details).(a) Example of a beam splitter used in Fig. 3 where each internal mode is represented by one qubit.The general multi-photon beam splitter (see Fig. 4) is constructed with a Trotter expansion and is too large to show here.

III. QUANTUM OPTICAL SETUPS
In the following we will describe how to optimize the fidelity of a parametrized optical setup with a specific target state on a digital quantum computer.The goal is to determine the optimal parameters of a quantum optical setup for quantum communication, quantum metrology and experiments testing foundations of quantum physics.Optimizing the quantum optical setup on a universal gate based quantum computer has unique advantages, two of which are particularly relevant here: First, the initial state preparation can be deterministic, in contrast to widely used probabilistic photon state sources.Second, the access to universal gates allows the evaluation of analytical gradients as illustrated in the last section as well as more efficient measurement protocols.Our concrete example results in measuring only the occurrence of one specific product state as a proxy for the fidelity of a complex entangled state.In the future one could imagine large parametrized optical setups simulated on quantum computers.Ideally, the simulation would reduce the setup size by optimizing parameters of specific elements such that they are equivalent to the application of the identity, allowing the removal of said elements.In this case the optimized topology would emerge.Recently some of us developed classical graph based optimization methods for quantum optics.Here, the above proposed reduction of the large setups through parameter optimization could already be realized with a classical simulation.[45] We believe that the full potential of the techniques developed in this work will be reached in combination with those topological optimization methods.In Fig. 2 we illustrate possible combinations of classical topological optimizers with the techniques proposed here and add further details in the appendix.The quantum part can, for example, be an efficient sub-module of the overall topological optimization.Note, that in the following proof of principle illustration, we chose a setup from the literature that incorporates heralding and post-selection.Therefore choosing a setup that is not trivial, but also small enough to envision execution on currently emerging ion-trap or superconducting quantum hardware.
Recent improvements on the topological optimizers, developed simultaneously with this work, directly led to solutions of previously unanswered questions in experimental quantum optics.[45] Those improvements where however mainly concerned with the topological part of the optimization and the simulation of the optical setup is currently becoming the bottleneck.At this point, a powerful digital quantum computer can step in, and take over the simulation of the optical setups within the topological optimization.Compared to other scientific fields like quantum chemistry, the necessary classical simulation of quantum optical setups is not as deeply explored, so that further improvements in this direction bear a high potential.Although we are primarily concerned with quantum simulation in this work, our implementation within tequila provides an ideal testbed for improved classical optimizers and simulators.One example might be state of the art tensor-network based contraction methods [48] and we are currently exploring this possibilities.
The quantum part of the optimization is performed in the spirit of variational quantum eigensolvers (VQE's) originally proposed to variationally approximate eigenstates of a given Hamiltonian [49].In this work, we use a variational algorithm to optimize fidelities for a given target state which can be written as the expectation value with the Hamiltonian H = |Ψ Ψ|, and where Ψ is the desired target state.Depending on Ψ, the number of measurable components (tensor products of Pauli matrices) in the Hamiltonian, can grow large.One proposed way to reduce the number of measurements is to group the Hamiltonian into commuting cliques [50][51][52], a technique which could be applied here in the same way.Since in contrast to most VQE optimizations the target state is known here, we can measure the Hamiltonian directly by using the unitary U Ψ that prepares the target state and measure the transformed projector where Z j denotes the Pauli Z-matrix on qubit j.This technique allows us to further optimize for target states where only the unitary operation on the digital quantum machine is known, this includes states which are themselves optimized by variational quantum algorithms beforehand.The expectation value of this Hamiltonian can then be estimated by measuring all qubits in the computational basis and counting the "all-zero" results where the probability of measuring them is directly proportional to the desired fidelity.
Optimization of a heralded, post-selected state Two common measurement based preparation strategies in quantum optics are heralding and post-selection.
Heralding means that the measurement of a trigger photon in an ancillary path determines the success of the FIG. 2. Quantum computer-aided design of quantum optics hardware: Proposed usage of the developed techniques in combination with topological optimizers like melvin [18] or theseus [45].Within those optimizers, the (classical) computation of the involved fidelities is currently the computational bottleneck.In this work we propose to replace this classical subroutine with a quantum algorithm that can evaluate and optimize the corresponding fidelities.
preparation.This projection of the state by measuring the ancillary path can be represented in the same way as above by measuring the following projector where the U † p transforms the state |p in which the trigger photon is measured into the |0 . . .0 state.Note that the state in which the trigger photon is measured, can be optimized when the unitary U p is parametrized (see Fig. 3 for an example).In addition, the generated states can be restricted by post selection that only outcomes of the experiment are counted with one photon in each measured path.Since the post-selection projector acts on the same paths as the Hamiltonian representing the fidelity, it is not possible to directly use the transformed Hamiltonian of (4) to reduce the number of measurements.If one can afford using twice the number of qubits the approach of Ref. [53], can be applied, where the information about the photon occupation number is transferred to additional ancillary qubits by a series of controlled not operations.Depending on the specific setup, the number of ancillary qubits can be reduced by constructing an efficient encoding E (see Fig. 3 for an example).The post-processing is then carried out over the additional registers.For both methods, it is important to normalize the fidelity in order to ensure that the parametrization leading to the highest fidelity after applying both projectors is the global minimum of the loss function.The fidelity one needs to optimize is where P 1 projects onto the one-photon subspace.
Example: Optimization of a post-selected heralded 332-state As an instructive example we will show here the optimization of a parametrized quantum optical setup targeted to produce a so called 332-state [54,55], a state with high-dimensional multipartite entanglement, where the first two photons are entangled over all three paths and the third over two paths.Using (-1, 0, +1) as internal degrees of freedom a 332-state can be written as The preparation of the 332-state is a subset of the setup to prepare a multidimensional GHZ state and the setup with the right parametrization has been found by using automatic generation and search algorithms [18] where a variational quantum optimization shown in Fig. 2 was not applied.After it was found by computer-aided design, the proposed state preparation setup could be demonstrated experimentally [56,57] The parametrized setup which can generate a post-selected heralded 332-state is shown in Fig. 3 where the state is created in the photonic paths b, c, d and a measurement of the photon in path a is used as a trigger for the successful preparation of the state in paths b, c, d.While the preparation of the state is non-trivial with a quantum optical setup, it can be directly prepared on a digital quantum computer as shown in Fig. 3. Another advantage of the digital quantum simulation is the direct generation of initial states (here high-dimensional Bell states), which, on real photonic devices, have to be created in a probabilistic fashion with spontaneous parametric down-conversion (SPDC).Successful pair generation events through SPDC are rare, and the count rates are usually measured in counts per hour [25].This is one of the reasons that make direct optimization of the photonic hardware a less desirable task.
In other words, on the digital quantum computer, we simulate only the runs of the quantum optics experiment with successful state initialization, circumventing the associated waiting times that come with the low count rates for the original photonic device.For this example, it is possible to approximate each internal degree of freedom by a single qubit and use an efficient encoding E for the implementation of the single-photon projector leading to an overall circuit involving 15 qubits.The encoding E flips the ancillary qubits (P 1 b , P 1 c , P 1 d ) assigned to each path (b, c, d) if the path has one or three photons and the post-selection process is encoded by counting only measurements where all three ancillary qubits are zero.Notice that the three photon case does not influence the result in this example since having three photons in all three paths is not possible in this setup.Note as well that due to the encoding of the post-selection process, the fidelity with the target state as well as the measurement process of the trigger photon in path a is again the same as in (4).That means measuring all 15 qubits in the computational basis and counting the overall all-zero results directly leads to the desired heralded and postselected Fidelity of (5).For the initialization, we choose angles close to zero with varying signs.We show one particular optimization in Fig. 3(c).

Example: Boson-Sampling
A potentially interesting application for simulating quantum optical setups on a digital quantum computer is the quantum simulation of Boson sampling experiments, which are currently approaching a size inaccessible for classical computers.Boson sampling [58] is one major candidate for demonstrating quantum supremacy on near-term quantum devices.There is no doubt that it will become challenging to simulate Boson sampling devices as the system size grows.Several classical validation methods exist which, though unable to confirm Boson sampling directly, may be used to rule out sampling from more classically accessible distributions.Examples involve row norm estimates [59][60][61], Bayesian analysis [31], Kolmogorov-Smirnov tests [62] and machine learning approaches [63].The approach here however simulates the underlying optical sampling setup directly providing the possibility to manipulate the quantum state through unitary operations at different stages of the process.At and beyond the quantum supremacy threshold, simulation with a classical computer will, for the general case, become impossible in practice.A powerful digital quantum computer could at this point step in and reproduce the process.Apart from solely showing quantum supremacy, there are proposals to employ them for more valuable computations like the generation of Frank-Condon spectra of molecules [64], for which cross simulation will be a useful tool.It is currently unclear if specialized quantum algorithms on digital machines could achieve the same task more efficiently.Here our mapping would provide a first test for prospective candidates, that would need to offer advantages compared to a simulated Boson sampling device.Our techniques can be used to translate Boson sampling devices onto digital quantum computers, hence it naturally enables those kind of simulations.To illustrate this, we transform one of the first experimental Boson sampling setups [32] using integrated photonics into the language of digital quantum computers and reproduce its results.The corresponding setup is shown in Fig. 4. We simulate it by representing each path with 2 qubits, resulting in a 10-qubit quantum circuit.The corresponding distribution, using different Trotter numbers, is shown in Fig. 4, where distributions obtained with 40-50 trotter steps are visually indistinguishable from the theoretically-obtained distribution in Ref. [32], and the low order simulation with 5 Trotter steps already produces a qualitatively correct result that agrees with the The encoding E emulates the post-selection by transferring information about the photon number in paths b, c, d to auxiliary qubits P 1 b , P 1 c , P 1 d leading them to be in the zero-state for valid configurations.Similar as the trigger in a, U † Ψ transforms the target state of ( 7) into the zero-state.The probability of measuring the overall zero-state directly corresponds to the heralded and post-selected fidelity of ( 5) with the target state Ψ.The setup is parametrized with three angles (one for the Dove prism and two for the trigger).(b-c) Optimization of the setup with the 'BFGS' optimizer.(d) Explicit circuit for the setup in (a).results of Ref. [32].We used the number of valid states -obeying particle number conservation -as a potential indicator for sufficient accuracy in the Beam-Splitter representation.We note here that there is still significant potential for further improvement with respect to the explicit construction of the Trotter expansion, for example with randomized compilation [65] or by optimizing the ordering in the Trotter decomposition using similar ideas as those used in Fermionic simulation (see Refs. [66] and [67]).In our opinion, the digital quantum simulation of a photonic Boson sampling setup will not bring any advantages regarding sample sizes and runtime.It is furthermore a tool that might be applied to analyze the evolution of the wavefunction in the same way as it is currently done with classical simulators.Our approach aims to take over, at a point where explicit classical simulation is no longer feasible.Other than the optimization example of the last section, our Boson sampling example is unlikely to be executable on recently emerging architectures due to the gate counts in the quantum circuits.Due to it's conceptual simplicity and low qubit requirements we think it could be an interesting benchmark example for early stage fault tolerant machines and advanced compilation strategies.

IV. CONCLUSIONS
In 1981, Richard Feynman gave his visionary keynote speech at MIT that paved the way towards quantum simulations [68].He explained his intuitions using an quantum optical Einstein-Podolsky-Rosen experiment and famously concludes that nature isn't classical, dammit, and if you want to make a simulation of nature, you'd better make it quantum mechanical.As a direct consequence of Feynman's insight, we argue that the very hardware for simulating and measuring nature isn't classical, and thereby you'd better make design and verification quantum mechanical.Here, we have shown quantum simulation of quantum hardware for entangled quantum photonic systems -the basis of Feynman's original thought experiment.However, the general idea that we propose here goes far beyond that.Any hardware that measures, transforms or exploits quantum systems should ultimately be designed through methods that leverage the power of quantum computers to exploit the full potential furnished by quantum physics [36].Combinations with classical algorithms should however not be restricted but rather leveraged to gain the best of both worlds.Compared to working directly with the photonic setups, our proposal brings several advantages.First, it allows the usage of operations that are often steps the error with respect to the exact quantum optical setup is about 2 percent, and consistent with the results presented in [32].
easy to realize on a digital quantum computer, such as the direct preparation of the target and initial states, allowing for less measurement intensive optimization protocols and avoiding long waiting times associated to the low count rates of the initial photon creation.Second, the formulation within a digital quantum computing framework gives direct access of the associated gradients through decompositions into directly differentiable quantum gates.[43,46,47] Finally, the abstract formulation within a generalized, automatically differentiable physical language, in the form of quantum circuits and expectation values, make it independent of special purpose simulation techniques.Our open-source implementation of the techniques developed here will profit immediately from improvements in quantum hardware as well as classical simulators.In future applications, the techniques for optimization and encoding developed in this work could be used as an efficient sub-routine of graph based topological optimization algorithms [45].As such, we anticipate the applications of quantum designed quantum hardware to quantum computing hardware, quantum sensors, quantum memories, and quantum communication networks.
Python code for the tequila [46] package as well as explicit code [69] for the calculations in this work can be found on github.
where θ and ψ are complex numbers and the operator â † m creates a photon in internal mode m in the photonic path a.Since each term in the sum in the exponent commutes, the part which depends on the internal modes separates naturally into a product of unitaries acting only on a specific mode in each path (note that we formally apply the qubit encoding after this step).This is illustrated in Fig. 6.The Trotter decomposition (used for example in Fig. 4 of the main text) becomes necessary after the photonic operators have been mapped onto Pauli operators, i.e the parts acting on the individual modes m are trotterized after they are mapped onto qubit operators.The phase shifter can be defined by its action onto a single internal degree of freedom in a given photonic path.It acts by adding a phase φ to each photonic state w.r.t the number of photons occupying it.In terms of creation/annihilation operators this can be expressed as where we have assumed only one internal degree of freedom in the path.In binary representation the action of the phase shifter can be implemented by a set of single qubit phase gates S (φ) which add a phase e iφ to the |1 state and acts trivial on |0 .Assume for example that the internal mode is represented by n qubits and that the occupation number is encoded in binary, then the phase shifter acting on that mode can be implemented as where we assumed most significant ordering in the binary encoding.This implementation of the phase shifter with phase gates is also shown in Fig. 7.Note that each S (φ) gate can be replaced by a R z (−φ) rotation which implements the same relative phase.If internal degrees of freedom are used within the photonic paths a mode dependent phase shifter (Dove prism) can be applied.In the case of orbital angular momentum as inner degree of freedem the Dove prism acts like a set of mode dependent phase shifters where m is the orbital angular momentum quantum number.We illustrate the implementation of a Dove prism in Fig. 8 a DP (φ)   In the following we show the implementation of two nonparametrized optical elements which are called hologram and mirror and both depend on photonic swap operations which swap photons between two photonic modes or paths.The implementation of those swap operations is straight forward by applying a swap operation onto all qubits which represent the photonic mode or path.We illustrate this in Fig. 9.In the main text we used the compressed notation of the photonic swaps in Fig. 1:.The mirror acts on the internal degrees of freedom in a single photonic path by changing the sign of the internal degrees of freedom.Assume for example three internal modes and a state with n i photons in each internal mode i ∈ {+1, 0, −1}, then the operation which represents the mirror element acts as The mirror can be implemented straight forwardly with the swap operations defined in Fig. 9.In Fig. 10 this is illustrated.The hologram (G) acts on the internal degrees of freedom by increasing them by one.Take for example the state with l, m, n photons in modes −1, 0, 1, then the hologram will act as Simulating optical setups with the cyclic hologram can be performed as long as the number of represented internal degrees of freedom is not restricted too much, meaning that the cutoff has to be carefully chosen in a way that the represented highest internal degree of freedom is never occupied in the underlying setup or at least that its occupation is unlikely.
The circuits we show here assume binary mapping when refined until the qubit level (see Sec. II and Ref. [40]).A generalization to unary and Gray code can be achieved in a straight forward way by permuting the individual gates on the qubit level for the phase shifter and for the beam splitter by mapping the creation/annihilation operators in the same way as described in Ref. [40].The implementation of the swap gate, mirror and hologram will stay the same for all three Neither hologram nor mirror are used explicitly in the computations of this work.They are however important to extend the 332-state preparation setup to prepare a multidimensional GHZ state (see Fig. 2a of Ref. [18]).General elements can be represented in similar ways as the beam splitter by mapping their second-quantized generators onto qubits followed by a decomposition of the generated unitary into sequences of primitive gates.Depending on the element, a customized approach (such as given here for the hologram, mirror and phase shifter) might however lead to more optimized gate sequences for the specific element.
In addition to the implementation of concrete optical elements in a gate-based QComputer, we also indicate in an example how more abstract representations of quantum optics can be mapped to circuits.Here we will use an abstract edge within a generalized graph-based representation of quantum optical setups developed in [45].Those graph representation can, for example, be translated into non-linear crystals that create photon pairs in specific modes (SPDC) or on-chip four-wave mixing processes (SFWM).Consider an edge of Ref. [45] connecting vertices (photonic paths) a and b and having colors (photonic modes) m and n.The generator G that generates the unitary of the edge U (ω) = e −i ω 2 G is With the mappings of [40] this generator can be mapped to Pauli strings and the generated unitary can be decomposed via a Trotter decomposition.One of the proposals in the main text, is to combine those graph based representations with the techniques of this work as the simulation of the graph (currently achieved over explicit series expansion of the unitary, neglecting the hermitian adjoint in the generator) is currently the computational bottleneck of the theseus algorithm developed in [45].
For further illustration, we added an additional example on github [69] that illustrates the optimization of a GHZ state via a small graph based setup within our implementation.

FIG. 1 .
Photon Source FIG.1.Quantum circuits for multi-photonic high-dimensional quantum optics.Optical paths are denoted by a, b, c while internal mode numbers are denoted by subscripts.Here we use the orbital angular momentum of photons as a high dimensional degree of freedom.In general, this approach can be applied to any discrete high dimensional quantum numbers.Each internal mode is represented by several qubits representing the photon occupation number (see Supplementary Information for additional details).(a) Example of a beam splitter used in Fig.3where each internal mode is represented by one qubit.The general multi-photon beam splitter (see Fig.4) is constructed with a Trotter expansion and is too large to show here.(b) Direct emulation of a high-dimensional entangled photon state created by spontaneous parametric down conversion in a nonlinear crystal.(c) Mode dependent phase shifter (Dove prism) implemented as multiple phase shifters acting on the corresponding modes.(d) Mode independent phase shifter where the photonic occupation number is encoded in 3-qubit binary representation (up to 7 photons per mode).(e) Cyclic approximation to a mode shifter (hologram) implemented by swap gates (each swap denotes a swap operation on all the qubits which represent the mode).(f) Mirror implemented by swap gates.

FIG. 3 .
FIG. 3.Optimization of an asymmetric high-dimensional entangled state (a) Abstract representation of the optimization setup.Optical elements are shown in green, blue and yellow and are described in Fig.1.U † p (α, β) transforms a parametrized photonic qutrit to the computational zero-state which acts as a trigger for the three-photon state in paths b, c, d.The encoding E emulates the post-selection by transferring information about the photon number in paths b, c, d to auxiliary qubits P 1 b , P 1 c , P 1 d leading them to be in the zero-state for valid configurations.Similar as the trigger in a, U † Ψ transforms the target state of (7) into the zero-state.The probability of measuring the overall zero-state directly corresponds to the heralded and post-selected fidelity of (5) with the target state Ψ.The setup is parametrized with three angles (one for the Dove prism and two for the trigger).(b-c) Optimization of the setup with the 'BFGS' optimizer.(d) Explicit circuit for the setup in (a).

FIG. 4 .
FIG. 4. Digital quantum simulation of a Boson sampling experiment.(a) In the abstract representation of the setup each path is represented by two qubits (allowing to represent 0-3 photons in each path).The setup consists of beam-splitters (B) and phase shifters (P) and is initialized with three photons in paths a, c and e (|1a0 b 1c0 d 1e ); The bit-flip X gates only operate on one of the two qubits.(b) Percentage of physically valid states -meaning configurations of the simulated wave function obeying photon number conservation and only having three photons in total -as an indicator of the error introduced by the Trotter expansion.(c) Simulated distribution of three photon states with each photon in a separate path.At 10 Trotter steps the error with respect to the exact quantum optical setup is about 2 percent, and consistent with the results presented in [32].

FIG. 6 .
FIG. 6. Beam splitter acting two photonic paths with three internal modes each.6(a) abstract representation.6(b) More detailed representation with individual unitaries acting on the different internal modes

FIG. 7 .
FIG. 7. Phase shifter acting on path a with one internal mode.7(a) abstract representation.7(b) Explicit representation with 3 qubits per mode.

FIG. 8 .
FIG. 8. Mode dependent phase shifter (Dove prism) acting on path a with five internal modes.8(a) abstract representation.8(b) More detailed representation showing the internal modes.For the qubit-wise representation of each phase shifter see Fig.7

7
FIG. 8. Mode dependent phase shifter (Dove prism) acting on path a with five internal modes.8(a) abstract representation.8(b) More detailed representation showing the internal modes.For the qubit-wise representation of each phase shifter see Fig.7

FIG. 9 .
FIG.9.Swap gate between two photonic modes m and n which can be in the same path or in different paths.9(a) abstract representation.9(b) Explicit representation with 3 qubits per mode.

FIG. 10 .
FIG. 10.Mirror acting on internal photonic modes in a given path.10(b) abstract representation.10(b) Explicit representation with photonic swap gates (see Fig. 9) B6)resulting state with no photons in mode -1, l photons in mode 0, m photons in mode 1 and n photons in mode 2 which didn't had any photons before.The action of the hologram is clearly not unitary for a truncated number of internal degrees of freedom.In order to implement its action we propose a cyclic version shown in Fig.11.For internal degrees of freedom from −m to m, this acts as: G|n −m , . . ., n 0 , . . ., n m = |n m , n −m , . . ., n 1 , . . ., n m−1 .(B7)