원시데이터 수집 시스템
선정목록으로

Classical simulation of boson sampling based on graph structure

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. Oh, Changhun
  2. Lim, Youngrong
  3. Fefferman, Bill
  4. Jiang Liang
DOI
10.48550/arxiv.2110.01564
저널
arXiv (Cornell University)
발행년도
2022
발행기관
Cornell University
피인용수
0
라이선스
0
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.48550/arxiv.2110.01564
토픽
Polymer Nanocomposite Synthesis and Irradiation
OpenAlex ID
W6929405581

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Boson sampling is a fundamentally and practically important task that can be used to demonstrate quantum supremacy using noisy intermediate-scale quantum devices. In this work, we present classical sampling algorithms for single-photon and Gaussian input states that take advantage of a graph structure of a linear-optical circuit. The algorithms' complexity grows as so-called treewidth, which is closely related to the connectivity of a given linear-optical circuit. Using the algorithms, we study approximated simulations for local Haar-random linear-optical circuits. For equally spaced initial sources, we show that when the circuit depth is less than the quadratic in the lattice spacing, the efficient simulation is possible with an exponentially small error. Notably, right after this depth, photons start to interfere each other and the algorithms' complexity becomes sub-exponential in the number of sources, implying that there is a sharp transition of its complexity. Finally, when a circuit is sufficiently deep enough for photons to typically propagate to all modes, the complexity becomes exponential as generic sampling algorithms. We numerically implement a likelihood test with a recent Gaussian boson sampling experiment and show that the treewidth-based algorithm with a limited treewidth renders a larger likelihood than the experimental data.

본문 150,266자

본문 펼치기
Classical simulation of boson sampling based on graph structure Changhun Oh, <sup>1,</sup> <sup>_∗_</sup> Youngrong Lim, <sup>2,</sup> <sup>_†_</sup> Bill Fefferman, <sup>3,</sup> <sup>_‡_</sup> and Liang Jiang <sup>1,</sup> <sup>_§_</sup> 1 _Pritzker_ _School_ _of_ _Molecular_ _Engineering,_ _University_ _of_ _Chicago,_ _Chicago,_ _Illinois_ _60637,_ _USA_ 2 _School_ _of_ _Computational_ _Sciences,_ _Korea_ _Institute_ _for_ _Advanced_ _Study,_ _Seoul_ _02455,_ _Korea_ 3 _Department_ _of_ _Computer_ _Science,_ _University_ _of_ _Chicago,_ _Chicago,_ _Illinois_ _60637,_ _USA_ (Dated: February 23, 2022) Boson sampling is a fundamentally and practically important task that can be used to demonstrate quantum supremacy using noisy intermediate-scale quantum devices. In this work, we present classical sampling algorithms for single-photon and Gaussian input states that take advantage of a graph structure of a linear-optical circuit. The algorithms’ complexity grows as so-called treewidth, which is closely related to the connectivity of a given linear-optical circuit. Using the algorithms, we study approximated simulations for local Haar-random linear-optical circuits. For equally spaced initial sources, we show that when the circuit depth is less than the quadratic in the lattice spacing, the efficient simulation is possible with an exponentially small error. Notably, right after this depth, photons start to interfere each other and the algorithms’ complexity becomes sub-exponential in the number of sources, implying that there is a sharp transition of its complexity. Finally, when a circuit is sufficiently deep enough for photons to typically propagate to all modes, the complexity becomes exponential as generic sampling algorithms. We numerically implement a likelihood test with a recent Gaussian boson sampling experiment and show that the treewidth-based algorithm with a limited treewidth renders a larger likelihood than the experimental data. Sampling from the probability distributions of random quantum circuits is one of the problems to demonstrate quantum supremacy using noisy intermediate-scale quantum devices [1–5]. Boson sampling (BS) is one such sampling problem using linear-optical devices believed to be hard to classically simulate under some plausible assumptions [6, 7]. While a scale of experimental BS grows rapidly due to its importance [8–10], classical simulation algorithms taking advantage of current BS experiments’ limitations are still restricted. Photon loss and distinguishability of photons are representative limitations, which have been extensively studied recently and shown to be detrimental to quantum advantages [11– 17]. Another limitation of current experiments is that the number of modes is not sufficiently large to reach a collision-free BS, which may also reduce the complexity of classical simulation [18, 19]. In this Letter, we focus on limited connectivity of a linear-optical circuit. In general, typical global Haarrandom linear-optical circuits’ input and output modes are fully connected, which makes it hard to classically simulate. One possible implementation of global Haarrandom circuits is to prepare local beam-splitter arrays [20], which corresponds to the current BS experiments’ setup. However, a deviation from a global Haar-random unitary is apparent in the recent experiments [8, 9] because either the circuit depth is small or appropriate ensemble of beam splitters are not employed [21]. Hence, there is a chance that the connectivity of the circuit is limited and that sampling from the underlying system may not be as difficult as from a global Haar-random circuit. We propose classical algorithms using dynamical programming [22, 23] taking advantage of a given circuit’s limited connectivity for single-photon BS (SPBS) and Gaussian BS (GBS) [6, 7]. Particularly, our algorithms’ complexity depends on connectivity of a relevant matrix’s graph structure, characterized by the so-called treewidth [24]. Since the algorithms’ complexity grows as the treewidth instead of the system size, we may be able to sample from some linear-optical circuits of a limited treewidth faster than generic classical algorithms. By applying our algorithm to local beam-splitter circuits, we analyze how the algorithms’ complexity grows as a circuit depth and reveal a hierarchy of the complexity depending on the depth, namely, polynomial, sub-exponential, and exponential regimes. _Boson_ _sampling.—_ Consider an _M_ -mode bosonic system consisting of beam-splitter arrays characterized by a unitary matrix _U_ with _N_ identical sources. Specifically, the unitary matrix _U_ represents the transformation of mode operators _{a_ ˆ _j}j_ <sup>_M_</sup> =1 <sup>as</sup> <sup>_a_</sup> <sup>ˆ</sup> <sup>_†_</sup> _j_ <sup>_→_</sup> <sup>_U_</sup> <sup>ˆ</sup> <sup>_†a_</sup> <sup>ˆ</sup> <sup>_†_</sup> _k_ =1 <sup>_Ujka_</sup> <sup>ˆ</sup> _k_ <sup>_†_</sup> _j_ <sup>_U_</sup> <sup>ˆ</sup> <sup>=</sup> <sup>�</sup> <sup>_M_</sup> where the sum is over all permutations _σ_ . Here, _U_ _r_ <sup>_S_</sup> <sup>is</sup> an _N_ _× N_ matrix obtained by choosing _S_ columns and _r_ rows, and Per( _U_ ) is the permanent of matrix _U_, which is related to counting bipartite perfect matchings in the _j_ <sup>_M_</sup> =1 <sup>as</sup> <sup>_a_</sup> <sup>ˆ</sup> <sup>_†_</sup> _j_ <sup>_†_</sup> _j_ <sup>_→_</sup> <sup>_U_</sup> <sup>ˆ</sup> <sup>_†a_</sup> <sup>ˆ</sup> <sup>_†_</sup> <sup>_†_</sup> _k_ Let _S_ _≡{s_ identical _j_ <sup>_U_</sup> <sup>ˆ</sup> <sup>=</sup> <sup>�</sup> <sup>_M_</sup> _k_ =1 <sup>_Ujka_</sup> <sup>ˆ</sup> _k_ <sup>_†_</sup> _k_ mode operators _{a_ ˆ _j}_ <sup>_M_</sup> _j_ <sup>_→_</sup> <sup>_U_</sup> <sup>ˆ</sup> <sup>_†a_</sup> <sup>ˆ</sup> <sup>_†_</sup> for[ _M_ ]abegiventhe beamset of splitterinput modescircuitfor _U_ <sup>ˆ</sup> .identicalLet _j_ <sup>_U_</sup> <sup>ˆ</sup> _S_ <sup>=</sup> _≡{_ <sup>�</sup> sources. <sup>_M_</sup> _si}_ <sup>_N_</sup> _i_ =1 <sup>_⊂_</sup> If for[ _M_ ]abegiventhe beamset of splitterinput modescircuitfor _U_ <sup>ˆ</sup> .identicalLet _S_ _≡{_ sources. _si}_ <sup>_N_</sup> _i_ =1 <sup>_⊂_</sup> If we measure an output state _ρ_ ˆ after beam splitters with the photon number basis _m_ ˆ = _⊗_ <sup>_M_</sup> _j_ =1 <sup>_|mj⟩⟨mj|_</sup> <sup>,</sup> <sup>the</sup> <sup>prob-</sup> the photon number basis _m_ ˆ = _⊗_ <sup>_M_</sup> _j_ =1 <sup>_|mj⟩⟨mj|_</sup> <sup>,</sup> <sup>the</sup> <sup>prob-</sup> ability of an outcome _m_ = ( _m_ 1 _, ..., mM_ ) is given by _P_ ( _m_ ) = Tr(ˆ _ρ_ _m_ ˆ ). For simplicity, we define an equivalent description of the output as _r_ = ( _r_ 1 _, . . ., rN_ ), where _ri_ ’s represent modes that click. For single-photon state input, the probability is written as [6] 2 _N_ _i_ =1 _<u>r</u>_ _P_ ( _m_ ) = <sup>_<u>|</u>_</sup> <sup><u>Per(</u></sup> _m_ <sup>_<u>U</u>_</sup> ! <sup>_<u>S</u>_</sup> _<u>r</u>_ <sup>_<u>S</u>_</sup> <sup><u>)</u></sup> <sup>_<u>|</u>_</sup> <sup>2</sup> _Uri,sσ_ ( _i_ ) <u>1</u> _<u>r</u>_ <sup><u>)</u></sup> <sup>_<u>|</u>_</sup> <sup>2</sup> = _m_ <sup>_<u>U</u>_</sup> ! <sup>_<u>S</u>_</sup> _m_ ! ����� _σ_ ����� _,_ (1) where the sum is over all permutations _σ_ . Here, _U_ _r_ <sup>_S_</sup> (a) Input (b) C AEF ACF ABEF BDF D Output B A E Tree decomposition F FIG. 1. (a) Input (red dots) and output (blue dots) photon configuration, corresponding bipartite and symmetric graphs and their tree decompositions of width _w_ = 2. (b) Graph and its possible tree decomposition of width _w_ = 3. corresponding graph [25]. Meanwhile, for a squeezed vacuum state input, the probability of an outcome _m_ is given by [7] _P_ ( _m_ ) = _<u>|</u>_ <u>Haf(</u> _<u>B</u>_ _<u>m</u>_ <u>)</u> _<u>|</u>_ <sup>2</sup> _<u>|</u>_ <u>Haf(</u> _<u>B</u>_ _<u>m</u>_ <u>)</u> _<u>|</u>_ <sup>2</sup> det( _V_ + 1 _/_ 2) obtained ~~�~~ by repeating loop hafnian is generalized hafnian, related to counting perfect matchings including loops [27, 28], which is necessary for the sampling algorithm below. The complexity of the best-known algorithms computing the permanent and loop hafnian of a general _N_ _× N_ matrix scales as 2 <sup>_N_</sup> and 2 <sup>_N/_</sup> <sup>2</sup>, respectively [29, 30]. Meanwhile, there are also various algorithms exploiting a matrix’s structures [27, 31, 32]. A particularly interesting algorithm is dynamical programming that computes permanent [23]. A high-level idea of the algorithm is to construct tree decomposition of bipartite graph for a given matrix, which reveals the matrix’s structure (see Fig. 1). The algorithm’s complexity grows as so-called treewidth, which measures connectivity by exploiting the treelike structure of the graph [22]. We generalize the treewidth-based algorithm to loop hafnian by using tree decompositions for a given symmetric matrix and present the following lemma, including the result in Ref. [23] as: Lemma 1. If the treewidth of a graph representation of an _N ×_ _N_ matrix is _w_, then dynamical programming can compute its permanent and loop hafnian in _O_ ( _Nw_ <sup>2</sup> 2 <sup>_w_</sup> ). We provide the proofs of Lemmas and Theorems in Ref. [33]. Notably, Lemma 1 shows that the complexity’s exponent does not scale as the matrix size _N_ but the treewidth _w_ . Therefore, for some structured matrices, the complexity of computing their permanent or loop hafnian can be highly reduced. For example, a forest, i.e., disjoint union of trees, has treewidth 1 [34], so the complexity does not grow exponentially as matrix size. On the other hand, a complete graph, whose vertices are all connected, has the treewidth _N_ _−_ 1 ( _N_ for bipartite complete graph) [34]. Note that we recover the same exponent of the algorithm for a general matrix, i.e., 2 <sup>_N_</sup>, for permanent whereas it has a gap for loop hafnian (2 <sup>_N/_</sup> <sup>2</sup> for general loop hafnian) [27, 30]. _Classical sampling algorithms based on treewidth.—_ We now introduce classical sampling algorithms of SPBS and GBS using limited connectivity. Although we have algorithms computing permanent or loop hafnian using a given graph’s structure, how to use such algorithms for sampling is not clear. Remarkably, we show that if we employ as a main routine chain rule of marginal probabilities, such as the Clifford-Clifford algorithm [35] for SPBS, and a recently proposed GBS algorithm [36], and use our dynamical programming to compute permanent or loop hafnian as a subroutine, we can fully utilize the graph structure of a given circuit including computing marginal probabilities [33]. For simplicity, we focus on collision-free events, i.e., _mi_ = _{_ 0 _,_ 1 _}_, while we provide algorithms for collisions in Ref. [33]. Theorem 1. (Classical sampling algorithm) If the treewidths of bipartite graphs of _U_ _r_ <sup>_S_</sup> <sup>are</sup> <sup>at</sup> <sup>most</sup> <sup>_w_</sup> <sup>for</sup> all possible outcome _r_, we can classically simulate SPBS in _O_ ( _MN_ <sup>2</sup> _w_ <sup>2</sup> 2 <sup>_w_</sup> ). Similarly, if symmetric graphs of _B_ _m_ _m_ ! _,_ (2) where _B_ _m_ is a matrix obtained by repeating _i_ th column and row of _B_ _≡_ _UDU_ <sup>T</sup> for _mi_ times, and Haf( _B_ _m_ ) is the hafnian of matrix _B_ _m_, which is related to counting perfect matchings in the corresponding graph [26]. Here, _D_ _≡⊕j_ <sup>_M_</sup> =1 <sup>tanh</sup> <sup>_rj_</sup> <sup>, and</sup> <sup>_V_</sup> <sup>is the output state’s the covari-</sup> _D_ _≡⊕j_ <sup>_M_</sup> =1 <sup>tanh</sup> <sup>_rj_</sup> <sup>, and</sup> <sup>_V_</sup> <sup>is the output state’s the covari-</sup> ance matrix. Squeezing parameters are given by _rj_ = _r_ for _j_ _∈S_, and _rj_ = 0 otherwise. Let us clarify the relation between graphs and BS (see Fig. 1 (a)). To compute the (marginal) probability for an outcome, we consider all possible paths from input photons to the output configuration, which essentially corresponds to interference. They can be described by all perfect matchings of a bipartite graph of _U_ _r_ <sup>_S_</sup> <sup>with</sup> <sup>the</sup> all perfect matchings of a bipartite graph of _U_ _r_ <sup>_S_</sup> <sup>with</sup> <sup>the</sup> input modes _S_ and output modes _r_ being bipartite vertex sets and the paths between them being edges for SPBS. For GBS, vertices of a symmetric graph of _B_ _m_ consist of an output-photon configuration, and two vertices have an edge if the two photons can come from the same source. To compute a probability in this case, we consider all possible perfect matchings of output photons, which corresponds to finding sources from which each pair of photons come. From this observation, when a given unitary matrix’s connectivity is limited, we can expect that the number of possible perfect matchings for each outcome is small so that the induced graphs’ structure allows to reduce the complexity. _Computing_ _permanent_ _and_ _loop_ _hafnian_ _using_ _dynam-_ _ical_ _programming.—_ Before presenting sampling algorithms, we first introduce classical algorithms computing the permanent and loop hafnian of a matrix. Here, have the treewidths at most _w_ for all outcomes _m_, we can classically simulate GBS in _O_ ( _MNw_ <sup>2</sup> 2 <sup>_w_</sup> ). Theorem 1 enables us to recover and generalize some previously known results. One such example is efficient simulability of shallow 1D GBS, i.e., depth _D_ = _O_ (log _M_ ) by using limited bandwidth of the circuit’s unitary matrix [37, 38]. Since bandwidth is a special case of treewidth, we recover the result and also find that the result holds for 1D SPBS. For 2D cases, however, even for a constant depth, we encounter with an output described by a graph including _√N_ _×_ _√N_ grid, whose treewidth is _w_ = _√N_ [33, 39]. This is consistent with the recent hardness result of high-dimensional GBS [40]. _Approximate_ _sampling.—_ When an approximation of a given circuit has limited connectivity, we can expect that an approximate sampling is possible using this structure. However, it is not straightforward to apply the same method if we approximate the circuit matrix by a nonunitary matrix because the corresponding process or the output state may no longer be physical. Also, the chain-rule-based algorithms implicitly assume unitarity of the process or a legitimate quantum state. We present a method to overcome this by introducing additional virtual _M_ modes to make the process physical again and investigate its approximation error in Ref. [33]: _N_ _×_ _√_ _√_ _√_ Theorem 2. (Approximate sampling) If a circuit unitary matrix _U_ is approximated by _U −dU_, one can implement sampling with the same complexity up to constant as Theorem 1 with an error of poly( _N, ∥dU_ _∥F_ <sup>1</sup> <sup>_/_</sup> <sup>4).</sup> We assess a simulation’s error by total variation dis ity distribution _m_ <sup>_|P_</sup> <sup>(</sup> <sup>_m_</sup> _P_ <sup>)</sup> ( <sup>_−_</sup> _m_ <sup>_P_</sup> ) <sup>_a_</sup> <sup>(</sup> and <sup>_m_</sup> <sup>)</sup> <sup>_|_</sup> a <sup>_/_</sup> <sup>2 between an ideal probabil-</sup> classical algorithm’s output probabilitytance <sup>�</sup> distribution _Pa_ ( _m_ ) and desire an approximation error to be _O_ (1 _/_ poly( _N_ )). In the following section, we study an experimentally relevant physical model, which is local Haar-random circuits. Since a current GBS experiment does not employ a specialized ensemble to implement a global Haar-random circuit [9], its setup can be considered as a typical instance of the model. Also, it can be interpreted as an extreme case where beam splitters’ reflectivities have a large uncertainty. We emphasize that our approximation method in Theorem 2 is straightforwardly applicable to similar dynamics (e.g. Ref. [41]). _Approximate_ _sampling_ _for_ _local_ _Haar-random_ _circuits.—_ Consider _N_ identical sources equally distributed in _M_ = _kN_ <sup>_γ_</sup> modes of a _d_ -dimensional lattice [42] and local Haar-random beam-splitter arrays, as illustrated in Fig. 2. The lattice consists of _d_ -cube sublattices of edge length _L_ = ( _M/N_ ) <sup>1</sup> <sup>_/d_</sup>, containing a single source. For simplicity, let _L_ be a positive integer. As recently studied, random beam-splitter arrays can be characterized by a classical random walk [43]. Therefore, photons propagate diffusively on average. Using this property, we find an upper-bound on the leakage (a) (b) (c) (d) (1) (2) (3) (4) FIG. 2. Initial state in (a) 1D and (c) 2D architectures. Red dots represent sources. _Lα_ represents a sublattice having a single source _sα_ . Beam-splitter arrays in (b) 1D and (d) 2D architecture. A single round consists of four steps (1)-(4). The structure can be generalized for _d_ -dimensional architecture, where a single round consists of 2 _d_ steps. rate from a source at _sα_ up to _κL_ denoted as _ηα_ ( _κ_ ) _≡_ more _j_ <sup>_|U_</sup> than <sup>_j,s_</sup> _α_ <sup>_|_</sup> <sup>2,</sup> _κL_ <sup>where</sup> : <sup>_j_</sup> <sup>is</sup> <sup>the</sup> <sup>sum</sup> <sup>over</sup> <sup>modes</sup> <sup>away</sup> <sup>from</sup> <sup>_α_</sup> Lemma 2. For depth _D_ _≤_ _dk_ <sup>2</sup> <sup>_/d_</sup> _κ_ <sup>2</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/d−ϵ_</sup> _/_ 2 with _ϵ >_ 0, the leakage rate _ηα_ to distance _κL_ is bounded from above as _ηα_ ( _κ_ ) _≤_ exp( _−N_ <sup>_ϵ_</sup> ) (3) with a probability 1 _−_ _δ_ over Haar-random beam-splitter arrays, where _δ_ is exponentially small in _N_ . ment Theorem 2. Since _∥dU_ _∥_ <sup>2</sup> _α∈S_ <sup>_ηα_</sup> <sup>(</sup> <sup>_κ_</sup> <sup>)</sup> <sup>is</sup> <sup>expo-</sup> nentially small, the sampling error is too. From now on, we focus on typical circuits, emphasizing that the portion _F_ <sup>=</sup> <sup>�</sup> of atypical circuits is exponentially small. Consider a special case ( _κ_ = 1 _/_ 2) where interference between photons from different sources is negligible typically. In this case, for SPBS, possible outputs can be described by a disconnected graph, in which at most two vertices are connected; thus, the treewidth is 1. For GBS, assuming that a single source emits constant number of photons at most, graphs describing possible outcomes are again disconnected with constant number of vertices and have bounded treewidth. One may also show that sampling for this regime is easy by noting that the hafnian of a low-rank matrix can be efficiently computed without the assumption [27]. Thus, For later usage for _d_ = 1, we note that the same inequality holds for _D_ _≤_ _k_ <sup>2</sup> _κ_ <sup>2</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_−ϵ_</sup> (log _N_ ) <sup>2</sup> _/_ 2 for leakage rate to distance _κL_ log _N_ . Motivated by Lemma 2, our approximate sampling strategy is to discard the elements of a unitary matrix that are geometrically farther from sources than _κL_, i.e., _U_ _→_ _U_ <sup>˜</sup> _≡_ _U_ _−_ _dU_ and implement Theorem 2. Since _∥dU_ _∥_ <sup>2</sup> _α∈S_ <sup>_ηα_</sup> <sup>(</sup> <sup>_κ_</sup> <sup>)</sup> <sup>is</sup> <sup>expo-</sup> nentially small, the sampling error is too. From now on, _F_ <sup>=</sup> <sup>�</sup> _U_ <sup>˜</sup> _≡_ <sup>2</sup> error is _F_ <sup>=</sup> <sup>�</sup> (a) (b) FIG. 3. GBS on 2D lattice with _N_ = 36, _M_ = _N_ <sup>2</sup>, and _γ_ = 2. (a) Red dots represent initial sources. Black solid line describes the region at which a particular input photon can typically propagate for _D_ = Θ( _L_ <sup>2(1</sup> <sup>_−ϵ_</sup> <sup>)</sup> ) = Θ( _N_ <sup>1</sup> <sup>_−ϵ_</sup> ). (b) Possible tree decomposition of the symmetric graph _B_ _m_ when outputs are at the same position bound on the treewidth is Θ( _~~√~~_ <u>wit</u> _N_ )h input sources.as shown: the An upperfirst bag (blue) and the second one (yellow). Easy for any circuits* Easy for typical circuits (Complete graph) Theorem 3. (Efficient-sampling regime) Approximate BS can be efficiently performed for typical circuits of depth _D_ _≤_ _D_ easy _≡_ _dk_ <sup>2</sup> <sup>_/d_</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/d−ϵ_</sup> _/_ 8 = Θ( _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/d−ϵ_</sup> ) . Especially for _d_ = 1, the upper bound becomes _D_ _≤_ _k_ <sup>2</sup> _κ_ <sup>2</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_−ϵ_</sup> (log _N_ ) <sup>2</sup> _/_ 2. We note that the distinct upper-bound for 1D arises because the treewidth _O_ (log _N_ ) can be efficiently simulated. After _D_ _>_ _D_ easy (or _κ_ _>_ 1 _/_ 2), photons from a sublattice can now propagate to other lattices so that photons from different sources start to interfere (see Fig. 3 (a)). Thus, induced graphs have edges between sources and photons from different sublattices (SPBS) or photons from different sources (GBS) as shown in Fig. 3 (b). In this case for 2D architecture, there exists an outcome corresponding to a graph containing a grid whose treewidth is unbounded, i.e., _w_ = _√N_ . Therefore, the sampling complexity starts to scale exponentially in _√N_ [33], which reveals a sharp transition of the complexity at _D_ = _D_ easy from polynomial to sub-exponential. Similarly, when photons propagate further and for arbitrary dimension, i.e., _D_ = Θ( _N_ <sup>2</sup> <sup>_α/d_</sup> _D_ easy) with 0 _≤_ _α_ _≤_ 1 (equivalently _κ_ = Θ( _N_ <sup>_α/d_</sup> )), we can find a tree decomposition whose width is Θ( _N_ _<u>αd</u>_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> ) for any outcomes. _√_ s _√_ _<u>αd</u>_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> position whose width is Θ( _N_ _<u>αd</u>_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> ) for any outcomes. Therefore, we have the following theorem: Theorem 4. ((sub-)exponential regime) One can sample from typical linear-optical circuits of _D_ = Θ( _N_ <sup>2</sup> <sup>_α/d_</sup> _D_ easy) with 0 _α_ 1 by complexity _<u>α</u>_ _≤_ _≤_ _d_ <sup>+</sup> <sup>_<u>d−</u>_</sup> <sup><u>1</u></sup> _O_ (poly( _N_ )2 <sup>Θ(</sup> <sup>_N_</sup> _<u>αd</u>_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> _d_ <sup><u>1</u></sup> )). Especially when _α_ = 1, any photons can propagate to all modes, i.e., photons fully interfere each other, which forms the complete graph for all outcomes, so that treewidth becomes Θ( _N_ ). Since generic global Haarrandom circuits are fully connected, at least Θ( _N_ <sup>2</sup> <sup>_γ/d_</sup> ) = Θ( _M_ <sup>2</sup> <sup>_/d_</sup> ) order of depth is required to implement a global Haar-random circuit using a local Haar-random circuit FIG. 4. The complexity diagram for local Haar-random BS. As the star-marked, a sharp transition occurs for the complexity of our algorithm. Easiness for any circuits (*) is proved in Ref. [41]. Note that for 1D, the depth that is easy for typical circuits is larger (see Theorem 3). and such an input configuration. Fig. 4 summarizes the result. Interestingly, <u>the</u> recent GBS experiments’ circuit depth scales as _√M_ [9, 10], which implies that their cir cuit is not sufficient to form a global Haar-random circuit. Nevertheless, aside from the deviation from global Haarrandom matrices, locality in their circuit is not apparent because the scale is intermediate while our analysis focuses on an asymptotic regime. Therefore, our approximate algorithm might result in a large simulation error for this intermediate-scale GBS because of a large constant factor of the error. One may also consider other initial configurations under local Haar-random circuits, for example sources are concentrated on a certain region. We show that for those cases, one already needs a depth _D_ = Θ( _ND_ easy) to reach collision-free regime, and thus collision occurs with a high probability, while equally spaced sources reach the collision-free regime when _D_ = Θ( _D_ easy) [33]. _GBS_ _validation_ _test.—_ Finally, we implement the likelihood test to experimental samples [10] against samples generated by our treewidth-based approximate algorithm: <u>Prideal(Samples</u> <u>from</u> <u>experiment)</u> ratio _≡_ log Prideal(Samples from treewidth algorithm) <sup>_,_</sup> (4) which is equivalent to the test implemented in Refs. [9, 10]. Thus, we compare the likelihood of each sample set with respect to the (lossy) ideal probability distribution. For the treewidth algorithm, we have approximated local Haar-random with limited propagation (see Fig. 5 (a)) and sampled from the approximated circuit using Theorem 2. Specifically, we have rearranged the 144 modes one-dimensionally and set a propagation length _K_ for approximation. Note that setting a propagation length _K_ implies that the corresponding GBS’s treewidth is _w_ = 2 _K_ +1 and that a complete graph has a treewidth _w_ = _M_ . To compensate the lost photons from the approximation, we have increased the squeezing parameters and thermal photons to have the same average total photon numbers. In Fig. 5 (b), we present the likelihood ratio as the ###### (a) (b) 0 500 1000 1500 2000 2500 3000 K = 50 P = 0.3W K = 3 M = 144, N = 50 20 104 20 0 - 2000 - 4000 - 6000 - 8000 - 10000 K = 50 <u>P = 0.6W</u> 0 40000 80000 0 1000 2000 3000 4000 5000 6000 The number of samples FIG. 5. Likelihood test for the recent GBS experiment [10]. (a) Rearranged mode-configuration with squeezed states sources (red dots). For approximated sampling, we discard elements of a circuit matrix _U_ that is farther than _K_ for the sources. (b) Log-likelihood ratio of experimental samples against those from the treewidth algorithm. number of samples increases for two classically verifiable instances of the experiments in Ref. [10]. It clearly shows that the treewidth-based approximate algorithm renders larger likelihood than the experiment. We also provide evidence in Ref. [33] for GBS experiments in the quantum supremacy regime by investigating the likelihood ratio for marginals that the treewidth-based algorithm might give a larger likelihood with a limited treewidth. Therefore, the numerical results imply that a fully connected circuit is crucial for more rigorous quantum-advantage demonstration. _Discussion.—_ We have presented classical samplers taking advantage of limited connectivity of a circuit. It is an interesting open question to find more efficient sampling algorithms than the one based on the treewidth. Another open problem is to close the gap of complexity for computing loop hafnian between the treewidthbased algorithm (2 <sup>_N_</sup> ) and the best-known algorithm (2 <sup>_N/_</sup> <sup>2</sup> ) [36]. Finally, Theorem 3 shows that typical linear-optical circuits up to depth _D_ _≤_ _D_ easy = Θ( _N_ _d_ <u>2</u> <sup>(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_−ϵ_</sup> ) al circuits up to depth _D_ _≤_ _D_ easy = Θ( _N_ _d_ <u>2</u> <sup>(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_−ϵ_</sup> ) al low an efficient classical simulation except for an exponentially small fraction of random circuits. Meanwhile, there exists a circuit hard to classically simulate for _D_ = Ω( _N_ _<u>γ−d</u>_ <u>1</u> + _ϵ_ ) under reasonable complexity-theoretic _<u>γ−d</u>_ <u>1</u> _D_ = Ω( _N_ _<u>γ−d</u>_ <u>1</u> + _ϵ_ ) under reasonable complexity-theoretic conjectures [6, 41, 44]. Theorem 3 can be compatible with the hardness results since together the implication is that the worst-case instances occupy only at most an exponentially small faction of the space of all linear optical circuits. We thank Owen Howell, Alireza Seif, Roozbeh Bassirian, Abhinav Deshpande for interesting and fruitful discussions. C.O. and L.J. acknowledge support from the ARL-CDQI (W911NF-15-2-0067), ARO (W911NF-18-10020, W911NF-18-1-0212), ARO MURI (W911NF-161-0349), AFOSR MURI (FA9550-15-1-0015, FA9550-191-0399), DOE (DE-SC0019406), NSF (EFMA-1640959, OMA-1936118), and the Packard Foundation (201339273). Y. L. acknowledges National Research Foundation of Korea a grant funded by the Ministry of Science and ICT (NRF-2020M3E4A1077861) and KIAS Individual Grant (CG073301) at Korea Institute for Advanced Study. B.F. acknowledges support from AFOSR (YIP number FA9550-18-1-0148 and FA9550-21-1-0008). This material is based upon work partially supported by the National Science Foundation under Grant CCF2044923 (CAREER). We also acknowledge the University of Chicago’s Research Computing Center for their support of this work. We acknowledge The Walrus python library for the open source of Gaussian boson sampling algorithms [45] _∗_ changhun@uchicago.edu _†_ sshaep@kias.re.kr _‡_ wjf@uchicago.edu _§_ liang.jiang@uchicago.edu [1] M. J. Bremner, R. Jozsa, and D. J. Shepherd, Classical simulation of commuting quantum computations implies collapse of the polynomial hierarchy, Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 467, 459 (2011). [2] B. Fefferman and C. Umans, The power of quan tum Fourier sampling, arXiv preprint arXiv:1507.05592 (2015). [3] S. Boixo, S. V. Isakov, V. N. Smelyanskiy, R. Babbush, N. Ding, Z. Jiang, M. J. Bremner, J. M. Martinis, and H. Neven, Characterizing quantum supremacy in nearterm devices, Nat. Phys. 14, 595 (2018). [4] J. Preskill, Quantum computing in the NISQ era and beyond, Quantum 2, 78 (2018). [5] F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, R. Biswas, S. Boixo, F. G. S. L. Brandao, D. A. Buell, _et_ _al._, Quantum supremacy using a programmable superconducting processor, Nature 574, 505 (2019). [6] S. Aaronson and A. Arkhipov, The computational com plexity of linear optics, in _Proceedings_ _of_ _the_ _forty-third_ _annual_ _ACM_ _symposium_ _on_ _Theory_ _of_ _computing_ (2011) pp. 333–342. [7] C. S. Hamilton, R. Kruse, L. Sansoni, S. Barkhofen, C. Silberhorn, and I. Jex, Gaussian boson sampling, Phys. Rev. Lett. 119, 170501 (2017). [8] H.-S. Zhong, L.-C. Peng, Y. Li, Y. Hu, W. Li, J. Qin, D. Wu, W. Zhang, H. Li, L. Zhang, Z. Wang, L. You, X. Jiang, L. Li, N.-L. Liu, J. P. Dowling, C.-Y. Lu, and J.W. Pan, Experimental Gaussian boson sampling, Science Bulletin 64, 511 (2019). [9] H.-S. Zhong, H. Wang, Y.-H. Deng, M.-C. Chen, L.-C. Peng, Y.-H. Luo, J. Qin, D. Wu, X. Ding, Y. Hu, _et_ _al._, Quantum computational advantage using photons, Science 370, 1460 (2020). [10] H.-S. Zhong, Y.-H. Deng, J. Qin, H. Wang, M.-C. Chen, L.-C. Peng, Y.-H. Luo, D. Wu, S.-Q. Gong, H. Su, _et_ _al._, Phase-programmable Gaussian boson sampling using stimulated squeezed light, Physical review letters 127, 180502 (2021). [11] S. Aaronson and D. J. Brod, Bosonsampling with lost photons, Phys. Rev. A 93, 012335 (2016). [12] M. Oszmaniec and D. J. Brod, Classical simulation of photonic linear optics with lost particles, New J. Phys. 20, 092002 (2018). [13] R. Garc´ıa-Patr´on, J. J. Renema, and V. Shchesnovich, Simulating boson sampling in lossy architectures, Quantum 3, 169 (2019). [14] J. Renema, V. Shchesnovich, and R. Garcia-Patron, Clas sical simulability of noisy boson sampling, arXiv preprint arXiv:1809.01953 (2018). [15] A. E. Moylett, R. Garc´ıa-Patr´on, J. J. Renema, and P. S. Turner, Classically simulating near-term partiallydistinguishable and lossy boson sampling, Quantum Science and Technology 5, 015001 (2019). [16] H. Qi, D. J. Brod, N. Quesada, and R. Garc´ıa-Patr´on, Regimes of classical simulability for noisy Gaussian boson sampling, Phys. Rev. Lett. 124, 100502 (2020). [17] C. Oh, K. Noh, B. Fefferman, and L. Jiang, Classical simulation of lossy boson sampling using matrix product operators, Phys. Rev. A 104, 022407 (2021). [18] P. Clifford and R. Clifford, Faster classical boson sam pling, arXiv preprint arXiv:2005.04214 (2020). [19] J. F. Bulmer, B. A. Bell, R. S. Chadwick, A. E. Jones, D. Moise, A. Rigazzi, J. Thorbecke, U.-U. Haus, T. Van Vaerenbergh, R. B. Patel, _et_ _al._, The boundary for quantum advantage in Gaussian boson sampling, Science Advances 8, eabl9236 (2021). [20] J. Emerson, E. Livine, and S. Lloyd, Convergence con ditions for random quantum circuits, Phys. Rev. A 72, 060302 (2005). [21] N. J. Russell, L. Chakhmakhchyan, J. L. O’Brien, and A. Laing, Direct dialling of Haar random unitary matrices, New J. Phys. 19, 033007 (2017). [22] H. L. Bodlaender and A. M. Koster, Combinatorial opti mization on graphs of bounded treewidth, The Computer Journal 51, 255 (2008). [23] D. Cifuentes and P. A. Parrilo, An efficient tree decompo sition method for permanents and mixed discriminants, Linear Algebra and its Applications 493, 45 (2016). [24] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, _Introduction_ _to_ _algorithms_ (MIT press, 2009). [25] L. Lov´asz and M. D. Plummer, _Matching_ _theory_, Vol. 367 (American Mathematical Soc., 2009). [26] A. Barvinok, _Combinatorics_ _and_ _complexity_ _of_ _partition_ _functions_, Vol. 9 (Springer, 2016). [27] A. Bj¨orklund, B. Gupt, and N. Quesada, A faster hafnian formula for complex matrices and its benchmarking on a supercomputer, Journal of Experimental Algorithmics (JEA) 24, 1 (2019). [28] A matrix for which we compute hafnian or loop hafnian is implicitly assumed to be symmetric. [29] H. J. Ryser, _Combinatorial_ _mathematics_, Vol. 14 (Amer ican Mathematical Soc., 1963). [30] A. Bj¨orklund, Counting perfect matchings as fast as ryser, in _Proceedings_ _of_ _the_ _twenty-third_ _annual_ _ACM-_ _SIAM_ _symposium_ _on_ _Discrete_ _Algorithms_ (SIAM, 2012) pp. 914–921. [31] A. I. Barvinok, Two algorithmic results for the traveling salesman problem, Mathematics of Operations Research 21, 65 (1996). [32] M. Schwartz, Efficiently computing the permanent and hafnian of some banded Toeplitz matrices, Linear Algebra Its Appl. 430, 1364 (2009). [33] Supplementary material. [34] F. Harary, _Graph_ _theory_ (CRC Press, 2018). [35] P. Clifford and R. Clifford, The classical complexity of bo son sampling, in _Proceedings of the Twenty-Ninth Annual_ _ACM-SIAM_ _Symposium_ _on_ _Discrete_ _Algorithms_ (SIAM, 2018) pp. 146–155. [36] N. Quesada, R. S. Chadwick, B. A. Bell, J. M. Arrazola, T. Vincent, H. Qi, R. Garc´ıa, _et_ _al._, Quadratic speed-up for simulating Gaussian boson sampling, PRX Quantum 3, 010306 (2022). [37] For a given matrix _a_, the bandwidth is the smallest _k_ such that _aij_ = 0 for all _i, j_ such that _|i −_ _j| > k_ . [38] H. Qi, D. Cifuentes, K. Br´adler, R. Israel, T. Kala jdzievski, and N. Quesada, Efficient sampling from shallow Gaussian quantum-optical circuits with local interactions, arXiv preprint arXiv:2009.11824 (2020). [39] R. Diestel, Graph theory 3rd ed, Graduate texts in math ematics 173 (2005). [40] A. Deshpande, A. Mehta, T. Vincent, N. Quesada, M. Hinsche, M. Ioannou, L. Madsen, J. Lavoie, H. Qi, J. Eisert, D. Hangleiter, B. Fefferman, and I. Dhand, Quantum computational advantage via high-dimensional Gaussian boson sampling, Science Advances 8, eabi7894 (2022). [41] A. Deshpande, B. Fefferman, M. C. Tran, M. Foss-Feig, and A. V. Gorshkov, Dynamical phase transitions in sampling complexity, Phys. Rev. Lett. 121, 030501 (2018). [42] Our main results are valid even if initial sources are not equally distributed but separated by a minimum distance of Θ( _L_ ) from each other. [43] B. Zhang and Q. Zhuang, Entanglement formation in continuous-variable random quantum networks, npj Quantum Information 7, 33 (2021). [44] N. Maskara, A. Deshpande, A. Ehrenberg, M. C. Tran, B. Fefferman, and A. V. Gorshkov, Complexity phase diagram for interacting and long-range bosonic hamiltonians, arXiv preprint arXiv:1906.04178 (2019). [45] B. Gupt, J. Izaac, and N. Quesada, The walrus: a library for the calculation of hafnians, hermite polynomials and Gaussian boson sampling, Journal of Open Source Software 4, 1705 (2019). Classical simulation of boson sampling based on graph structure : Supplemental Material Changhun Oh, <sup>1</sup> Youngrong Lim, <sup>2</sup> Bill Fefferman, <sup>3</sup> and Liang Jiang <sup>1</sup> 1 _Pritzker_ _School_ _of_ _Molecular_ _Engineering,_ _University_ _of_ _Chicago,_ _Chicago,_ _Illinois_ _60637,_ _USA_ 2 _School_ _of_ _Computational_ _Sciences,_ _Korea_ _Institute_ _for_ _Advanced_ _Study,_ _Seoul_ _02455,_ _Korea_ 3 _Department_ _of_ _Computer_ _Science,_ _University_ _of_ _Chicago,_ _Chicago,_ _Illinois_ _60637,_ _USA_ (Dated: February 23, 2022) CONTENTS S1. Dynamical Programming Algorithm (Proof of Lemma 1) 2 A. Dynamical Programming Algorithm (permanent) 2 1. Tree decomposition of a bipartite graph 2 2. Collision-free cases 2 3. Collision events 4 B. Dynamical Programming Algorithm (loop hafnian) 6 1. Tree decomposition of a symmetric graph 6 2. Collision-free cases 7 3. Collision events 8 S2. Sampling algorithms 10 A. Clifford-Clifford algorithm (single-photon boson sampling) 10 B. Gaussian boson sampling classical algorithm 11 C. Proof of Theorem 1 13 S3. Error of photon-number truncation 13 S4. Approximation method 13 A. Approximation of a unitary matrix 13 B. Single-photon state approximation 14 C. Gaussian state approximation 14 D. Proof of Theorem 2 15 S5. Diffusive dynamics of random beam-splitter arrays 16 A. Classical random walk behavior of random beam-splitter arrays 16 B. Proof of Lemma 2 16 S6. Proof of Theorem 3 17 S7. Constant-depth 2D circuit 17 S8. Upper bound on the treewidth of induced graphs (Proof of Theorem 4) 18 S9. Other initial configuration for boson sampling using local Haar-random beam splitters 19 S10. Numerical method for Likelihood test 20 References 21 S1. DYNAMICAL PROGRAMMING ALGORITHM (PROOF OF LEMMA 1) In this section, we prove Lemma 1 by explicitly providing algorithms to compute permanent or loop hafnian of an _N_ _× N_ matrix with the complexity _O_ ( _Nw_ <sup>2</sup> 2 <sup>_w_</sup> ) _._ Before providing our algorithms, we note that methods using tree decomposition and treewidth have broad applications to many areas in computer science and applied mathematics [1, 2]. There are many computational problems and corresponding algorithms whose complexity depends on the treewidth instead of the system size. Remarkably, algorithms based on the treewidth are believed to be almost optimal for specific problems in that only a tiny improvement of the tree algorithm makes fail the Exponential Time Hypothesis [3]. We also note that in general, the exact computation of the treewidth for an arbitrary graph is NP-hard problem [4]. Nevertheless, we still have good approximation algorithms of treewidth [2], and for fixed _k_, a linear-time algorithm whether the treewidth at most _k_ and finding the corresponding tree decomposition [5]. In addition, a reasonable upper bound on the treewidth is enough in practical situations. A. Dynamical Programming Algorithm (permanent) _1._ _Tree_ _decomposition_ _of_ _a_ _bipartite_ _graph_ We generalize the algorithm computing permanent by using tree decomposition proposed in Ref. [6] to apply collision cases in single-photon boson sampling. Let us first recall the algorithm of Ref. [6]. Consider an _M ×_ _M_ matrix _U_ . Let _A_ and _X_ denote the subset of its rows and columns, respectively, i.e., _A_ = _{α_ 1 _, . . ., αk}_ and _X_ = _{r_ 1 _, . . ., rk}_, where _αi_ ’s and _ri_ ’s are in [ _M_ ] _≡{_ 1 _, . . ., M_ _}_ . For collision-free cases, redundant elements do not appear in _A_ and _X_, while we can apply the algorithm even when there is redundancy by extending matrix _U_ by repeating the corresponding rows and columns and treating them as distinct row and column elements. However, since the algorithm proposed in Sec. S1 A 3 is more efficient than the latter for collision cases and for simplicity, we assume that they are distinct. Now, we define a bipartite graph _G_ ( _U, A, X_ ) for the matrix _U_ as a graph having vertices _A ∪_ _X_ and edges ( _a, x_ ) if _Ua,x̸_ = 0. We now introduce a tree decomposition ( _T, χ_ ) of a bipartite graph _G_ . Tree decomposition of a graph _G_ needs to satisfy the following conditions: i-1) The union of _{α_ ( _t_ ) _}t∈T_ is the whole row set _A_ . i-2) The union of _{χ_ ( _t_ ) _}t∈T_ is the whole column set _X_ . ii) For every edge ( _a, x_ ) of _G_, there exists a node _t_ of _T_ with _a ∈_ _α_ ( _t_ ), _x ∈_ _χ_ ( _t_ ). iii-1) For every _a ∈_ _A_, the set _{t_ : _a ∈_ _α_ ( _t_ ) _}_ forms a subtree of _T_ . iii-2) For every _x ∈_ _X_, the set _{t_ : _x ∈_ _χ_ ( _t_ ) _}_ forms a subtree of _T_ . The width _w_ of a tree decomposition is the largest of _|α_ ( _t_ ) _|_ + _|χ_ ( _t_ ) _| −_ 1 among all nodes _t_, and the treewidth is the smallest width _w_ over all possible tree decompositions for a given graph. Here, the subtree rooted in _t_ is the tree that consists of _t_ and its descendants. We now define a partial permanent for some sets _D_ _⊂_ _A_ and _Y_ _⊂_ _X_ as per( _D, Y_ ) _≡_ _π∈_ BPM( _G_ ) BPM(� _Ua,π_ ( _a_ ) _,_ (S1) _a_ - _∈D_ _a∈D_ where the sum is over all bipartite perfect matchings _π_ : _D_ _→_ _Y_ . If _|D|̸_ = _|Y |_, then per( _D, Y_ ) = 0 because they cannot constitute a perfect matching. Here, the goal is to compute Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>) = per(</sup> <sup>_A, X_</sup> <sup>)</sup> <sup>(see</sup> <sup>Sec.</sup> <sup>S2 A)</sup> <sup>using</sup> the tree decomposition and analyze the complexity. _2._ _Collision-free_ _cases_ Now we present the recursion formula to compute Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>)</sup> <sup>[6]:</sup> Lemma 3. Let _U_ be a matrix with associated graph _G_ . Let ( _T, α, χ_ ) be a tree decomposition of _G_ . Let _t_ be an internal node of _T_, and let _D_ and _Y_ be such that _α_ ( _Tt_ ) _\ α_ ( _t_ ) _⊂_ _D_ _⊂_ _α_ ( _Tt_ ) _,_ _χ_ ( _Tt_ ) _\ χ_ ( _t_ ) _⊂_ _Y_ _⊂_ _χ_ ( _Tt_ ) _,_ _|D|_ = _|Y |._ (S2) Then, per( _D, Y_ ) = _Dt,Dcj,Yt,Ycj_ per( _Dt, Yt_ ) _j_ =1 - _l_ per <sup>_∗_</sup> ( _Dcj_ _, Ycj_ ) _,_ (S3) where the sum is over all _D_ = ( _Dt, Dc_ 1 _, . . ._ ) _, Y_ = ( _Yt, Yc_ 1 _, . . ._ ) such that: _D_ = _Dt ⊔_ ( _Dc_ 1 _⊔· · · ⊔_ _Dcl_ ) _,_ _Y_ = _Yt ⊔_ ( _Yc_ 1 _⊔· · · ⊔_ _Ycl_ ) _,_ (S4) _α_ ( _Tcj_ ) _\ α_ ( _t_ ) _⊂_ _Dcj_ _⊂_ _α_ ( _Tcj_ ) _,_ _Dt_ _⊂_ _α_ ( _t_ ) _,_ (S5) _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ _Ycj_ _⊂_ _χ_ ( _Tcj_ ) _,_ _Yt_ _⊂_ _χ_ ( _t_ ) _._ (S6) Here, _l_ is the number of children of the node _t_, and we define _a_ - _∈D_ per <sup>_∗_</sup> ( _D, Y_ ) _≡_ _π_ _Ua,π_ ( _a_ ) _,_ (S7) where the sum is over all bijections _π_ : _D_ _→_ _Y_ such that _π ∩_ ( _α_ ( _t_ ) _× χ_ ( _t_ )) = _∅_ . We provide a proof sketch and more detailed proof can be found in Ref. [6]. Let us consider a matching _π_ : _D_ _→_ _Y_ and decompose elements as _D_ = ( _D ∩_ _α_ ( _t_ )) _⊔_ ( _D ∩_ _α_ ( _Tc_ 1) _\ α_ ( _t_ )) _⊔· · · ⊔_ ( _D ∩_ _α_ ( _Tcl_ ) _\ α_ ( _t_ )) _,_ (S8) _Y_ = ( _Y_ _∩_ _χ_ ( _t_ )) _⊔_ ( _Y_ _∩_ _χ_ ( _Tc_ 1) _\ χ_ ( _t_ )) _⊔· · · ⊔_ ( _Y_ _∩_ _χ_ ( _Tcl_ ) _\ χ_ ( _t_ )) _._ (S9) Using definition of tree decomposition, one can find that the matching can be decomposed as _π_ = _πt ⊔_ _πc_ 1 _⊔· · · ⊔_ _πcl_ (S10) in such a way that _πt_ _⊂_ ( _D ∩_ _α_ ( _t_ )) _×_ ( _Y_ _∩_ _χ_ ( _t_ )) and for each child _c_ we have that _πc_ _⊂_ ( _D ∩_ _α_ ( _Tc_ )) _×_ ( _Y_ _∩_ _χ_ ( _Tc_ )), where _πcj ∩_ ( _α_ ( _t_ ) _×_ _χ_ ( _t_ )) = _∅_ . Also, the decomposition is unique. By defining _Yt_ and _Yci_ to be the range of _πt_ and _πci_, respectively, and _Dt_ and _Dci_ to be the domains of _πt_ and _πci_, they satisfy Eq. (S4). Therefore, matchings between _D_ and _Y_ can be decomposed as Eq. (S10), which leads to Eq. (S3). Here, by using inclusion-exclusion principle, one can find that [6] per <sup>_∗_</sup> ( _Dc, Yc_ ) = - _Dcc_ = _Ycc_ _Dtc⊔Dcc_ = _Dc,_ ( _−_ 1) <sup>_|Dtc|_</sup> per( _Dtc, Ytc_ )per( _Dcc, Ycc_ ) _,_ (S11) _Ytc⊔Ycc_ = _Yc,_ _Dtc⊂α_ ( _t_ ) _,Ytc⊂χ_ ( _t_ ) where _|Dtc|_ is the number of elements in _Dtc_ . More explicitly, observe that for _Dtc_ _⊂_ _Dt ∩_ _α_ ( _t_ ) and _Ytc_ _⊂_ _Yt ∩_ _χ_ ( _t_ ), per( _Dtc, Ytc_ )per( _Dc \ Dtc, Yc \ Ytc_ ) = _πc_ <sup>_∗_</sup> ( _Dtc,Ytc_ ) _Dtc_ _Ua,πc∗_ ( _a_ ) _,_ (S12) _a∈Dc_ - _∈D_ where the sum is over perfect matchings between _Dc_ and _Yc_, _πc_ <sup>_∗_</sup> where the sum is over perfect matchings between _Dc_ and _Yc_, _πc_ <sup>_∗_</sup> <sup>that</sup> <sup>contains</sup> <sup>a</sup> <sup>perfect</sup> <sup>matching</sup> <sup>between</sup> <sup>_Dtc_</sup> <sup>and</sup> _Ytc_ . Recall that per <sup>_∗_</sup> ( _Dc, Yc_ ) is the sum over matchings that do not contain any matching between _α_ ( _t_ ) and _χ_ ( _t_ ), i.e., _πc_ <sup>_∗_</sup> ( _∅,∅_ ) _a∈Dtc_ <sup>_Ua,π_</sup> _c_ <sup>_∗_</sup> <sup>(</sup> <sup>_a_</sup> <sup>)</sup> <sup>Thus,</sup> <sup>inclusion-exclusion</sup> <sup>principle</sup> <sup>leads</sup> <sup>to</sup> <sup>Eq.</sup> <sup>(S11).</sup> <sup>Therefore,</sup> <sup>one</sup> <sup>can</sup> equivalently rewrite Eq. (S3) as per <sup>_∗_</sup> ( _Dc, Yc_ ) = <sup>�</sup> _πc_ <sup>_∗_</sup> ( _∅,∅_ ) _a∈Dtc_ <sup>_Ua,π_</sup> _c_ <sup>_∗_</sup> <sup>(</sup> <sup>_a_</sup> <sup>)</sup> <sup>Thus,</sup> <sup>inclusion-exclusion</sup> <sup>principle</sup> <sup>leads</sup> <sup>to</sup> <sup>Eq.</sup> <sup>(S11).</sup> <sup>Therefore,</sup> <sup>one</sup> <sup>can</sup> equivalently rewrite Eq. (S3) as per <sup>_∗_</sup> ( _Dc, Yc_ ) = <sup>�</sup> _πc_ <sup>_∗_</sup> ( _∅,∅_ ) (S3) per( _D, Y_ ) = _D_ - _,Y_ per( _Dt, Yt_ ) _j_ =1 - _l_ ( _−_ 1) <sup>_|Dtcj |_</sup> per( _Dtcj_ _, Ytcj_ )per( _Dccj_ _, Yccj_ ) _,_ (S13) _D,Y_ _j_ =1 where the sum is over _D_ = ( _Dt, Dtc_ 1 _, Dcc_ 1 _, . . ._ ) and _Y_ = ( _Yt, Ytc_ 1 _, Ycc_ 1 _, . . ._ ) satisfying _D_ = _Dt ⊔_ ( _Dtc_ 1 _⊔_ _Dcc_ 1 _⊔· · · ⊔_ _Dtcl_ _⊔_ _Dccl_ ) _,_ _Y_ = _Yt ⊔_ ( _Ytc_ 1 _⊔_ _Ycc_ 1 _⊔· · · ⊔_ _Ytcl_ _⊔_ _Yccl_ ) _,_ (S14) _α_ ( _Tcj_ ) _\ α_ ( _t_ ) _⊂_ _Dccj_ _⊂_ _α_ ( _Tcj_ ) _,_ _Dt_ _⊂_ _α_ ( _t_ ) _,_ _Dtcj_ _⊂_ _α_ ( _t_ ) _∩_ _α_ ( _tcj_ ) _,_ (S15) _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ _Ycj_ _⊂_ _χ_ ( _Tcj_ ) _,_ _Yt_ _⊂_ _χ_ ( _t_ ) _,_ _Ytcj_ _⊂_ _χ_ ( _t_ ) _∩_ _χ_ ( _tcj_ ) _._ (S16) It proves Lemma 3. Using the recursive relation, we finally obtain the quantity of per( _A, X_ ). Now, let us analyze the complexity. We first need to compute per( _Dt, Yt_ ) for all node _t_ ’s. For a node _t_, since _Dt_ _⊂_ _α_ ( _t_ ) and _Yt_ _⊂_ _χ_ ( _t_ ), one can evaluate all per( _A, X_ ) with _A ⊂_ _D_ and _X_ _⊂_ _Y_ in _O_ ( _w_ <sup>2</sup> 2 <sup>_w_</sup> ) [6]: Consider an _n_ 1 _×_ _n_ 2 matrix _U_ . Let _A_ 0 and _X_ 0 be its row and column set, respectively, and _S_ = _{_ ( _D, Y_ ) _⊂_ _A_ 0 _× X_ 0 : _|D|_ = _|Y |}_ . Then, one can compute per( _D, Y_ ) for all ( _D, Y_ ) _∈_ _S_ recursively as follows. Consider ( _D, Y_ ) with _|D|_ = _|Y |_ = _i_ . Then, letting _a_ 0 be the first element in _D_, we can compute its permanent by using ( _D_ <sup>_′_</sup> _, Y_ <sup>_′_</sup> ) with _|D_ <sup>_′_</sup> _|_ = _|Y_ <sup>_′_</sup> _|_ = _i −_ 1, per( _D, Y_ ) = _x_ - _∈Y_ _x∈Y_ _Ua_ 0 _,x_ per( _D \ a_ 0 _, Y_ _\ x_ ) _._ (S17) Since the loop is over at most _n_ 2 elements and finding the sets _D \ a_ 0 and _Y_ _\ x_ costs at most _O_ ( _n_ 1 + _n_ 2), Thus, its complexity is _O_ (( _n_ 1 + _n_ 2) <sup>2</sup> 2 <sup>_n_</sup> <sup>1+</sup> <sup>_n_</sup> <sup>2</sup> ). Once we know all the values of per( _Dt, Yt_ ), per( _Dtcj_ _, Ytcj_ ), and per( _Dccj_ _, Yccj_ ), we can then evaluate per( _D, Y_ ) for all _D_ and _Y_ in _O_ ( _lw_ <sup>2</sup> 2 <sup>_w_</sup> ) by using a subset convolution over the subsets of _α_ ( _t_ ) _× χ_ ( _t_ ) [7]. Therefore, the complexity of computing Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>)</sup> <sup>is</sup> <sup>_O_</sup> <sup>(</sup> <sup>_kw_</sup> <sup>22</sup> <sup>_w_</sup> <sup>)</sup> <sup>since</sup> <sup>the</sup> <sup>sum</sup> <sup>of</sup> <sup>the</sup> <sup>number</sup> <sup>of</sup> <sup>children</sup> <sup>of</sup> <sup>all</sup> <sup>nodes</sup> <sup>is</sup> <sup>_O_</sup> <sup>(</sup> <sup>_k_</sup> <sup>).</sup> _3._ _Collision_ _events_ In general, more than a single photon can be detected in the same mode, i.e., _ri_ ’s are not necessarily distinct. In this case, although we may still employ the algorithm in the previous section, we can further develop the algorithm to be more efficient. We first set a threshold of the total number of photons in a mode _c_, i.e., the maximum number of photons in an output mode is _c_, and we declare the overload if we have more than _c_ photons. We note that when _M_ = _ω_ ( _N_ <sup>2</sup> ), the probability of collision is highly suppressed, i.e., _c_ = 1 is sufficient [8]. To take into account collisions properly, we modify the definition of graphs by additionally assigning photon numbers at each vertices. Now the goal is to compute Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>),</sup> <sup>where</sup> <sup>_αi_</sup> <sup>’s</sup> <sup>and</sup> <sup>_ri_</sup> <sup>’s</sup> <sup>may</sup> <sup>not</sup> <sup>be</sup> <sup>distinct.</sup> <sup>While</sup> <sup>we</sup> <sup>focus</sup> <sup>on</sup> <sup>single-</sup> photon boson sampling, i.e. _αi_ ’s are distinct, for generality, we assume that _αi_ ’s may not be distinct as well. Again, let _A_ = _{α_ 1 _, . . ., αk}_ and _X_ = _{r_ 1 _, . . ., rk}_ with treating _αi_ ’s and _ri_ ’s are distinct, and we consider bipartite matchings between _A_ and _X_ . We introduce weight vectors _n_ and _m_ such that _ni_ is the number of repetition of _i_ in _A_ and _mi_ is the number of repetition of _i_ in _X_ for _i_ _∈_ [ _M_ ] for later usage. For boson sampling, _n_ and _m_ may correspond to an input photon and output photon configuration (of marginals), respectively (see Sec. S2 A). Therefore, _ni_ _∈{_ 0 _,_ 1 _}_ for single-photon boson sampling. Let _G_ _n_ _,_ _m_ = _G_ ( _U, A, X_ ) be the underlying graph structure of _U_, with row and column vertex sets _A_ and _X_ . Meanwhile, for _A_ and _X_, we define _A_ <sup>¯</sup> and _X_ <sup>¯</sup> to be the sets without redundancy of _A_ and _X_, respectively. We now define some generalized bipartite perfect matchings of _G_ that allow multiple edges between vertices in _A_ <sup>¯</sup> and _X_ ¯ . We represent a list of repeated edges as a vector _τ_, i.e., _τ_ is a vector indexed by _E_ = _A_ ¯ _×_ _X_ ¯ and for each _ij_ _∈_ _E_ the entry _τij_ indicates the number of times that edge _ij_ appears. The degree vector of _a_ _∈_ _A_ <sup>¯</sup> is the vector deg _A_ ¯ <sup>(</sup> <sup>_a_</sup> <sup>) with coordinates deg</sup> <sup>¯</sup> _x∈X_ <sup>¯</sup> <sup>_τax_</sup> <sup>, and the degree vector of</sup> <sup>_x ∈_</sup> <sup>_X_</sup> <sup>¯</sup> <sup>is the vector deg</sup> _X_ <sup>¯</sup> <sup>(</sup> <sup>_x_</sup> <sup>) with coordinates</sup> deg ¯ _A_ <sup>_τax_</sup> <sup>.</sup> <sup>For</sup> <sup>weight</sup> <sup>vectors</sup> <sup>_n_</sup> <sup>and</sup> <sup>_m_</sup> <sup>,</sup> <sup>we</sup> <sup>define</sup> <sup>an</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matching</sup> <sup>of</sup> <sup>_G_</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>as</sup> <sup>a</sup> <sup>vector</sup> <sup>_τ_</sup> <sup>such</sup> <sup>that</sup> _a∈_ <sup>¯</sup> deg _A_ ¯ <sup>(</sup> <sup>_ai_</sup> <sup>) =</sup> <sup>_ni_</sup> <sup>and</sup> <sup>deg</sup> <sup>¯</sup> _A_ <sup>(</sup> <sup>_a_</sup> <sup>) = �</sup> _X_ <sup>(</sup> <sup>_xi_</sup> <sup>) =</sup> <sup>_mi_</sup> <sup>for</sup> <sup>all</sup> <sup>_ai_</sup> <sup>_∈_</sup> <sup>_A_</sup> <sup>¯</sup> <sup>and</sup> <sup>_xi_</sup> <sup>_∈_</sup> <sup>_X_</sup> <sup>¯</sup> <sup>.</sup> <sup>Let</sup> <sup>BPM</sup> <sup>_G_</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)</sup> <sup>be</sup> <sup>the</sup> <sup>set</sup> <sup>of</sup> <sup>all</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matchings</sup> <sup>of</sup> _X_ <sup>(</sup> <sup>_x_</sup> <sup>)</sup> <sup>=</sup> <sup>�</sup> deg _A_ ¯ <sup>(</sup> <sup>_a_</sup> <sup>) with coordinates deg</sup> <sup>¯</sup> _x∈X_ <sup>¯</sup> <sup>_τax_</sup> <sup>, and the degree vector of</sup> <sup>_x ∈_</sup> <sup>_X_</sup> <sup>¯</sup> <sup>is the vector deg</sup> _X_ <sup>¯</sup> <sup>(</sup> <sup>_x_</sup> <sup>) with coordinates</sup> deg ¯ _A_ <sup>_τax_</sup> <sup>.</sup> <sup>For</sup> <sup>weight</sup> <sup>vectors</sup> <sup>_n_</sup> <sup>and</sup> <sup>_m_</sup> <sup>,</sup> <sup>we</sup> <sup>define</sup> <sup>an</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matching</sup> <sup>of</sup> <sup>_G_</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>as</sup> <sup>a</sup> <sup>vector</sup> <sup>_τ_</sup> <sup>such</sup> <sup>that</sup> _a∈_ <sup>¯</sup> deg _A_ ¯ <sup>(</sup> <sup>_ai_</sup> <sup>) =</sup> <sup>_ni_</sup> <sup>and</sup> <sup>deg</sup> <sup>¯</sup> _A_ <sup>(</sup> <sup>_a_</sup> <sup>) = �</sup> _G_ . _X_ <sup>(</sup> <sup>_x_</sup> <sup>)</sup> <sup>=</sup> <sup>�</sup> _X_ <sup>(</sup> <sup>_xi_</sup> <sup>) =</sup> <sup>_mi_</sup> <sup>for</sup> <sup>all</sup> <sup>_ai_</sup> <sup>_∈_</sup> <sup>_A_</sup> <sup>¯</sup> <sup>and</sup> <sup>_xi_</sup> <sup>_∈_</sup> <sup>_X_</sup> <sup>¯</sup> <sup>.</sup> <sup>Let</sup> <sup>BPM</sup> <sup>_G_</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)</sup> <sup>be</sup> <sup>the</sup> <sup>set</sup> <sup>of</sup> <sup>all</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matchings</sup> <sup>of</sup> deg ¯ _A_ <sup>_τax_</sup> <sup>.</sup> <sup>For</sup> <sup>weight</sup> <sup>vectors</sup> <sup>_n_</sup> <sup>and</sup> <sup>_m_</sup> <sup>,</sup> <sup>we</sup> <sup>define</sup> <sup>an</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matching</sup> <sup>of</sup> <sup>_G_</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>as</sup> <sup>a</sup> <sup>vector</sup> <sup>_τ_</sup> <sup>such</sup> <sup>that</sup> _a∈_ <sup>¯</sup> deg _A_ ¯ <sup>(</sup> <sup>_ai_</sup> <sup>) =</sup> <sup>_ni_</sup> <sup>and</sup> <sup>deg</sup> <sup>¯</sup> _A_ <sup>(</sup> <sup>_a_</sup> <sup>) = �</sup> _G_ . _X_ <sup>(</sup> <sup>_x_</sup> <sup>)</sup> <sup>=</sup> <sup>�</sup> _X_ <sup>(</sup> <sup>_xi_</sup> <sup>) =</sup> <sup>_mi_</sup> <sup>for</sup> <sup>all</sup> <sup>_ai_</sup> <sup>_∈_</sup> <sup>_A_</sup> <sup>¯</sup> <sup>and</sup> <sup>_xi_</sup> <sup>_∈_</sup> <sup>_X_</sup> <sup>¯</sup> <sup>.</sup> <sup>Let</sup> <sup>BPM</sup> <sup>_G_</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)</sup> <sup>be</sup> <sup>the</sup> <sup>set</sup> <sup>of</sup> <sup>all</sup> <sup>(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)-matchings</sup> <sup>of</sup> Let _G_ _n_ _,_ _m_ be the graph associated to _U_ . We may view its row vertices as ( _i, li_ ), where _i_ _∈_ _A_ <sup>¯</sup>, _li_ _∈_ [ _ni_ ], and column vertices as pairs ( _j, kj_ ), where _j_ _∈_ _X_ <sup>¯</sup>, and _kj_ _∈_ [ _mj_ ]. The edges are between the vertices. Given a bipartite perfect matching _π_ _∈_ BPM( _G_ _n_ _,_ _m_ ), there is a natural way to obtain an ( _n_ _,_ _m_ )-matching _τ_ _∈_ BPM _G_ ( _n_ _,_ _m_ ). Namely, for each edge [( _i, li_ ) _,_ ( _j, kj_ )] in _π_ we drop the second coordinate and obtain the edge _ij_ . This gives a function _f_ : BPM( _G_ _n_ _,_ _m_ ) _→_ BPM _G_ ( _n_ _,_ _m_ ). Thus, one can easily show that the fiber _f_ <sup>_−_</sup> <sup>1</sup> consists of _m_ ! _n_ ! _/_ _τ_ ! elements. Then, _a_ - _∈A_ <sup>¯</sup> _Ua,τ_ ( _a_ ) _._ (S18) Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>)</sup> <sup>_≡_</sup> _π∈_ BPM( _G_ _n_ _,_ _m_ ) BPM(� _G_ _Ua,π_ ( _a_ ) = - _G_ ( _<u>m</u>_ <u>!</u> _<u>n</u>_ <u>!</u> _a∈A_ <sup>¯</sup> _τ_ ( _a_ ) _τ_ ( _a_ ) _τ_ _∈_ BPM _G_ ( _n_ _,_ _m_ ) _a_ - _∈A_ _a∈A_ _τ_ ! Note that the product over _τ_ ( _a_ ) appears because _a ∈_ _A_ <sup>¯</sup> can be connected multiple vertices on _X_ . From now on, we assume that the weight vectors _n_ and _m_ are fixed. Given another weight vectors _d_ _≤_ _n_ and _y_ _≤_ _m_ (component-wise), the associated scaled partial permanent is defined as <u>1</u> per( _d_ _,_ _y_ ) _≡_ _d_ ! _y_ ! <sup>Per(</sup> <sup>_U_</sup> _y_ <sup>_d_</sup> _τ_ _∈_ BPM _G_ ( _d_ _,_ _y_ ) _a∈_ supp( _d_ ) supp(� _τ_ ( _a_ ) _y_ <sup>_d_</sup> <sup>) =</sup> - _G_ _Ua,τ_ ( _a_ ) _,_ (S19) <u>1</u> _τ_ ! _τ_ ( _a_ ) _r_ 1 _,...,rk_ such that the weight vectors of _αi_ ’s and _ri_ <sup>_′_</sup> _̸_ _y_ <sup>_d_</sup> <sup>_≡_</sup> we <sup>_U α_</sup> want <sup>1</sup> <sup>_,...,α_</sup> to <sup>_k_</sup> compute is written as whereand _y_,supp(respectively. _d_ ) _≡{i ∈_ Then,[ _M_ ] :the _di̸_ = 0permanent _}_ . Here, that _U_ _y_ <sup>_d_</sup> _r_ 1 _,...,rk_ such that the weight vectors of _αi_ ’s and _ri_ <sup>_′s_</sup> <sup>are</sup> <sup>equal</sup> <sup>to</sup> <sup>_d_</sup> whereand _y_,supp(respectively. _d_ ) _≡{i ∈_ Then,[ _M_ ] :the _di̸_ = 0permanent _}_ . Here, that _U_ _y_ <sup>_d_</sup> <sup>_≡_</sup> we <sup>_U α_</sup> want <sup>1</sup> <sup>_,...,α_</sup> to <sup>_k_</sup> compute is written as Per( _U_ _m_ <sup>_n_</sup> <sup>) =</sup> <sup>_n_</sup> <sup>!</sup> <sup>_m_</sup> <sup>!per(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>)</sup> <sup>_._</sup> (S20) Let us also define sat( _d_ ) = _{i ∈_ [ _M_ ] : _di_ = _ni}_ for a given _n_, and sat( _y_ ) = _{i ∈_ [ _M_ ] : _yi_ = _mi}_ and supp( _y_ ) = _{i ∈_ [compute _M_ ] : _yi̸_ = 0Per( _}_ _U_ for _m_ <sup>_n_</sup> <sup>).</sup> a given _m_ . With a tree decomposition ( _T, α, χ_ ) for _G_ _n_ _,_ _m_, we now provide the recursive relation to Lemma 4. Let _U_ be a matrix with associated graph _G_ . Let ( _T, α, χ_ ) be a tree decomposition of _G_ . Let _t_ be an internal node of _T_, and let _d_ and _y_ be such that _α_ ( _Tt_ ) _\ α_ ( _t_ ) _⊂_ sat( _d_ ) _⊂_ supp( _d_ ) _⊂_ _α_ ( _Tt_ ) _,_ _χ_ ( _Tt_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ ) _⊂_ supp( _y_ ) _⊂_ _χ_ ( _Tt_ ) _,_ _|_ _d_ _|_ = _|_ _y_ _|,_ (S21) _i_ where _|_ _d_ _|_ = <sup>�</sup> <sup>_M_</sup> per( _d_ _,_ _y_ ) = _i_ =1 <sup>_di_</sup> <sup>,</sup> <sup>and</sup> <sup>_|_</sup> <sup>_y_</sup> <sup>_|_</sup> <sup>is</sup> <sup>similar.</sup> <sup>Then,</sup> _d_ _t,_ _d_ _c,_ _y_ _t,_ _y_ _c_ _c,_ _y_ per( _d_ _t,_ _y_ _t_ ) _j_ =1 - _l_ per <sup>_∗_</sup> ( _d_ _cj_ _,_ _y_ _cj_ ) _,_ (S22) where the sum is over ( _d_ _t,_ _d_ _c_ 1 _, . . .,_ _d_ _cl_ ) and ( _y_ _t,_ _y_ _c_ 1 _, . . .,_ _y_ _cl_ ) such that: _l_ _j_ =1 _y_ _cj_ _,_ (S23) _d_ = _d_ _t_ + _l_ _j_ =1 _d_ _cj_ _,_ _y_ = _y_ _t_ + _j_ =1 _j_ =1 _α_ ( _Tcj_ ) _\ α_ ( _t_ ) _⊂_ sat( _d_ _cj_ ) _⊂_ supp( _d_ _cj_ ) _⊂_ _α_ ( _Tcj_ ) _,_ supp( _d_ _t_ ) _⊂_ _α_ ( _t_ ) _,_ (S24) _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ _cj_ ) _⊂_ supp( _y_ _cj_ ) _⊂_ _χ_ ( _Tcj_ ) _,_ supp( _y_ _t_ ) _⊂_ _χ_ ( _t_ ) _,_ (S25) supp( _d_ _t_ ) _⊔_ supp( _d_ _c_ 1) _⊔· · · ⊔_ supp( _d_ _cl_ ) = supp( _d_ ) _,_ (S26) supp( _y_ _t_ ) _⊔_ supp( _y_ _c_ 1) _⊔· · · ⊔_ supp( _y_ _cl_ ) = supp( _y_ ) _._ (S27) Here, per <sup>_∗_</sup> ( _d_ _c,_ _y_ _c_ ) is defined as where _τ_ _∩_ ( _α_ ( _t_ ) _× χ_ ( _t_ )) = _∅_ . _τ_ ( _a_ ) _a∈_ supp(� _d_ _c_ ) per <sup>_∗_</sup> ( _d_ _c,_ _y_ _c_ ) _≡_ _τ_ _∈_ BPM� _G_ ( _d_ _c,_ _y_ _c_ ) <u>1</u> _τ_ ! _Ua,τ_ ( _a_ ) _,_ (S28) _Proof._ Let us consider _d_ and _y_ satisfying Eq. (S21) and a generalized matching _τ_ _∈_ BPM _G_ ( _d_ _,_ _y_ ). Here, _τ_ _⊂_ _D × Y_ with _D_ _≡_ supp( _d_ ) and _Y_ _≡_ supp( _y_ ). Consider the following decompositions: _D_ = ( _D ∩_ _α_ ( _t_ )) _⊔_ ( _D ∩_ _α_ ( _Tc_ 1) _\ α_ ( _t_ )) _⊔· · · ⊔_ ( _D ∩_ _α_ ( _Tcl_ ) _\ α_ ( _t_ )) _,_ (S29) _Y_ = ( _Y_ _∩_ _χ_ ( _t_ )) _⊔_ ( _Y_ _∩_ _χ_ ( _Tc_ 1) _\ χ_ ( _t_ )) _⊔· · · ⊔_ ( _Y_ _∩_ _χ_ ( _Tcl_ ) _\ χ_ ( _t_ )) _._ (S30) Let _τt_ be the submatching of _τ_ with domain contained in _D_ _∩α_ ( _t_ ) and range contained in _Y ∩χ_ ( _t_ ). If some _a ∈_ _D_ _∩α_ ( _t_ ) is not in the domain of _τt_, there is a child _c_ such that _a ∈_ _α_ ( _Tc_ ) and _π_ ( _a_ ) _⊂_ _χ_ ( _Tc_ ) by definition of tree decomposition. Also, if _x ∈_ _Y_ _∩χ_ ( _t_ ) is not in the range of _τt_, then there is a child _c_ such that _x ∈_ _χ_ ( _Tc_ ) and _τ_ <sup>_−_</sup> <sup>1</sup> ( _x_ ) _⊂_ _α_ ( _Tc_ ). Similarly, we have _τ_ ( _D ∩_ _α_ ( _Tc_ ) _\ α_ ( _t_ )) _⊂_ _Y_ _∩_ _χ_ ( _Tc_ ) (S31) _τ_ ( _Y_ _∩_ _α_ ( _Tc_ ) _\ χ_ ( _t_ )) _⊂_ _D ∩_ _α_ ( _Tc_ ) _._ (S32) Hence, we can decompose _τ_ = _τt ⊔_ _τc_ 1 _⊔· · · ⊔_ _τcl_ _,_ (S33) in such a way that _τt_ _⊂_ ( _D ∩_ _α_ ( _t_ )) _×_ ( _Y_ _∩_ _χ_ ( _t_ )) and for each child _c_ we have that _τc_ _⊂_ ( _D ∩_ _α_ ( _Tc_ )) _×_ ( _Y_ _∩_ _χ_ ( _Tc_ )) andvectors _τc ∩_ _d_ ( _α_ and( _t_ ) _×_ _y_ _χ_ following( _t_ )) = _∅_ .theOnedecomposition,can easily checkwhichthatleadsthis todecompositionthe conditionsis unique.(S23)-(S27).Now,Thuswe decomposefor a givengivengeneralizedweight matching _τ_ we decompose it, which leads to Eq. (S22). Also, when submatchings satisfying Eqs. (S23)-(S27) are given, we can combine them to constitute a matching _τ_ . Again, we show that per <sup>_∗_</sup> ( _d_ _c,_ _y_ _c_ ) = ( _−_ 1) <sup>_|_</sup> <sup>_d_</sup> <sup>_tc|_</sup> per( _d_ _tc,_ _y_ _tc_ )per( _d_ _cc,_ _y_ _cc_ ) _,_ (S34) _d_ _tc,_ _d_ _cc,_ _y_ _tc,_ _y_ _cc_ where the sum is over _d_ _tc_, _d_ _cc_, _y_ _tc_, _y_ _cc_ satisfying _d_ _tc_ + _d_ _cc_ = _d_ _c,_ _y_ _tc_ + _y_ _cc_ = _y_ _c,_ supp( _d_ _tc_ ) _⊂_ _α_ ( _t_ ) _,_ supp( _y_ _tc_ ) _⊂_ _χ_ ( _t_ ) (S35) supp( _d_ _c_ ) = supp( _d_ _cc_ ) _⊔_ supp( _d_ _tc_ ) _,_ supp( _y_ _c_ ) = supp( _y_ _cc_ ) _⊔_ supp( _y_ _tc_ ) _._ (S36) To show that, observe that for some _d_ _tc_ _≤_ _d_ _c_ and _y_ _tc_ _≤_ _y_ _c_ (elementwise) with supp( _d_ _tc_ ) _⊂_ _α_ ( _t_ ) and supp( _y_ _tc_ ) _⊂_ _χ_ ( _t_ ) and supp( _d_ _c_ ) = supp( _d_ _tc_ ) _⊔_ supp( _d_ _c −_ _d_ _tc_ ) _,_ supp( _y_ _c_ ) = supp( _y_ _c_ ) _⊔_ supp( _y_ _c −_ _y_ _tc_ ), _a∈_ supp( _d_ _c_ ) supp(� _τ_ ( _a_ ) per( _d_ _tc,_ _y_ _tc_ )per( _d_ _c −_ _d_ _tc,_ _y_ _c −_ _y_ _tc_ ) = _τc_ ( _d_ _tc,_ _y_ _tc_ ) _∈_ BPM( _d_ _c,_ _y_ _c_ ) )� _∈_ _Ua,τc_ ( _a_ ) _,_ (S37) <u>1</u> _τ_ _c_ ! _τ_ ( _a_ ) where the sum is over _τc_ that contains a generalized perfect matching between _d_ _tc_ and _y_ _tc_ . Since per <sup>_∗_</sup> ( _d_ _c,_ _y_ _c_ ) corresponds to the sum over generalized perfect matchings that do not contain any matching between _α_ ( _t_ ) and _χ_ ( _t_ ), by using inclusion-exclusion principle, we obtain the expression of (S34). Therefore, we can rewrite Eq. (S22) as _j_ =1 - _l_ per( _d_ _,_ _y_ ) = per( _d_ _t,_ _y_ _t_ ) ( _−_ 1) <sup>_|_</sup> <sup>_d_</sup> <sup>_tcj |_</sup> per( _d_ _tcj_ _,_ _y_ _tcj_ )per( _d_ _ccj_ _,_ _y_ _ccj_ ) (S38) _j_ =1 where the sum is over _d_ _t,_ _y_ _t,_ _d_ _tcj_ _,_ _y_ _tcj_ _,_ _d_ _ccj_ _,_ _y_ _ccj_ such that _l_ ( _j_ =1 _j_ =1 ( _y_ _tcj_ + _y_ _ccj_ ) _,_ supp( _y_ _t_ ) _⊂_ _χ_ ( _t_ ) _,_ (S39) _d_ = _d_ _t_ + _l_ _j_ =1 ( _d_ _tcj_ + _d_ _ccj_ ) _,_ supp( _d_ _t_ ) _⊂_ _α_ ( _t_ ) _,_ _y_ = _y_ _t_ + _j_ =1 _D_ = supp( _d_ _t_ ) _⊔_ supp( _d_ _tc_ 1) _⊔· · · ⊔_ supp( _d_ _tcl_ ) _⊔_ supp( _d_ _ccj_ ) _⊔· · · ⊔_ supp( _d_ _ccl_ ) _,_ (S40) _Y_ = supp( _y_ _t_ ) _⊔_ supp( _y_ _tc_ 1) _⊔· · · ⊔_ supp( _y_ _tcl_ ) _⊔_ supp( _y_ _ccj_ ) _⊔· · · ⊔_ supp( _y_ _ccl_ ) _,_ (S41) _α_ ( _Tcj_ ) _\ α_ ( _t_ ) _⊂_ sat( _d_ _ccj_ ) _⊂_ supp( _d_ _ccj_ ) _⊂_ _α_ ( _Tcj_ ) _,_ _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ _ccj_ ) _⊂_ supp( _y_ _ccj_ ) _⊂_ _χ_ ( _Tcj_ ) _,_ (S42) supp( _d_ _tcj_ ) _⊂_ _α_ ( _t_ ) _∩_ _α_ ( _tcj_ ) _,_ supp( _y_ _tcj_ ) _⊂_ _χ_ ( _t_ ) _∩_ _χ_ ( _tcj_ ) _._ (S43) Using the recursive relation, we can finally compute Per( _U_ _m_ <sup>_n_</sup> <sup>=</sup> <sup>_n_</sup> <sup>!</sup> <sup>_m_</sup> <sup>!per(</sup> <sup>_n_</sup> <sup>_,_</sup> <sup>_m_</sup> <sup>).</sup> We now analyze the complexity. First, at node _t_ we need to compute per( _d_ _t,_ _y_ _t_ ) for all _d_ _t_ _≤_ _d_ and _y_ _t_ _≤_ _y_ with _|_ _d_ _t|_ = _|_ _y_ _t|_ . Let us consider _n_ 1 _×_ _n_ 2 matrix _U_ with a weight vector _n_ and _m_ . Let _d_ _≤_ _n_ and _y_ _≤_ _m_ with _D_ = supp( _d_ ) and _Y_ = supp( _y_ ) and _|_ _d_ _|_ = _|_ _y_ _|_ = _i_ . We set the upper threshold as _c_ . As previous, we use a recursive relation: Letting _a_ 0 be the first element of _D_, _x_ - _∈Y_ _Ua_ 0 _,x_ ( _d_ _−_ _d_ _a_ 0)!( _y_ _−_ _y_ _x_ )!per( _d_ _−_ _d_ _a_ 0 _,_ _y_ _−_ _y_ _x_ ) _,_ (S44) <u>1</u> <u>1</u> per( _d_ _,_ _y_ ) = _d_ ! _y_ ! <sup>Per(</sup> <sup>_U_</sup> _y_ <sup>_d_</sup> <sup>) =</sup> _d_ ! _y_ ! _x_ - _∈Y_ _d_ _−_ _d_ _a_ 0 <u>1</u> _Ua_ 0 _,x_ Per( _U_ _y_ _−_ _y_ _x_ <sup>) =</sup> _d_ ! _y_ ! _d_ _−_ _d_ _a_ 0 <u>1</u> _y_ _−_ _y_ _x_ <sup>) =</sup> _d_ ! _y_ ! _x_ - _∈Y_ where _d_ _a_ 0 and _y_ _x_ are weight vector corresponding _a_ 0 and _x_, respectively. Thus, one can compute per( _d_ _,_ _y_ ) for _|_ _d_ _|_ = _|_ _y_ _|_ = _i_ using per( _d_ <sup>_′_</sup> _,_ _y_ <sup>_′_</sup> ) for _|_ _d_ <sup>_′_</sup> _|_ = _|_ _y_ <sup>_′_</sup> _|_ = _i −_ 1. Here, the loop is over at most _n_ 2 elements and finding the sets _d_ _−_ _d_ _a_ 0 and _y_ _−_ _y_ _x_ costs at most _O_ ( _n_ 1 + _n_ 2). Since the number of elements of pairs of _d_ and _y_ is _O_ (( _c_ + 1) <sup>_n_</sup> <sup>1+</sup> <sup>_n_</sup> <sup>2</sup> ), the complexity of computing permanent of all _d_ and _y_ is _O_ (( _n_ 1 + _n_ 2) <sup>2</sup> ( _c_ + 1) <sup>_n_</sup> <sup>1+</sup> <sup>_n_</sup> <sup>2</sup> ). Once we know all the values of per( _d_ _t,_ _y_ _t_ ), per( _d_ _tcj_ _,_ _y_ _tcj_ ), and per( _d_ _ccj_ _,_ _y_ _ccj_ ), per( _d_ _,_ _y_ ) for all _d_ and _y_ can be computed in _O_ ( _lw_ (2 _c_ +1) <sup>_w_</sup> log _c_ ) by using a (non-circular) convolution [9]. Therefore, the total complexity to compute per( _n_ _,_ _m_ ) for a _k × k_ matrix is _O_ ( _kw_ (2 _c_ + 1) <sup>_w_</sup> log _c_ ). B. Dynamical Programming Algorithm (loop hafnian) _1._ _Tree_ _decomposition_ _of_ _a_ _symmetric_ _graph_ Now, we provide a classical algorithm using dynamical programming to compute a loop hafnian of a symmetric matrix. We define a symmetric graph _G_ ( _B, X_ ) for a symmetric matrix _B_, where vertices _X_ represent columns (or rows)to computeof _B_ andthe theloopgraphhafnianedgeof _ij_ matrixif _BijB̸_ = 0, whichfor _i, j_ is written _∈_ _X_ . Weasthen define a tree decomposition of symmetric graph _G_ _ij_ - _∈π_ lHaf( _B_ ) = _π∈_ PM(� _G_ ) _Bij,_ (S45) where PM( _G_ ) is the set of perfect matchings of _G_ . Tree decomposition of a symmetric graph is ( _T, χ_ ) such that i) The union of _{χ_ ( _t_ ) _}t∈T_ is the whole column set _X_ . ii) For every edge ( _xi, xj_ ) of _G_, there exists a node _t_ of _T_ with _xi, xj_ _∈_ _χ_ ( _t_ ). iii) For every _x ∈_ _X_, the set _{t_ : _x ∈_ _χ_ ( _t_ ) _}_ forms a subtree of _T_ . The width _w_ of a tree decomposition is the largest of _|χ_ ( _t_ ) _| −_ 1 among all nodes _t_, and the treewidth of a graph is the smallest width over all possible tree decompositions of the graph. We now define the partial loop hafnian of a subgraph _D_ of _G_, _ij_ - _∈π_ lhaf( _D_ ) = _π∈_ PM� _G_ ( _D_ ) _Bij._ (S46) _2._ _Collision-free_ _cases_ to Again,computeweisfirstwrittenassumeas (seethat Sec. _mi_ _∈{_ S2 B)0 _,_ 1 _}_ for all _i_ ’s, i.e., collision-free cases. Note that the loop hafnian that we want lHaf( _B_ _m_ ) = lhaf( _X_ ) _,_ (S47) where _B_ _m_ is obtained by repeating _i_ th column and row of _B_ for _mi_ times. We first present the recursion relation: Lemma 5. Let _B_ be a matrix with associated symmetric graph _G_ . Let ( _T, χ_ ) be a tree decomposition of _G_ . Let _t_ be an internal node of _T_, and let _Y_ be such that _χ_ ( _Tt_ ) _\ χ_ ( _t_ ) _⊂_ _Y_ _⊂_ _χ_ ( _Tt_ ) _._ (S48) Then, lhaf( _Yt_ ) _j_ =1 - _l_ lhaf( _Y_ ) = - _Y_ lhaf <sup>_∗_</sup> ( _Ycj_ ) _,_ (S49) where the sum is over all _Y_ = ( _Yt, Yc_ 1 _, . . ., Ycl_ ) such that: _Y_ = _Yt ⊔_ ( _Yc_ 1 _⊔· · · ⊔_ _Ycl_ ) _,_ _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ _Ycj_ _⊂_ _χ_ ( _Tcj_ ) _,_ _Yt_ _⊂_ _χ_ ( _t_ ) _._ (S50) _Proof._ Consider a matching _π_ _∈_ PM _G_ ( _Y_ ) with _χ_ ( _Tt_ ) _\ χ_ ( _t_ ) _⊂_ _Y_ _⊂_ _χ_ ( _Tt_ ). Consider an element of the matching, _ij_ _∈_ _π_ . If both _i_ and _j_ are in _χ_ ( _t_ ), we let _ij_ _∈_ _πt_ and _i, j_ _∈_ _Yt_ . Otherwise, i.e., _i_ _∈_ _χ_ ( _t_ ) but _j̸_ _∈_ _χ_ ( _t_ ), or _i̸_ _∈_ _χ_ ( _t_ ) but _j_ _∈_ _χ_ ( _t_ ), or _i, j̸_ _∈_ _χ_ ( _t_ ), by definition of tree decomposition, there exists a child such that _i, j_ _∈_ _χ_ ( _Tc_ ), and we let _ij_ _∈_ _πc_ and _i, j_ _∈_ _Yc_ . Such a way guarantees that the decomposition satisfies the condition (S50). Then, we obtain a unique decomposition _π_ = _πt ⊔_ _πc_ 1 _· · · ⊔_ _πcl_ . Conversely, for given matchings _πt_ and _πc_ 1 _, . . ., πcl_ defined as above, if we combine them, we can construct a matching _π_ _∈_ PM _G_ ( _Y_ ). Thus, _j_ =1 _ij_ - _∈π_ _ij_ - _∈πt_ _ij_ - _∈πcj_     _j_ =1 - _l_ _πcj ∈_ PM� _G_ ( _Ycj_ ) lhaf( _B_ _m_ ) = = _π∈_ PM� _G_ ( _Y_ ) lhaf( _Yt_ ) - _Y_ _Bij_ = lhaf <sup>_∗_</sup> ( _Ycj_ ) _,_ (S51) - _Y_    _πt∈_ PM� _G_  _Bij_     _Bij_     PM� _G_ _πt∈_ PM _G_ ( _Yt_ ) - _∈π_ _j_ =1 - _l_ where lhaf <sup>_∗_</sup> ( _Ycj_ ) is the sum for matchings _πcj_ satisfying _πcj_ _∩_ ( _χ_ ( _t_ ) _× χ_ ( _t_ )) = _∅_ . Finally, by using inclusion-exclusion formula, similarly to permanent, _ij_ - _∈πc_ _i_ _|Ytc|_ = _i_ - _Yc∩_ ( _−_ 1) <sup>_i_</sup> lhaf( _Ytc_ )lhaf( _Yc \ Ytc_ ) = _πc_ <sup>_∗_</sup> _Bij,_ (S52) _Ytc⊂Yc∩χ_ ( _t_ ) where the sum is over _πc_ <sup>_∗_</sup> _c_ <sup>_∗_</sup> <sup>’s</sup> <sup>satisfy</sup> <sup>_π_</sup> _c_ <sup>_∗_</sup> _c_ <sup>_∗_</sup> <sup>_∩_</sup> <sup>(</sup> <sup>_χ_</sup> <sup>(</sup> <sup>_t_</sup> <sup>)</sup> <sup>_× χ_</sup> <sup>(</sup> <sup>_t_</sup> <sup>)) =</sup> <sup>_∅_</sup> <sup>.</sup> <sup>To</sup> <sup>show</sup> <sup>this,</sup> <sup>observe</sup> <sup>that</sup> <sup>for</sup> <sup>some</sup> <sup>_Ytc_</sup> <sup>_⊂_</sup> <sup>_χ_</sup> <sup>(</sup> <sup>_t_</sup> <sup>)</sup> <sup>_∩_</sup> <sup>_Yt_</sup> <sup>,</sup> lhaf( _Ytc_ )lhaf( _Yc \ Ytc_ ) = _πc_ ( _Ytc_ ) _c_ ( _Ytc_ _jk∈πc_ _Bjk,_ (S53) _jk_ - _∈π_ where the sum is over _πc_ that contains a perfect matching for _Ytc_ . Since we want to compute the sum over perfect matchings that do not contain any matching between _Ytc_, using inclusion-exclusion formula, we obtain Eq. (S52). Thus, using the recursive relation of Eq. (S52), one can compute lHaf( _B_ _m_ ) = lhaf( _X_ ). Let us analyze the complexity. First, the complexity of computing lhaf( _Yt_ ) for all _Yt_ at node _t_ can be obtained as follows: Let _B_ be an _n × n_ symmetric matrix. Let _X_ be the set of columns and consider _Y_ _⊂_ _X_ . Then, letting _a_ 0 be the first element of _Y_, _ij_ - _∈π_ <sup>_′_</sup> - _∈π_ <sup>_′_</sup> _ij_ - _∈π_ _π_ <sup>_′_</sup> _∈_ PM(� _Y \{a_ 0 _,x}_ ) - _Y \{_ _Bij_ = _x_ - _∈Y_ _Ba_ 0 _,x_ _x_ - _∈Y_ _Ba_ 0 _,x_ lhaf( _Y_ _\ {a_ 0 _, x}_ ) _._ (S54) lhaf( _Y_ ) = _π∈_ PM(� _Y_ ) _Bij_ = For each _Y_, we loop over at most _n_ elements, and for each we need _O_ ( _n_ ) to find the set _Y_ _\ {a_ 0 _, x}_ . Thus, we can compute lhaf( _Y_ ) for all _Y_ in _O_ ( _n_ <sup>2</sup> 2 <sup>_n_</sup> ). When the values of lhaf( _Yt_ ) and lhaf( _Ycj_ ) are given, one can compute lhaf( _Y_ ) as the permanent case by using a subset convolution, the complexity of which is given by _O_ ( _lw_ <sup>2</sup> 2 <sup>_w_</sup> ). Therefore, at node _t_, the complexity of computing all _Y_ is _O_ ( _lw_ <sup>2</sup> 2 <sup>_w_</sup> ), and the complexity of computing lHaf( _B_ _m_ ) is _O_ ( _kw_ <sup>2</sup> 2 <sup>_w_</sup> ). _3._ _Collision_ _events_ Let us consider cases with collision events. To do that, let _B_ be a symmetric matrix and a weight vector _m_ = ( _m_ 1 _, . . ., mM_ ) is given. The goal is to compute the loop hafnian of _B_ _m_, obtained by repeating _i_ ’s row and column for _mi_ times. Let _G_ be the underlying graph structure of _B_ . More explicitly, vertex set _X_ is composed of _i_ ’s for _mi_ times, treating _i_ ’s as distinct. We again define _X_ <sup>¯</sup> to be the set of _i ∈_ [ _M_ ] such that _mi_ _>_ 0, i.e., removing redundancy from _X_ . We define a generalized perfect matching of _X_ <sup>¯</sup> that allows repeated edges. We represent a list of repeated edges as a vector _τ_ indexed by _E_, and for each _ij_ _∈_ _E_ the entry _τij_ indicates the number of times that edge _ij_ appears. _j∈_ [ _M_ ] <sup>_τij_</sup> <sup>.</sup> <sup>For</sup> <sup>a</sup> <sup>given</sup> <sup>weight</sup> <sup>vector</sup> <sup>_m_</sup> <sup>,</sup> <sup>we</sup> <sup>define</sup> <sup>an</sup> _m_ -matching of _G_ as a list _τ_ such that deg( _τ_ ) = _m_ . Let PM _G_ ( _m_ ) be the set of all _m_ -matchings of _G_ . The degree vector of _τ_ is deg( _τ_ ) with coordinates deg( _τ_ ) _i_ _≡_ <sup>�</sup> _j∈_ [ _M_ ] <sup>_τij_</sup> <sup>.</sup> <sup>For</sup> <sup>a</sup> <sup>given</sup> <sup>weight</sup> <sup>vector</sup> <sup>_m_</sup> <sup>,</sup> <sup>we</sup> <sup>define</sup> <sup>an</sup> _m_ -matching of _G_ as a list _τ_ such that deg( _τ_ ) = _m_ . Let PM _G_ ( _m_ ) be the set of all _m_ -matchings of _G_ . The degree vector of _τ_ is deg( _τ_ ) with coordinates deg( _τ_ ) _i_ _≡_ <sup>�</sup> Following Ref. [10], we define - <sup></sup>    (S55)   _,_ _B_ ( _τ_ ) _≡_ �� _ii∈El_ _ij∈E_ 0 _Tτii_ ( _Bii_ ) <sup></sup> _ij∈E_  <sup>�</sup> ( _Bij_ ) <sup>_τij_</sup> where _El_ _⊂_ _E_ consists of the loops, and _E_ 0 _≡_ _E \ El_, and the sequence _{Tk_ ( _a_ ) _}k∈_ N satisfies the following recursion: _T_ 0( _a_ ) = 1 _,_ _T_ 1( _a_ ) = _a,_ _Tk_ ( _a_ ) = _a_ ( _Tk−_ 1( _a_ ) + ( _k −_ 1) _Tk−_ 2( _a_ )) _._ (S56) In particular, _Tk_ ( _a_ ) represents the loop hafnian of a constant matrix with an element _a_ . We can now rewrite a loop hafnian as lHaf( _B_ _m_ ) = _m_ ! _τ_ _∈_ PM� _G_ ( _m_ ) <u>1</u> _τ_ ! <sup>_B_</sup> <sup>(</sup> <sup>_τ_</sup> <sup>)</sup> <sup>_,_</sup> (S57) define a rescaled loop hafnian as lhaf( _y_ ) _≡_ _y_ <sup><u>1</u></sup> ! <sup>lhaf(</sup> <sup>_B_</sup> <sup>_y_</sup> <sup>) =</sup> _τ_ _∈_ PM� _G_ ( _y_ ) <u>1</u> _τ_ ! <sup>_B_</sup> <sup>(</sup> <sup>_τ_</sup> <sup>)</sup> <sup>_._</sup> (S58) To show Eq. (S57), we again find a way to reduce a matching of a graph _G_ ( _B, X_ ) to a generalized _m_ -matching allowing multiple edges. We can rewrite vertices of _G_ as ( _i, li_ ) by introducing _li_ _∈_ _mi_ for redundancy. For an edge between ( _i, li_ ) and ( _j, lj_ ) of a matching _π_, we drop the second indices and obtain an edge of a generalized matching _τ_ . Such a way defines a function _f_ : PM _G_ ( _m_ ) and for a given generalized matching _τ_ _∈_ PM _G_ ( _m_ ), one can easily check that fiber _f_ <sup>_−_</sup> <sup>1</sup> ( _τ_ ) consists of _m_ ! _/_ _τ_ ! elements. By taking into account the loops, we finally obtain Eq. (S57). Now, we present the recursive relation: Lemma 6. Let _B_ be a matrix with associated graph _G_ . Let ( _T, χ_ ) be a tree decomposition of _G_ . Let _t_ be an internal node of _T_, and let _y_ be such that _χ_ ( _Tt_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ ) _⊂_ supp( _y_ ) _⊂_ _χ_ ( _Tt_ ) _._ (S59) Then, lhaf( _y_ ) = where the sum is over ( _y_ _t,_ _y_ _c_ 1 _, . . .,_ _y_ _cl_ ) such that: _y_ _t,_ _y_ _c_ lhaf( _y_ _t_ ) _j_ =1 - _l_ lhaf <sup>_∗_</sup> ( _y_ _cj_ ) _,_ (S60) _y_ = _y_ _t_ + _l_ _j_ =1 _j_ =1 _y_ _cj_ _,_ supp( _y_ _t_ ) _⊂_ _χ_ ( _t_ ) _,_ _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ _cj_ ) _⊂_ supp( _y_ _cj_ ) _⊂_ _χ_ ( _Tcj_ ) _,_ (S61) supp( _y_ _t_ ) _⊔_ supp( _y_ _c_ 1) _⊔· · · ⊔_ supp( _y_ _cl_ ) = supp( _y_ ) _._ (S62) Here, lhaf <sup>_∗_</sup> ( _y_ _c_ ) = _τc_ _ij_ - _∈τ_ _Bij,_ (S63) where the sum is over perfect matchings _τc_ satisfying _τc ∩_ ( _χ_ ( _t_ ) _× χ_ ( _t_ )) = _∅_ . _Proof._ Consider _y_ satisfying (S59) and a matching _τ_ with deg( _τ_ ) = _y_ . Let _Y_ _≡_ supp( _y_ ). First, we define a submatching _τt_ _≡_ _τ ∩_ ( _χ_ ( _t_ ) _×_ _χ_ ( _t_ )). We let _i, j_ _∈_ _Yt_ for such _ij_ . On the other hand, for _ij_ _∈_ _τ_, if _i̸ ∈_ _χ_ ( _t_ ) and _j_ _∈_ _χ_ ( _t_ ), or _i_ _∈_ _χ_ ( _t_ ) and _j̸_ _∈_ _χ_ ( _t_ ), or _i̸_ _∈_ _χ_ ( _t_ ) and _j̸_ _∈_ _χ_ ( _t_ ), one can find a child _c_ such that _i, j_ _∈_ _χ_ ( _Tc_ ) by definition of tree decomposition. We then define _τc_ such that _ij_ _∈_ _τc_ and let _ij_ _∈_ _Yc_ . Therefore, we now have a unique decomposition of a matching, _τ_ = _τt ⊔_ _τc_ 1 _⊔· · · ⊔_ _τcl_ _._ (S64) Also, the decomposition of _y_ into _y_ _t_ and _y_ _cj_ ’s following that of _Y_ guarantees the condition (S61), (S62). Conversely, if submatchings _τt_ and _τcj_ ’s are given that satisfy the above conditions, we can combine them to construct a matching _τ_ . Therefore, we obtain Eq. (S60). In a similar way as previous cases, one can rewrite _y_ _tc_ : _|_ supp(� _y_ _tc_ ) _|_ = _i_ lhaf <sup>_∗_</sup> ( _y_ _c_ ) = where the sum is over _y_ _tc_ such that _i_ ( _−_ 1) <sup>_|_</sup> <sup>_y_</sup> <sup>_tc|_</sup> lhaf( _y_ _tc_ )lhaf( _y_ _cc_ ) _,_ (S65) _y_ _c_ = _y_ _tc_ + _y_ _cc,_ supp( _y_ _tc_ ) _⊔_ supp( _y_ _cc_ ) = supp( _y_ _c_ ) _,_ supp( _y_ _tc_ ) _⊂_ _χ_ ( _t_ ) _._ (S66) Therefore, one can rewrite (S60) as lhaf( _y_ ) = lhaf( _y_ _t_ ) _j_ =1 - - _l_ lhaf( _y_ _tcj_ )lhaf( _y_ _ccj_ ) _,_ (S67) where the sum is over _y_ _t_, _ytcj_, and _dccj_ such that (S68) _y_ = _y_ _t_ + _l_ _j_ =1 ( _y_ _tcj_ + _y_ _ccj_ ) _,_ supp( _y_ ) = supp( _y_ _t_ ) _⊔_ supp( _y_ _tc_ 1) _⊔· · · ⊔_ supp( _y_ _tcl_ ) _⊔_ supp( _y_ _cc_ 1) _⊔· · · ⊔_ supp( _y_ _ccl_ ) _,_ _j_ =1 supp( _y_ _t_ ) _⊂_ _χ_ ( _t_ ) _,_ supp( _y_ _tcj_ ) _⊂_ _χ_ ( _t_ ) _∩_ _χ_ ( _tcj_ ) _,_ _χ_ ( _Tcj_ ) _\ χ_ ( _t_ ) _⊂_ sat( _y_ _ccj_ ) _⊂_ supp( _y_ _ccj_ ) _⊂_ _χ_ ( _Tcj_ ) _._ (S69) Using the recursive relation, we can compute lHaf( _B_ _m_ ) = lhaf( _m_ ) _/_ _m_ !. Let us analyze its complexity. At node _t_, all lhaf( _y_ _t_ ) can be computed recursively as follows: Let _B_ be an _n × n_ symmetric matrix. Consider _y_ _⊂_ _X_ and _y_ such that supp( _y_ ) = _Y_ . Then, letting _a_ 0 be the first element of _Y_, _ij_ - _∈π_ lhaf( _y_ ) = _y_ <sup><u>1</u></sup> ! _y_ ! _y_ <sup><u>1</u></sup> ! <sup>lHaf(</sup> <sup>_B_</sup> <sup>_y_</sup> <sup>) =</sup> _y_ <sup><u>1</u></sup> ! - _Y \{_ _π∈_ PM( _Y_ ) PM(� _Bij_ = <sup><u>1</u></sup> _x_ - _∈Y_ _x∈Y_ _Ba_ 0 _,x_ _Bij_ (S70) _y_ ! _π∈_ PM( _Y \{a_ 0 _,x}_ ) _ij∈π_ _ij_ - _∈π_ _ij∈π_ = <sup><u>1</u></sup> _y_ ! _x_ - _∈Y_ _x∈Y_ _x_ - _∈Y_ _x∈Y_ _Ba_ 0 _,x_ lHaf( _B_ _y_ _−_ _y_ _a_ 0 _,x_ ) = _y_ <sup><u>1</u></sup> ! _y_ ! _Ba_ 0 _,x_ ( _y_ _−_ _y_ _a_ 0 _,x_ )!lhaf( _y_ _−_ _y_ _a_ 0 _,x_ ) (S71) where _y_ _a_ 0 _,x_ is the weight vector corresponding to _{a_ 0 _, x}_ . For each _y_, we loop over at most _n_ elements, and for each we need _O_ ( _n_ ) to find the set _Y_ _\ {a_ 0 _, x}_ . Thus, we can compute lhaf( _y_ ) for all _y_ in _O_ ( _n_ <sup>2</sup> ( _c_ + 1) <sup>_n_</sup> ). On the other hand, for given values of lhaf( _y_ _t_ ) and lhaf( _y_ _cj_ ), lhaf( _y_ ) for all _y_ can be computed using a convolution with a fast Fourier transform, the complexity of which is given by _O_ ( _lw_ (2 _c_ + 1) <sup>_w_</sup> ) [9]. Therefore, the complexity at node _t_ is given by _O_ <sup>˜</sup> ((2 _c_ + 1) <sup>_w_</sup> ) for all _y_ at node _t_ . S2. SAMPLING ALGORITHMS A. Clifford-Clifford algorithm (single-photon boson sampling) In this section, we recall the Clifford-Clifford algorithm to simulate single-photon boson sampling [11]. Let us consider single-photon state input, _j_ - _∈S_ _|ψ_ in _⟩_ = _a_ ˆ <sup>_†_</sup> _j_ <sup>_|_</sup> <sup>0</sup> <sup>_⟩,_</sup> (S72) _a_ ˆ <sup>_†_</sup> _j_ _j∈S_ where _S_ represents the set of the position of input single photons. The Clifford-Clifford algorithm employs a standard Monte-Carlo method, which uses marginal probabilities. Consider a sampling from a probability distribution of _p_ ( _r_ ) = _p_ ( _r_ 1 _, . . ., rM_ ). The probability to obtain an outcome ( _r_ 1 _, . . ., rN_ ) can be decomposed as the conditional probabilities _p_ ( _r_ 1 _, . . ., rM_ ) = _p_ ( _r_ 1) _p_ ( _r_ 2 _|r_ 1) _· · · p_ ( _rM_ _|r_ 1 _, . . ., rM_ _−_ 1) _._ (S73) Thus, by sampling from _r_ 1 to _rM_ in order using conditional probabilities, which are obtained by marginal probabilities as _<u>p</u>_ <u>(</u> _<u>r</u>_ <u>1</u> _<u>, . . ., rk</u>_ <u>)</u> _p_ ( _rk|r_ 1 _, . . ., rk−_ 1) = _p_ ( _r_ 1 _, . . ., rk−_ 1) <sup>_._</sup> (S74) we can sample from a target probability distribution as well. In order to compute marginal probabilities of single-photon boson sampling, we introduce an expanded sample space for sampling from the photon number distribution of an output state following Ref. [11]. First, a photon number outcome _m_ = ( _m_ 1 _, . . ., mM_ ), where _mi_ represents the number of output photons in _i_ th mode, can be equivalently describedThe probabilityby _z_ =to( _z_ obtain1 _, . . ., z_ _z_ _N_ is) writtenwith _z_ 1 as _≤_ _z_ 2 _≤· · ·_ _≤_ _zN_, where _z_ represents the modes where a photon is detected. _p_ ( _r_ 1 _, . . ., rM_ ) = _p_ ( _r_ 1) _p_ ( _r_ 2 _|r_ 1) _· · · p_ ( _rM_ _|r_ 1 _, . . ., rM_ _−_ 1) _._ (S73) _<u>p</u>_ <u>(</u> _<u>r</u>_ <u>1</u> _<u>, . . ., rk</u>_ <u>)</u> _p_ ( _rk|r_ 1 _, . . ., rk−_ 1) = _p_ ( _r_ 1 _, . . ., rk−_ 1) <sup>_._</sup> (S74) <u>1</u> _p_ ( _z_ ) = _µ_ ( _z_ ) <sup>_|_</sup> <sup>Per(</sup> <sup>_U_</sup> _z_ <sup>_S_</sup> <sup>)</sup> <sup>_|_</sup> <sup>2</sup> <sup>_,_</sup> (S75) where _U_ _z_ <sup>_S_</sup> <sup>choosing</sup> _N_ - _N_ + _M_ _−_ 1 <sup>_zi_</sup> <sup>rows</sup> <sup>and</sup> <sup>columns</sup> <sup>corresponding</sup> <sup>to</sup> <sup>input</sup> . By expanding the sample space, we define _q_ ( _r_ ) _≡_ <sup><u>1</u></sup> where _U_ _z_ <sup>_S_</sup> <sup>is</sup> <sup>a</sup> <sup>matrix</sup> <sup>obtained</sup> <sup>by</sup> <sup>choosing</sup> <sup>_zi_</sup> <sup>rows</sup> <sup>and</sup> <sup>columns</sup> <sup>corresponding</sup> <sup>to</sup> <sup>input</sup> <sup>modes</sup> <sup>_j_</sup> <sup>_∈S_</sup> <sup>.</sup> <sup>Here,</sup> <sup>the</sup> number of different instances of _z_ is _N_ . By expanding the sample space, we define _q_ ( _r_ ) _≡_ _N_ <sup><u>1</u></sup> _N_ <sup><u>1</u></sup> ! <sup>_|_</sup> <sup>Per(</sup> <sup>_U_</sup> _r_ <sup>_S_</sup> _r_ <sup>_S_</sup> <sup>)</sup> <sup>_|_</sup> <sup>2</sup> <sup>_,_</sup> (S76) where _r_ = ( _r_ 1 _, . . ., rN_ ) _∈_ [ _M_ ] <sup>_N_</sup> is an unordered tuple. Note that _p_ ( _z_ ) = _N_ ! _q_ ( _z_ ) _/µ_ ( _z_ ) and that Per( _U_ _z_ <sup>_S_</sup> Thus, sampling from _q_ ( _r_ ) and sorting _r_ in ascending order is equivalent to sampling directly from _p_ ( _z_ _z_ <sup>_S_</sup> <sup>)</sup> <sup>=</sup> <sup>Per(</sup> <sup>_U_</sup> _r_ <sup>_S_</sup> where _r_ = ( _r_ 1 _, . . ., rN_ ) _∈_ [ _M_ ] <sup>_N_</sup> is an unordered tuple. Note that _p_ ( _z_ ) = _N_ ! _q_ ( _z_ ) _/µ_ ( _z_ ) and that Per( _U_ _z_ <sup>_S_</sup> <sup>)</sup> <sup>=</sup> <sup>Per(</sup> <sup>_U_</sup> _r_ <sup>_S_</sup> <sup>).</sup> Thus, sampling from _q_ ( _r_ ) and sorting _r_ in ascending order is equivalent to sampling directly from _p_ ( _z_ ). We expand the sampling space even further with an auxiliary array _α_ = ( _α_ 1 _, . . ., αN_ ), where _α_ is a permutation of _S_ . By defining _φ_ ( _r_ 1 _, . . ., rk|_ _α_ ) = _k_ <sup><u>1</u></sup> ! _k_ ! _r_ 1 _,...,rk_ <sup>)</sup> ��Per( _U α_ 1 _,...,αk_ is taken (S77) ��2 _,_ over uniform _α_, and we use for sampling one can prove that _q_ ( _r_ ) = E _α_ [ _φ_ ( _r_ _|_ _α_ )] [11], where the expectation is taken over uniform _α_, and we use for sampling _φ_ ( _r_ _|_ _α_ ) = _φ_ ( _r_ 1 _|_ _α_ ) _φ_ ( _r_ 2 _|r_ 1 _,_ _α_ ) _· · · φ_ ( _rN_ _|r_ 1 _, . . ., rN_ _−_ 1 _,_ _α_ ) _._ (S78) Therefore, one may perform boson sampling by computing a marginal probability _φ_ ( _r_ 1 _. . ., rk|_ _α_ ). B. Gaussian boson sampling classical algorithm In this section, we present a Gaussian boson sampling classical algorithm and show that such a algorithm can be used to take advantage of graph structure of a given circuit. Let us first briefly review a phase-space method to handle Gaussian states (See Refs. [12–15] for more details about Gaussian states.). Gaussian states are defined as ones that are described by a Gaussian distribution in phase space. Since it follows a Gaussian distribution, an _M_ -mode Gaussian state can be fully characterized by its 2 _M ×_ 2 _M_ (Wigner) covariance matrix _V_ and _M_ -dimensional first-moment vector _d_ . The first-moment vector and covariance matrix of a given quantum state _ρ_ ˆ are defined as _dj_ = Tr[ˆ _ρQ_ <sup>ˆ</sup> _j_ ] and _Vjk_ = Tr[ˆ _ρ{Q_ <sup>ˆ</sup> _j_ _−_ _dj,_ _Q_ <sup>ˆ</sup> _k_ _−_ _dk}_ ] _/_ 2 with a quadrature-operator vector _Q_ <sup>ˆ</sup> _≡_ (ˆ _x_ 1 _,_ ˆ _p_ 1 _, . . .,_ ˆ _xM_ _,_ ˆ _pM_ ), satisfying the canonical commutation relation [ _Q_ <sup>ˆ</sup> _j,_ _Q_ <sup>ˆ</sup> _k_ ] = _i_ Ω _jk_, where Ω _≡_ 1 _M_ _⊗_ 0 1 _._ (S79) - _−_ 1 0� In addition, the dynamics of the quantum state under Gaussian unitary transformations can be equivalently characterized by the symplectic transformation of its covariance matrix, namely, _U_ <sup>ˆ</sup> ˆ _ρU_ <sup>ˆ</sup> <sup>_†_</sup> _⇐⇒_ _SV S_ <sup>T</sup>, where symplectic matrices conserve the canonical commutation relation, _S_ <sup>T</sup> Ω _S_ = Ω. A squeezing operation and a beam splitter operation are a Gaussian unitary transformation. Therefore, we describe beam splitter arrays by using their symplectic transformation. For Gaussian boson sampling, we first begin with a vacuum state, the covariance matrix of which is given by 12 _M_ _/_ 2. We then apply a squeezing symplectic transformation on source modes in _S_, which is written as _S_ sq = _⊕_ <sup>_M_</sup> _i_ =1 <sup>diag(</sup> <sup>_eri, e−ri_</sup> <sup>)</sup> <sup>where</sup> <sup>_ri_</sup> <sup>=</sup> <sup>_r_</sup> <sup>for</sup> <sup>_i_</sup> <sup>_∈S_</sup> <sup>and</sup> <sup>_ri_</sup> <sup>=</sup> <sup>0</sup> <sup>otherwise.</sup> <sup>We</sup> <sup>assume</sup> <sup>a</sup> <sup>momentum-squeezing</sup> <sup>operation</sup> <sup>with</sup> a real positive squeezing parameter _r_ _>_ 0 without loss of generality. Thus, the covariance matrix of the input state _⊕_ <sup>_M_</sup> _i_ =1 <sup>diag(</sup> <sup>_eri, e−ri_</sup> <sup>)</sup> <sup>where</sup> <sup>_ri_</sup> <sup>=</sup> <sup>_r_</sup> <sup>for</sup> <sup>_i_</sup> <sup>_∈S_</sup> <sup>and</sup> <sup>_ri_</sup> <sup>=</sup> <sup>0</sup> <sup>otherwise.</sup> <sup>We</sup> <sup>assume</sup> <sup>a</sup> <sup>momentum-squeezing</sup> <sup>operation</sup> <sup>with</sup> a real positive squeezing parameter _r_ _>_ 0 without loss of generality. Thus, the covariance matrix of the input state is written as _V_ in = _S_ sq12 _M_ _S_ sq <sup>T</sup> <sup>_/_</sup> <sup>2</sup> <sup>=</sup> <sup>_⊕_</sup> _i_ <sup>_M_</sup> =1 <sup>diag(</sup> <sup>_e_</sup> <sup>2</sup> <sup>_ri, e−_</sup> <sup>2</sup> <sup>_ri_</sup> <sup>)</sup> <sup>_/_</sup> <sup>2.</sup> <sup>In</sup> <sup>addition,</sup> <sup>beam</sup> <sup>splitters</sup> <sup>are</sup> <sup>also</sup> <sup>Gaussian</sup> <sup>unitary</sup> is written as _V_ in = _S_ sq12 _M_ _S_ sq <sup>T</sup> <sup>_/_</sup> <sup>2</sup> <sup>=</sup> <sup>_⊕_</sup> _i_ <sup>_M_</sup> =1 <sup>diag(</sup> <sup>_e_</sup> <sup>2</sup> <sup>_ri, e−_</sup> <sup>2</sup> <sup>_ri_</sup> <sup>)</sup> <sup>_/_</sup> <sup>2.</sup> <sup>In</sup> <sup>addition,</sup> <sup>beam</sup> <sup>splitters</sup> <sup>are</sup> <sup>also</sup> <sup>Gaussian</sup> <sup>unitary</sup> operations, so that beam splitter operations between two modes can be characterized by symplectic matrices _S_ BS, which is formally written as sq <sup>T</sup> <sup>_/_</sup> <sup>2</sup> <sup>=</sup> <sup>_⊕_</sup> _i_ <sup>_M_</sup> _⊗_ 12 _._ (S80) _S_ BS = cos _θ_ _e_ <sup>_iφ_</sup> sin _θ_ cos _θ_ - _−e_ <sup>_−iφ_</sup> sin _θ_ The symplectic matrix corresponding to given beam splitter arrays of depths _D_ can be efficiently computed by matrix multiplications of 2 _M_ _×_ 2 _M_ beam splitter symplectic matrices. We now present more details about Gaussian boson sampling and its classical algorithm. We consider _N_ number of sources in _M_ bosonic modes with beam splitter arrays. We write a (complex) covariance matrix Σ _ij_ = Tr[ˆ _ρ{ξ_ <sup>ˆ</sup> _i,_ _ξ_ <sup>ˆ</sup> _j}_ ] _/_ 2 of the final Gaussian state _ρ_ ˆ with _ξ_ <sup>ˆ</sup> = (ˆ _a_ 1 _, . . .,_ ˆ _aM_ _,_ ˆ _a_ <sup>_†_</sup> 1 <sup>_, . . .,_</sup> <sup>ˆ</sup> <sup>_a†_</sup> _M_ <sup>) to follow a notational convention used in Refs.</sup> <sup>[16, 17].</sup> of the final Gaussian state _ρ_ ˆ with _ξ_ <sup>ˆ</sup> = (ˆ _a_ 1 _, . . .,_ ˆ _aM_ _,_ ˆ _a_ <sup>_†_</sup> 1 <sup>_, . . .,_</sup> <sup>ˆ</sup> <sup>_a†_</sup> _M_ <sup>) to follow a notational convention used in Refs.</sup> <sup>[16, 17].</sup> Note that a covariance Σ can be easily obtained by a (Wigner) covariance matrix _V_, Σ = _FV F_ <sup>_†_</sup>, where _F_ changes Note that a covariance Σ can be easily obtained by a (Wigner) covariance matrix _V_, Σ = _FV F_ <sup>_†_</sup>, where _F_ changes the order of quadrature operators as (ˆ _x_ 1 _,_ ˆ _p_ 1 _, . . .,_ ˆ _xM_ _,_ ˆ _pM_ ) to (ˆ _x_ 1 _, . . .,_ ˆ _xM_ _,_ ˆ _p_ 1 _, . . .,_ ˆ _pM_ ) and multiply _~~√~~_ <u>12</u> 11 _i_ _−i_ _⊗_ 1 _M_ . In the case of Gaussian states of a covariance matrix Σ and a zero displacement, the probability of�each �outcome ( _n_ 1 _, n_ 2 _, . . ., nM_ ) obtained by the measurement in photon-number basis is given by [16] the order of quadrature operators as (ˆ _x_ 1 _,_ ˆ _p_ 1 _, . . .,_ ˆ _xM_ _,_ ˆ _pM_ ) to (ˆ _x_ 1 _, . . .,_ ˆ _xM_ _,_ ˆ _p_ 1 _, . . .,_ ˆ _pM_ ) and multiply _~~√~~_ <u>1</u> 2 _F_ 1 _i_ 1 _−i_ �each <u>Haf(</u> _<u>A</u>_ _<u>m</u>_ <u>)</u> _m_ 1! _· · · mM_ ! <sup>_,_</sup> (S81) 0 1 _M_ 1 _M_ 0 where <u>1</u> _P_ ( _m_ 1 _, m_ 2 _, . . ., mM_ ) = det(Σ + 12 _M_ _/_ 2) ~~�~~ _A_ = _XM_ [12 _M_ _−_ (Σ + 12 _M_ _/_ 2) <sup>_−_</sup> <sup>1</sup> ] _,_ _Xm_ = _._ (S82) Here, _A_ _m_ is a matrix obtained by repeating the _j_ th and ( _j_ + _M_ )th row and column of _A_ for _nj_ times for 1 _≤_ _j_ _≤_ _M_, and Haf( _A_ ) is the hafnian of a matrix _A_ [18]. We supply a recently proposed classical algorithm to simulate Gaussian boson sampling in Ref. [19]. We first decompose a covariance matrix as _V_ out = _V_ + _W_, with _V_ = _SS_ <sup>T</sup> _/_ 2 and _W_ _≥_ 0, where _S_ is a symplectic matrix so that _V_ is a covariance matrix of a pure state. Thus, the Gaussian state of _V_ out can be interpreted as a mixture of states obtained by applying a random displacement sampled from a normal distribution of _W_ to a pure Gaussian state of _V_ . Hence, by applying a random displacement _µ_ sampled by a normal distribution with a covariance matrix _W_, we sample a pure Gaussian state having a covariance matrix _V_ and a mean vector _µ_ . We then sample ( _x_ 1 _, p_ 1 _, . . ., xM_ _, pM_ ) from a normal distribution with the covariance matrix _V_ + 1 _/_ 2 and transform the sample to a complex vector ( _α_ 1 _, . . ., αM_ ) with _αj_ _≡_ ( _xj_ + _ipj_ ) _/√_ 2. Based on the sample ( _α_ 2 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>), we compute</sup> _√_ 2. Based on the sample ( _α_ 2 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>), we compute</sup> conditional probability _p_ ( _m_ 1 _|α_ 2 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>),</sup> <sup>which</sup> <sup>can</sup> <sup>be</sup> <sup>computed</sup> <sup>by</sup> <sup>the</sup> <sup>conditional</sup> <sup>covariance</sup> <sup>matrix</sup> <sup>and</sup> <sup>mean</sup> vector. More explicitly, for _k_ _∈_ [ _M_ ], _<u>B</u>_ <sup>˜</sup> _<u>m</u>_ <sup>(</sup> <sup>_k_</sup> <sup>))</sup> <sup>_<u>|</u>_</sup> <sup>2</sup> (S83) _m_ 1! _. . . mk_ ! <sup>_,_</sup> <u>1</u> _P_ ( _m_ 1 _, . . ., mk|αk_ +1 _, . . ., αM_ ) = det(Σ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> + 12 _k/_ 2) ~~�~~ <u>lHaf(</u> _<u>A</u>_ <sup>˜(</sup> _<u>m</u>_ <sup>_k_</sup> <sup>)</sup> <u>lHaf(</u> _<u>A</u>_ <sup>˜(</sup> _<u>m</u>_ <sup>_k_</sup> <sup>))</sup> <u>1</u> _m_ 1! _. . . mk_ ! <sup>=</sup> det(Σ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> + 12 _k/_ 2) ~~�~~ _<u>|</u>_ <u>lHaf(</u> _<u>B</u>_ <sup>˜</sup> _<u>m</u>_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> _m_ 1! _. . . m_ _<u>m</u>_ <sup>(</sup> <sup>_k_</sup> <sup>))</sup> <sup>_<u>|</u>_</sup> <sup>2</sup> _k_ ! where lHaf( _A_ ) is the loop hafnian of a matrix _A_ [20] and Σ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> is the conditional covariance matrix for ( _αk_ +1 _, . . ., αM_ ), and we have used the block structure of _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> and _A_ <sup>˜(</sup> <sup>_k_</sup> <sup>)</sup> as (S84) _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> = _Xk_ [12 _k −_ (Σ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> + 12 _k/_ 2) <sup>_−_</sup> <sup>1</sup> ] = _B_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> _⊕_ _B_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> <sup>_∗_</sup> _,_ (S85) _A_ ˜ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> = fdiag( _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> _, γ_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> ) = _B_ ˜ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> _⊕_ _B_ ˜ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> <sup>_∗_</sup> _,_ where fdiag( _A, γ_ ) is a matrix filling the diagonal elements of _A_ by the vector _γ_, and _γ_ _≡_ (Σ + 1 _/_ 2) <sup>_−_</sup> <sup>1</sup> _α_ and _γ_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> is obtained similarly to _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> . Here, _B_ _m_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> is obtained similarly to _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> . Here, _B_ _m_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> <sup>is</sup> <sup>obtained</sup> <sup>by</sup> <sup>repeating</sup> <sup>_i_</sup> <sup>th</sup> <sup>column</sup> <sup>and</sup> <sup>row</sup> <sup>for</sup> <sup>_m_</sup> _i_ <sup>times</sup> <sup>from</sup> <sup>marginal</sup> probabilities. By directly computing the loop hafnian of _B_ <sup>˜</sup> _m_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> <sup>for</sup> <sup>0</sup> <sup>_≤_</sup> <sup>_m_</sup> 1 <sup>_≤_</sup> <sup>_m_</sup> max <sup>,</sup> <sup>we</sup> <sup>sample</sup> <sup>_n_</sup> 1 <sup>_∗_</sup> <sup>.</sup> <sup>Since</sup> <sup>_mj_</sup> <sup>can</sup> be infinitely large in principle, we choose an upper-threshold of _mj_ carefully (See Sec. S3). After obtaining _m_ <sup>_∗_</sup> 1 <sup>,</sup> <sup>we</sup> _m_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> <sup>for</sup> <sup>0</sup> <sup>_≤_</sup> <sup>_m_</sup> 1 <sup>_≤_</sup> <sup>_m_</sup> max <sup>,</sup> <sup>we</sup> <sup>sample</sup> <sup>_n_</sup> 1 <sup>_∗_</sup> of _mj_ carefully (See Sec. S3). After be infinitely large in principle, we choose an upper-threshold of _mj_ carefully (See Sec. S3). After obtaining _m_ <sup>_∗_</sup> 1 <sup>,</sup> <sup>we</sup> discard _α_ 2 and continue to sample _n_ 2 by computing _p_ ( _m_ <sup>_∗_</sup> 1 <sup>_, m_</sup> <sup>2</sup> <sup>_|α_</sup> 3 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>)</sup> <sup>for</sup> <sup>0</sup> <sup>_≤_</sup> <sup>_m_</sup> <sup>2</sup> <sup>_≤_</sup> <sup>_m_</sup> max <sup>_∗_</sup> <sup>.</sup> <sup>We</sup> <sup>continue</sup> <sup>the</sup> <sup>_∗_</sup> 1 <sup>_, m_</sup> <sup>2</sup> <sup>_|α_</sup> 3 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>)</sup> <sup>for</sup> <sup>0</sup> <sup>_≤_</sup> <sup>_m_</sup> <sup>2</sup> <sup>_≤_</sup> <sup>_m∗_</sup> discard _α_ 2 and continue to sample _n_ 2 by computing _p_ ( _m_ <sup>_∗_</sup> 1 <sup>_, m_</sup> <sup>2</sup> <sup>_|α_</sup> 3 <sup>_∗, . . ., α_</sup> _M_ <sup>_∗_</sup> <sup>)</sup> <sup>for</sup> <sup>0</sup> <sup>_≤_</sup> <sup>_m_</sup> <sup>2</sup> <sup>_≤_</sup> <sup>_m_</sup> max <sup>_∗_</sup> <sup>.</sup> <sup>We</sup> <sup>continue</sup> <sup>the</sup> procedure and finally obtain a sample ( _m_ <sup>_∗_</sup> 1 <sup>_, . . ., m∗_</sup> _M_ <sup>).</sup> procedure and finally obtain a sample ( _m_ <sup>_∗_</sup> 1 <sup>_, . . ., m∗_</sup> _M_ <sup>).</sup> We now show that such a algorithm can be exploited to take advantage of graph structure by showing that marginal probabilities also enjoy the same structure. Let us simplify the expression _A_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> and _B_ <sup>(</sup> <sup>_k_</sup> <sup>)</sup> . We recall that for a block matrix of partitions _A_ and _B_, _,_ (S86) _M_ = _MA_ _MAB_ - _MBA_ _MB_ thepropertySchurthatcomplement is defined as _M/MB_ _≡_ _MA −_ _MAB_ ( _MB_ ) <sup>_−_</sup> <sup>1</sup> _MBA_ [21]. Especially, the Schur complement has a ( _M_ <sup>_−_</sup> <sup>1</sup> ) _A_ = ( _M/MB_ ) <sup>_−_</sup> <sup>1</sup> _._ (S87) According to the algorithm above, we only need to be able to sample from a conditional (by heterodyne detection) pure Gaussian state to simulate Gaussian boson sampling. Especially, the conditional covariance matrix from heterodyne detection on _B_ is given by _VA_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> = ( _V_ + 1 _/_ 2) _/_ ( _V_ + 1 _/_ 2) _B −_ 1 _/_ 2 [15]. Let us define _QA_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _≡_ Σ _A_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> <sup>+ 1</sup> <sup>_/_</sup> <sup>2.</sup> <sup>One</sup> <sup>can</sup> <sup>easily</sup> _A_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> = ( _V_ + 1 _/_ 2) _/_ ( _V_ + 1 _/_ 2) _B −_ 1 _/_ 2 [15]. Let us define _QA_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _A_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _≡_ Σ _A_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> detection on _B_ is given by _VA_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> = ( _V_ + 1 _/_ 2) _/_ ( _V_ + 1 _/_ 2) _B −_ 1 _/_ 2 [15]. Let us define _QA_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _≡_ Σ _A_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> <sup>+ 1</sup> <sup>_/_</sup> <sup>2.</sup> <sup>One</sup> <sup>can</sup> <sup>easily</sup> check that we can rewrite _Q_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _A_ = _Q/QB_ . When we have a Gaussian state with a covariance matrix _V_ and a mean vector _d_, the mean vector of a conditional probability after obtaining _µB_ by heterodyne detection is given by [15] _d_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> (S88) _A_ = _dA_ + _VAB_ ( _VB_ + 1 _/_ 2) <sup>_−_</sup> <sup>1</sup> ( _µB −_ _dB_ ) _._ Now, to compute a marginal probability, we invert _Q_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> <sup>(</sup> <sup>_B_</sup> <sup>)</sup> as _A_ 1 _−_ ( _Q_ <sup>_−_</sup> <sup>1</sup> ) _A_ = _X_ - �1 _−_ _Q_ <sup>_−_</sup> <sup>1�</sup> _AA_ _≡_ _X_ _Q_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> 1 _−_ _A_ - = _X_ - _−_ 1 <sup>�</sup> _A_ <sup>_._</sup> (S89) = ( _Q/QB_ ) <sup>_−_</sup> <sup>1</sup> = ( _Q_ <sup>_−_</sup> <sup>1</sup> ) _A_ . After rewriting - _−_ 1 <sup>_−_</sup> <sup>1</sup> ( _U_ _⊕_ _U_ <sup>_∗_</sup> ) <sup>_†_</sup>, where Here, we have used the Schur complement’s property of Eq. (S87), _Q_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _A_ 1 _/_ 2) _A_ _Q_ = ( _U_ _⊕_ _U_ <sup>_∗_</sup> ) _T_ ( _U_ _⊕_ _U_ <sup>_∗_</sup> ) <sup>_†_</sup> + 1 _/_ 2, we can find _Q_ <sup>_−_</sup> <sup>1</sup> = ( _U_ _⊕_ _U_ <sup>_∗_</sup> )( _T_ + 1 _/_ 2) <sup>_−_</sup> <sup>1</sup> ( _U_ _⊕_ _U_ <sup>_∗_</sup> ) <sup>_†_</sup>, where 1 _−⊕i_ <sup>_M_</sup> _i_ =1 <sup>tanh</sup> <sup>_ri_</sup> - _−⊕_ <sup>_M_</sup> 1 _−⊕i_ <sup>_M_</sup> =1 <sup>tanh</sup> <sup>_ri_</sup> _−⊕i_ <sup>_M_</sup> =1 <sup>tanh</sup> <sup>_ri_</sup> 1 _i_ =1 <sup>sinh2</sup> <sup>_ri_</sup> <sup>_M_</sup> _i_ <sup>_M_</sup> =1 <sup>tanh</sup> <sup>_ri_</sup> 1 _,_ ( _T_ + 1 _/_ 2) <sup>_−_</sup> <sup>1</sup> = _._ (S90) _T_ = _i_ _⊕_ <sup>_M_</sup> _i_ =1 - _⊕_ <sup>_M_</sup> _⊕i_ <sup>_M_</sup> =1 <sup>sinh2</sup> <sup>_ri_</sup> _⊕i_ <sup>_M_</sup> =1 <sup>sinh</sup> <sup>_ri_</sup> <sup>cosh</sup> <sup>_ri_</sup> _i_ =1 <sup>sinh</sup> <sup>_ri_</sup> <sup>cosh</sup> <sup>_ri_</sup> _i_ =1 <sup>sinh2</sup> <sup>_ri_</sup> _⊕_ <sup>_M_</sup> _⊕_ <sup>_M_</sup> _i_ =1 <sup>sinh</sup> <sup>_ri_</sup> <sup>cosh</sup> <sup>_ri_</sup> _i_ <sup>_M_</sup> _⊕_ <sup>_M_</sup> _i_ <sup>_M_</sup> =1 <sup>sinh2</sup> <sup>_ri_</sup> _⊕i_ <sup>_M_</sup> Thus, _AA_ = _BA ⊕_ _BA_ <sup>_∗_</sup> <sup>,</sup> <sup>with</sup> <sup>_BA_</sup> <sup>= [</sup> <sup>_U_</sup> <sup>(</sup> <sup>_⊕i_</sup> <sup>tanh</sup> <sup>_ri_</sup> <sup>)</sup> <sup>_U_</sup> <sup>T]</sup> <sup>_A_</sup> <sup>.</sup> <sup>Finally,</sup> <sup>_A_</sup> <sup>˜</sup> <sup>_A_</sup> <sup>= fdiag(</sup> <sup>_AA, γA_</sup> <sup>)</sup> <sup>and</sup> <sup>_B_</sup> <sup>˜</sup> <sup>_A_</sup> <sup>= fdiag(</sup> <sup>_BA, γA_</sup> <sup>).</sup> <sup>Here,</sup> _γA_ = [ _Q_ <sup>_−_</sup> <sup>1</sup> ] _A_ _α_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> and _α_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> is a complex mean vector transformed from _d_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>).</sup> <sup>Since</sup> <sup>marginal</sup> <sup>probabilities</sup> <sup>depend</sup> <sup>on</sup> Thus, _AA_ = _BA ⊕_ _BA_ <sup>_∗_</sup> and <sup>(</sup> <sup>_B_</sup> <sup>)</sup> is a complex mean vector transformed from _d_ <sup>(</sup> <sup>_B_</sup> <sup>)</sup> _A_ _A_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> and _α_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> _γA_ = [ _Q_ <sup>_−_</sup> <sup>1</sup> ] _A_ _α_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> and _α_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>)</sup> is a complex mean vector transformed from _d_ <sup>(</sup> _A_ <sup>_B_</sup> <sup>).</sup> <sup>Since</sup> <sup>marginal</sup> <sup>probabilities</sup> <sup>depend</sup> <sup>on</sup> the loop hafnian of _B_ <sup>˜</sup> _A_ and its graph can be obtained by simply discarding vertices for part _B_ (conditioning part), marginal probabilities follow the graph structure of a probability. C. Proof of Theorem 1 To simulate single-photon boson sampling, we implement the Clifford-Clifford algorithm by computing marginal probabilities _φ_ ( _r_ 1 _, . . ., rk|_ _α_ ) with _k_ = 1 _, . . ., N_ . At each _k_ _∈_ [ _N_ ], we compute _M_ marginal probabilities, corresponding to Per( _Ur_ <sup>_α_</sup> 1 <sup>1</sup> _,...,r_ <sup>_,...,α_</sup> _k_ <sup>_k_</sup> <sup>),</sup> <sup>so</sup> <sup>the</sup> <sup>maximal</sup> <sup>complexity</sup> <sup>is</sup> <sup>_O_</sup> <sup>(</sup> <sup>_MNw_</sup> <sup>22</sup> <sup>_w_</sup> <sup>).</sup> <sup>One</sup> <sup>can</sup> <sup>easily</sup> <sup>see</sup> <sup>that</sup> <sup>the</sup> <sup>bipartite</sup> <sup>graphs</sup> <sup>corre-</sup> sponding to marginal probabilities are minors of a bipartite graph for a probability. Since we iterate for _k_ _∈_ [ _N_ ], the total complexity of sampling is at most _O_ ( _MN_ <sup>2</sup> _w_ <sup>2</sup> 2 <sup>_w_</sup> ). For Gaussian boson sampling, at each step _k_ _∈_ [ _M_ ], we need to compute total two marginal probabilities corresponding to the conditional covariance matrices, i.e., zero and a single photon, and each of those is a loop hafnian of _k_ _× k_ matrix, having the maximal complexity _O_ ( _Nw_ <sup>2</sup> 2 <sup>_w_</sup> ). Thus, the total complexity is _O_ ( _MNw_ <sup>2</sup> 2 <sup>_w_</sup> ). S3. ERROR OF PHOTON-NUMBER TRUNCATION In this section, we analyze the influence of photon-number truncation in squeezed states. When we have _N_ squeezed vacuum states and measure them in photon-number basis, the probability to generate a total of _k_ photon pair events (2 _k_ photons) is given by the negative binomial distribution [16, 22] _PN_ ( _k_ ) = 2 <sup>+</sup> <sup>_k −_</sup> <sup>1</sup> sech <sup>_N_</sup> _r_ tanh <sup>2</sup> <sup>_k_</sup> _r._ (S91) _k_ - _<u>N</u>_ Note that beam splitter arrays do not change the probability distribution of total photon numbers. The tail probability of the negative binomial distribution is given by [23] _._ (S92) Pr( _k_ _> αN_ sech <sup>2</sup> _r_ ) _≤_ exp 2 - _<u>−αN</u>_ <u>(1</u> _<u>−</u>_ <u>1</u> _<u>/α</u>_ <u>)2</u> While increasing a constant _α_ decreases the truncation error exponentially, the order of the complexity of sampling does not change. Any accuracy can be achieved by increasing _α_ with a constant factor which reduces error exponentially. In order to make the truncation error to be smaller than _ϵ_ for sufficiently large _α_, we may choose _αN_ sech <sup>2</sup> _r_ = 2sech <sup>2</sup> _r_ log(1 _/ϵ_ ) _≡_ _m_ max. S4. APPROXIMATION METHOD A. Approximation of a unitary matrix Let _U_ be a true unitary transformation matrix. Our approximation strategy is _U_ _→_ _U_ <sup>˜</sup> _≡_ _U_ _−_ _dU_, where we have removed unitary matrix elements for jump more than diffusive dynamics. Note that _U_ <sup>˜</sup> is no longer unitary in general. We provide an approximation algorithm and the upper bound of its simulation error. We first extend _U_ <sup>˜</sup> to a unitary matrix in 2 _M_ _×_ 2 _M_ . Using singular value decomposition, _U_ <sup>˜</sup> = _RDV_, we transform _U_ ˜ _→_ _U_ ¯ = _U/κ_ ˜ to make the singular values smaller than 1, i.e., _κ_ is chosen to be the maximum singular value or 1 if the maximum singular value is smaller than 1, and define _U_ <sup>¯</sup> _≡_ _RDV_ <sup>¯</sup> = _RDV/κ_ <sup>˜</sup> . Note that in practice one may merely replace singular values larger than 1 by 1, while we divide them by the maximum for simplicity of the proof. By Mirsky’s theorem [24], we have (˜ _σ_ 1 _−_ _σ_ 1) <sup>2</sup> _≤_ _i_ _i_ _F_ (S93) <sup>2</sup> _F_ (˜ _σi −_ _σi_ ) <sup>2</sup> _≤∥dU_ _∥_ <sup>2</sup> where _σi_ ’s are singular values of _U_, i.e., _σi_ = 1 and _σ_ ˜ _i_ ’s are singular values of _U_ <sup>˜</sup> in descending order. Thus, ( _κ −_ 1) <sup>2</sup> _≤∥dU_ _∥_ <sup>2</sup> _F_ <sup>.</sup> <sup>Defining</sup> <sup>_µ_</sup> <sup>=</sup> <sup>_κ −_</sup> <sup>1,</sup> <sup>_µ_</sup> <sup>2</sup> <sup>_≤∥dU_</sup> <sup>_∥_</sup> <sup>2</sup> _F_ <sup>.</sup> <sup>Now</sup> <sup>we</sup> <sup>extend</sup> <sup>the</sup> <sup>matrix</sup> <sup>_U_</sup> <sup>¯</sup> <sup>to</sup> <sup>a</sup> <sup>2</sup> <sup>_M_</sup> <sup>_×_</sup> <sup>2</sup> <sup>_M_</sup> <sup>unitary</sup> <sup>matrix</sup> <sup>2</sup> _F_ <sup>.</sup> <sup>Defining</sup> <sup>_µ_</sup> <sup>=</sup> <sup>_κ −_</sup> <sup>1,</sup> <sup>_µ_</sup> <sup>2</sup> <sup>_≤∥dU_</sup> <sup>_∥_</sup> <sup>2</sup> _F_ <sup>2</sup> _F_ <sup>.</sup> <sup>Now</sup> <sup>we</sup> <sup>extend</sup> <sup>the</sup> <sup>matrix</sup> <sup>_U_</sup> <sup>¯</sup> <sup>to</sup> <sup>a</sup> <sup>2</sup> <sup>_M_</sup> <sup>_×_</sup> <sup>2</sup> <sup>_M_</sup> <sup>unitary</sup> <sup>matrix</sup> _√_ _._ (S94) _W_ = _<u>U</u>_ ¯ _R_ _R√_ - 1 _−_ _D_ <sup><u>¯</u></sup> <sup>2</sup> _V_ _<u>U</u>_ ¯ _R√_ 1 _−_ _D_ <sup><u>¯</u></sup> <sup>2</sup> _V_ _R√_ 1 _−_ _D_ <sup><u>¯</u></sup> <sup>2</sup> _V_ _−U_ <sup>¯</sup> _√_ 1 _−_ _D_ <sup><u>¯</u></sup> <sup>2</sup> _V_ _−U_ <sup>¯</sup> areWe closealso extendif the approximationa true unitary ofmatrix _U_ is intosmall:a 2 _M_ _×_ 2 _M_ matrix as _U_ 2 _M_ _≡_ _U_ _⊕_ ( _−U_ ). One can check that _U_ 2 _M_ and _W_ _∥dW_ _∥_ <sup>2</sup> _F_ _F_ <sup>2</sup> <sup>= Tr(</sup> <sup>_W_</sup> <sup>_−_</sup> <sup>_U_</sup> <sup>2</sup> <sup>_M_</sup> <sup>)</sup> <sup>_†_</sup> <sup>(</sup> <sup>_W_</sup> <sup>_−_</sup> <sup>_U_</sup> <sup>2</sup> <sup>_M_</sup> <sup>) = 2</sup> <sup>_∥U_</sup> <sup>¯</sup> <sup>_−_</sup> <sup>_U_</sup> <sup>_∥_</sup> <sup>2</sup> _F_ <sup>2</sup> _F_ <sup>_≡∥W_</sup> <sup>_−_</sup> <sup>_U_</sup> <sup>2</sup> <sup>_M_</sup> <sup>_∥_</sup> _F_ <sup>2</sup> <sup>2</sup> _F_ <sup>+ Tr(1</sup> <sup>_−_</sup> <sup>_D_</sup> <sup>¯</sup> <sup>2)</sup> <sup>_,_</sup> (S95) where and 2 _∥U_ <sup>¯</sup> _−_ _U_ _∥F_ <sup>2</sup> <sup>=</sup> ����� _<u>U</u>_ ˜ _µ_ + 1 <sup>_−_</sup> <sup>_U_</sup> _F_ <sup>2</sup> _F_ <sup>_≤_</sup> <sup>(</sup> _√_ _M_ + 1) <sup>2</sup> _∥dU_ _∥F_ <sup>2</sup> <sup>_,_</sup> (S96) _M_ + 1) <sup>2</sup> _∥dU_ _∥F_ <sup>2</sup> _≤∥U_ _−_ _dU_ _−_ (1 + _µ_ ) _U_ _∥_ <sup>2</sup> _F_ <sup>2</sup> _F_ <sup>=</sup> <sup>_∥dU_</sup> <sup>+</sup> <sup>_µU_</sup> <sup>_∥_</sup> <sup>2</sup> _F_ ����� _M_ _i_ =1 <u>�</u> _≤_ <u>�</u> _M_ ~~�~~ ~~�~~ _i_ =1 �� _<u>σ</u>_ <u>˜</u> _<u>i</u>_ 1 + 1 + _µ_ <u>�</u> <u>�2</u> _iM_ =1 _<u>σ</u>_ <u>˜</u> _<u>i</u>_ 1 _−_ 1 + _µ_ <u>�</u> (S97) <u>�2</u> _<u>σ</u>_ <u>˜</u> _<u>i</u>_ _<u>σ</u>_ <u>˜</u> _<u>i</u>_ 1 + 1 + _µ_ 1 _−_ 1 + _µ_ - �� <u>�</u> Tr(1 _−_ _D_ <sup>¯</sup> <sup>2</sup> ) = Tr <u>�</u> _<u>D</u>_ ˜ <sup>2</sup> 1 _<u>−</u>_ (1 + _µ_ (1 + _µ_ ) <sup>2</sup> = _M_ ( _√_ _M_ + 1) _∥dU_ _∥F ._ (S98) _≤_ _M_ ~~�~~ ~~�~~ _i_ =1 �� _i_ =1 _√_ _√_ _<u>σ</u>_ <u>˜</u> _<u>i</u>_ 1 + 1 + _µ_ <u>�</u> ( <u>�2</u> _M_ + 1) _∥dU_ _∥F_ _≤_ 2 Here, the first inequality follows from the Cauchy-Schwarz inequality, and the second inequality follows from the Mirsky’s theorem and the fact that _σ_ ˜ _i/_ (1 + _µ_ ) _≤_ 1 is the singular values of _D_ <sup>¯</sup> . Hence, _M_ + 1) _∥dU_ _∥F_ _≤_ 2( _√_ _M_ + 1) <sup>2</sup> ( _∥dU_ _∥_ <sup>2</sup> _F_ <sup>+</sup> <sup>_∥dU_</sup> <sup>_∥F_</sup> <sup>)</sup> <sup>_._</sup> (S99) _F_ <sup>2</sup> <sup>+ 2</sup> _M_ ( _√_ _∥dW_ _∥_ <sup>2</sup> _F_ _√_ _√_ _∥_ <sup>2</sup> _F_ <sup>_≤_</sup> <sup>2(</sup> _M_ + 1) <sup>2</sup> _∥dU_ _∥F_ <sup>2</sup> B. Single-photon state approximation Our approximation algorithm operates as follows: We first approximate a unitary matrix by a nonunitary matrix _U_ ˜ = _U −_ _dU_ and obtain the extended 2 _M ×_ 2 _M_ unitary matrix _W_ as Sec. S4 A. We then employ the Clifford-Clifford algorithm. Running the algorithm, at _k_ th step, we compute _φ_ ( _r_ 1 _, . . ., rk|_ _α_ ) as Eq. (S77) for _rk_ from 1 to _M_ for given _r_ 1 _, . . ., rk−_ 1. For those cases, the graph structure of an approximated matrix _U_ <sup>˜</sup> can be employed so that it can be computed by using dynamical programming. More specifically, the relevant bipartite graph has vertices for the sources and ( _r_ 1 _, . . ., rk_ ), depends only on _U_ <sup>˜</sup> . Since we do not cover all outcomes _rk_ from _M_ +1 to 2 _M_, the probability sum over _rk_ = 1 _, . . ., M_ can be less than zero, meaning that we have a chance to detect photons outside of the first _M_ modes. For these cases, we return “out”, and otherwise we continue. Such a way guarantees that we obtain photons only at the first _M_ modes as we desire. Let us analyze the total variation distance: (S100) (S101) ������ _x̸_ ������ _x_ = _̸_ - _xM_ _⊕_ 0 _̸_ - _xM_ ( _P_ ideal( _x_ ) _−_ _P_ approx( _x_ )) TVD = <sup><u>1</u></sup> 2 _≤_ 2 <sup><u>1</u></sup> _x_ _x_ - _xM_ _|P_ ideal( _x_ ) _−_ _P_ approx( _x_ ) _|_ + 2 <sup><u>1</u></sup> _x_ = _xM_ _⊕_ 0 _|P_ ideal( _x_ ) _−_ _P_ approx( _x_ ) _| ≤_ <sup>_<u>N</u>_</sup> 2 (S101) <sup>_<u>N</u>_</sup> 2 <sup>_∥dW_</sup> <sup>_∥F ._</sup> inequality is from Ref.where _xM_ _⊕_ 0 represents[25], which states that the TVD is bounded by the operator norm of two unitary transformationoutcomes for which photon numbers are zero other than the first _M_ modes. The second matrices, and the last inequality follows from the definition of the operator norm and Frobenious norm. C. Gaussian state approximation For Gaussian boson sampling as well, we first extend an approximated matrix _U_ <sup>˜</sup> = _U_ _−_ _dU_ to _W_ and transform it to a symplectic matrix. Our Gaussian state’s covariance matrix is then written as _V_ ¯2 _M_ = _SW_ ( _D ⊕_ 1 _M_ _/_ 2) _SW_ <sup>T</sup> <sup>_,_</sup> (S102) where the added 1 _M_ _/_ 2 represent vacuum. The true extended covariance matrix can be written as _V_ 2 _M_ = ( _SU_ _⊕_ _S−U_ )( _D ⊕_ 1 _M_ _/_ 2)( _SU_ _⊕_ _S−U_ ) <sup>T</sup> _._ (S103) First, we show that the distance between the approximated and true covariance matrices are bounded by the Frobenius norm of unitary matrices, _∥V_ 2 _M_ _−_ _V_ <sup>¯</sup> 2 _M_ _∥F_ = _∥SDS_ <sup>_T_</sup> _−_ _SD_ <sup>¯</sup> _S_ <sup>¯T</sup> _<u>∥F</u>_ _<u>≤</u>_ 2 _<u>∥S −</u>_ _S_ <sup>¯</sup> _<u>∥F ∥D∥F ∥S∥F</u>_ = _∥S −_ _S_ <sup>¯</sup> _∥F_ 2 _M_ [ _N_ cosh 4 _r_ + ( _M_ _−_ _N_ )] - (S104) _M_ [ _N_ cosh 4 _r_ + ( _M_ _−_ _N_ )] _._ ~~�~~ _≤_ 2 _∥dW_ _∥F_ 2 _M_ [ _N_ cosh 4 _r_ + ( _M_ _−_ _N_ )] Finally, since we only care about the output photons at the first _M_ modes, we postselect such outcomes. This can be implemented by first computing the probability to obtain nonzero photons for the additional _M_ modes and sample from the binary. If photons click for the modes, then we return “out”, otherwise we proceed the algorithm by using conditional covariance matrix for the first _M_ modes. Such a way leads to the TVD as TVD = <sup><u>1</u></sup> 2 _xM_ _⊕_ 0 - _M_ _⊕_ _x_ 2 _M_ _x_ 2 _M_ 1 _−_ _F_ ( _V_ 2 _M_ _,_ _V_ <sup>¯</sup> 2 _M_ ) _|P_ ideal( _x_ ) _−_ _P_ approx( _x_ ) _| ≤_ 2 <sup><u>1</u></sup> _F_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> _≤∥dW_ _∥F_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> _|P_ ideal( _x_ ) _−_ _P_ approx( _x_ ) _| ≤_ _F_ _≤_ ( _N_ cosh 4 _r/_ 2) <sup>1</sup> <sup>_/_</sup> <sup>4</sup> _∥V_ 2 _M_ _−_ _V_ <sup>¯</sup> 2 _M_ _∥_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> _F_ <sup>1</sup> <sup>_/_</sup> <sup>2poly(</sup> <sup>_N_</sup> <sup>)</sup> <sup>_._</sup> (S105) Here, the second and third inequalities are found as follows: Recall that total variation distance can be bounded by quantum infidelity 1 _−_ _F_ [26], 2 <sup><u>1</u></sup> <sup>_∥ρ_</sup> <sup>ˆ</sup> <sup>_−_</sup> <sup>_ρ_</sup> <sup>ˆ</sup> <sup>_a∥≤_</sup> �1 _−_ _F_ (ˆ _ρ,_ ˆ _ρa_ ) _._ (S106) <u>1</u> 2 _x_ _x_ _|P_ ( _x_ ) _−_ _Pa_ ( _x_ ) _| ≤_ 2 <sup><u>1</u></sup> Quantum fidelity between two _M_ -mode Gaussian states characterized by covariance matrices _V_ 1 _, V_ 2 and zero means, one of which is pure, can be written as [27, 28] <u>1</u> _F_ ( _V_ 1 _, V_ 2) = det( _V_ 1 + _V_ 2) ~~�~~ _ρ_ ˆ _,_ (S107) where we used a covariance matrix instead of quantum state _ρ_ ˆ in the argument because a covariance matrix completely characterizes a quantum state in our case. The following lemma shows that the quantum infidelity between two Gaussian states characterized by _V_ 1 and _V_ 2 can be bounded by the Frobenius norm _∥· ∥F_ of their difference matrix _X_ = _V_ 1 _−_ _V_ 2. Lemma 7. Let _V_ 1 be a covariance matrix of a Gaussian state in bosonic modes _M_ obtained by applying beam splitter arrays on single-mode squeezed states of squeezing parameter _r_ and _V_ 2 be a covariance matrix of a Gaussian state. <u>For</u> <u>small</u> _<u>∥X∥F</u>_, the quantum infidelity between the two Gaussian states is bounded by 1 _−_ _F_ ( _V_ 1 _, V_ 2) _≤_ _∥X∥F_ _N_ cosh 4 _r/_ 2. _Proof._ �Note that the covariance matrix _V_ 1 can be decomposed as _V_ 1 = _S_ (12 _M_ _/_ 2) _S_ <sup>T</sup> by a symplectic matrix _S_ satisfying _S_ Ω _S_ <sup>T</sup> = Ωand that the symplectic matrix can be decomposed as _S_ = _OS_ sq, where _O_ represents a symplectic matrix corresponding to beam splitter arrays and _S_ sq represents squeezing operators to generate squeezed vacuum sources. We then have <u>For</u> <u>small</u> _<u>∥X</u>_ _N_ cosh 4 _r/_ 2. det( _V_ 1 + _V_ 2) = det(2 _V_ 1 _−_ _X_ ) = det(12 _M_ _−_ _S_ <sup>_−_</sup> <sup>1</sup> _XS_ <sup>_−_</sup> <sup>T</sup> ) _≤_ <u>1</u> 1 + <u>�</u> 2 _M_ <sup>_|_</sup> <sup>Tr[</sup> <sup>_S−_</sup> <sup>1</sup> <sup>_XS−_</sup> <sup>T]</sup> <sup>_|_</sup> �2 _M_ _≤_ �2 _M_ 1 _−_ <sup><u>1</u></sup> 2 <sup>_∥X∥F ∥S−_</sup> <sup>T</sup> <sup>_S−_</sup> <sup>1</sup> <sup>_∥F_</sup> _,_ (S108) - _−_ 2 _≤_ <u>1</u> 1 + - 2 _M_ <sup>_∥X∥F ∥S−_</sup> <sup>T</sup> <sup>_S−_</sup> <sup>1</sup> <sup>_∥F_</sup> where for the first inequality, we have used the symmetric property of _X_ and the inequality of arithmetic geometric means and the fact that Tr[ _S_ <sup>_−_</sup> <sup>1</sup> _XS_ <sup>_−_</sup> <sup>T</sup> ] = Tr[ _S_ <sup>_−_</sup> <sup>1</sup> ( _V_ 1 _−_ _V_ 2) _S_ <sup>_−_</sup> <sup>T</sup> ] = Tr[12 _M_ _/_ 2 _−_ _S_ <sup>_−_</sup> <sup>1</sup> _V_ 2 _S_ <sup>_−_</sup> <sup>T</sup> ] = Tr[12 _M_ _/_ 2 _−_ _V_ <sup>˜</sup> 2] _≤_ 0 _._ (S109) The Cauchy-Schwarz inequality has been used for the second inequality. For the last inequality, we used (1+ _x/M_ ) <sup>_M_</sup> _≤_ (1 _−_ _x_ ) <sup>_−_</sup> <sup>1</sup> for 0 _≤_ _x_ _≤_ 1. Then, the quantum fidelity between Gaussian states with covariance matrices _V_ 1 and _V_ 2 is approximated as Tr[ _S_ <sup>_−_</sup> <sup>1</sup> _XS_ <sup>_−_</sup> <sup>T</sup> ] = Tr[ _S_ <sup>_−_</sup> <sup>1</sup> ( _V_ 1 _−_ _V_ 2) _S_ <sup>_−_</sup> <sup>T</sup> ] = Tr[12 _M_ _/_ 2 _−_ _S_ <sup>_−_</sup> <sup>1</sup> _V_ 2 _S_ <sup>_−_</sup> <sup>T</sup> ] = Tr[12 _M_ _/_ 2 _−_ _V_ <sup>˜</sup> 2] _≤_ 0 _._ (S109) <u>1</u> 1 _−_ _F_ ( _V_ 1 _, V_ 2) = 1 _−_ det( _V_ 1 + _V_ 2) ~~�~~ _≤_ 2 <sup><u>1</u></sup> <sup>_∥X∥F ∥S−T S−_</sup> <sup>1</sup> <sup>_∥F_</sup> <sup>=</sup> _N_ cosh 4 _r/_ 2 _∥X∥F ._ (S110) ~~�~~ D. Proof of Theorem 2 According to Theorem 1, we can perform exact samplings in _O_ ( _MN_ <sup>2</sup> _w_ <sup>2</sup> 2 <sup>_w_</sup> ) (single-photon boson sampling up to threshold) and in _O_ ( _MNw_ <sup>2</sup> 2 <sup>_w_</sup> ) (Gaussian boson sampling) for collision-free cases. Therefore, by Eq. (S100) and Eq. (S105), we can do approximate samplings in the same complexity <u>with</u> <u>error</u> _O_ (poly( _N_ ) _∥dW_ _∥F_ ) in terms of the totaltheorem.variation distance. Finally, by Eq. (S99), _∥dW_ _∥F_ _≤_ _∥dU_ _∥_ <sup>2</sup> _F_ <sup>+</sup> <sup>_∥dU_</sup> <sup>_∥F_</sup> <sup>up</sup> <sup>to</sup> <sup>poly(</sup> <sup>_N_</sup> <sup>),</sup> <sup>thus</sup> <sup>this</sup> <sup>proves</sup> <sup>the</sup> <u>mplexity</u> _∥dU_ _∥_ <sup>2</sup> _F_ totaltheorem.variation distance. Finally, by Eq. (S99), _∥dW_ _∥F_ _≤_ _∥dU_ _∥_ <sup>2</sup> _F_ <sup>+</sup> <sup>_∥dU_</sup> <sup>_∥F_</sup> <sup>up</sup> <sup>to</sup> <sup>poly(</sup> <sup>_N_</sup> <sup>),</sup> <sup>thus</sup> <sup>this</sup> <sup>proves</sup> <sup>the</sup> S5. DIFFUSIVE DYNAMICS OF RANDOM BEAM-SPLITTER ARRAYS A. Classical random walk behavior of random beam-splitter arrays Let us consider two modes _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> <sup>)</sup> <sup>_†_</sup> <sup>(</sup> _k_ <sup>_D_</sup> <sup>)</sup> <sup>_†_</sup> and _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> <sup>+1)</sup> <sup>_†_</sup> <sup>(</sup> _k_ <sup>_D_</sup> <sup>+1)</sup> <sup>_†_</sup> at depth _D_, which are written as _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> <sup>)</sup> <sup>_†_</sup> = _M_ _j_ =1 _k,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> _Uk,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _j_ <sup>(0)</sup> <sup>_,_</sup> and _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> +1 <sup>)</sup> <sup>_†_</sup> <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>_†_</sup> _k_ +1 <sup>=</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> _._ (S111) _M_ _j_ =1 _Uk_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _,j_ <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> After applying a beam splitter between them, the modes are transformed as   (S112)   _,_ _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> <sup>+1)</sup> <sup>_†_</sup> = _e_ <sup>_iφ_</sup> <sup>1</sup>    cos _θ_ _M_ _j_ =1 _k,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> + _e_ <sup>_iφ_</sup> <sup>0</sup> sin _θ_ _Uk,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _j_ _Uk,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _k,j_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> <sup>_†_</sup>   (S113)   _,_ _a_ ˆ <sup>(</sup> _k_ <sup>_D_</sup> +1 <sup>+1)</sup> <sup>_†_</sup> = _e_ <sup>_iφ_</sup> <sup>2</sup>    cos _θ_ _M_ _j_ =1 _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _,j_ <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> _−_ _e_ <sup>_−iφ_</sup> <sup>0</sup> sin _θ_ _Uk_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _j_ _M_ _j_ =1 _M_ _j_ =1 _Uk_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _,j_ <sup>_a_</sup> <sup>ˆ</sup> _j_ <sup>(0)</sup> <sup>_†_</sup> where cos _θ_ and sin _θ_ represent the beam splitter’s transmissivity and reflectivity, respectively, and we obtain the following relation _k,j_ <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> = _e_ <sup>_iφ_</sup> <sup>1 �</sup> _k_ +1 _,j_ <sup>=</sup> <sup>_eiφ_</sup> <sup>2 �</sup> _k,s_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>cos</sup> <sup>_θ −_</sup> <sup>_e−iφ_</sup> <sup>0</sup> <sup>_U_</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _Uk,j_ <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> _U_ <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> _Uk,s_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _Uk,s_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _,s_ <sup>sin</sup> <sup>_θ_</sup> _._ (S115) <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> = _e_ <sup>_iφ_</sup> <sup>1 �</sup> _k_ +1 _,j_ <sup>=</sup> <sup>_eiφ_</sup> <sup>2 �</sup> _θ_ over the _k,s_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>cos</sup> <sup>_θ_</sup> <sup>+</sup> <sup>_eiφ_</sup> <sup>0</sup> <sup>_U_</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>)</sup> _,s_ <sup>sin</sup> <sup>_θ_</sup> _,_ (S114) After averaging the transmissivity cos _θ_ over the uniform distribution of _θ_ _∈_ [0 _,_ 2 _π_ ), and the phases _φ_ 0 _, φ_ 1 and, _φ_ 2 over the uniform distribution of [0 _,_ 2 _π_ ), we obtain <sup><u>E[</u></sup> <sup>_<u>|U</u>_</sup> <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _,_ (S116) 2 _<u>k</u>_ <sup>(</sup> <sup>_D_</sup> <u>+1</u> <sup>)</sup> _<u>,s</u>_ <sup>_<u>|</u>_</sup> <sup>2]</sup> _k,s_ E[ _|U_ <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> _k,s_ <sup>(</sup> <sup>_D_</sup> <sup>+1)</sup> _|_ <sup>2</sup> ] = E[ _|Uk_ <sup>(</sup> <sup>_D_</sup> +1 <sup>+1)</sup> _,s_ _k_ <sup>(</sup> <sup>_D_</sup> +1 <sup>+1)</sup> _,s_ <sup>_|_</sup> <sup>2] =</sup> <u>E[</u> _<u>|Uk,s</u>_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> _<u>k,s</u>_ <sup>(</sup> <sup>_D_</sup> <sup>)</sup> <sup>_<u>|</u>_</sup> <sup>2] + E[</sup> <sup>_<u>|U</u>_</sup> _<u>k</u>_ <sup>(</sup> <sup>_D_</sup> <u>+1</u> <sup>)</sup> which shows that the transmission and reflection rate of a random beam-splitter array follows a random walk behavior. B. Proof of Lemma 2 We provide the proof of Lemma 2 in this section. We first note that on average the random beam-splitter circuits can be characterized by a symmetric random walk and that the goal is to find an upper-bound on the leakage rate. We observe that the leakage rate assuming an infinite number of modes is always larger than one with boundaries because boundaries makes the walker return to the initial lattice. Thus, it is sufficient to find an upper-bound assuming an infinite number of modes. For one-dimensional random walk, the probability of propagating farther than _l_ in step _t_ is given by _._ (S117) _P_ _≤_ 2 exp _−_ 2 <sup>_<u>l</u>_</sup> <sup>2</sup> _t_ Thus, the leakage rate for _d_ -dimensional case can be upper-bounded as _−_ 2 <sup>_<u>l</u>_</sup> <sup>2</sup> _t_ _−_ 2 <sup>_<u>l</u>_</sup> <sup>2</sup> _t_ _,_ (S118) E[ _η_ ] _≤_ 1 _−_ 1 _−_ 2 exp _−_ 2 <sup>_<u>l</u>_</sup> <sup>2</sup> _t_ - _≤_ 2 _d_ exp �� _d_ where _η_ = _η_ ( _⃗θ,⃗φ_ ) is a function of parameters ( _⃗θ,⃗φ_ ) for beam splitter arrays, which are random variables following a uniform distribution on [0 _,_ 2 _π_ ). Using Markov’s inequality, we obtain _P_ ( _η_ _≥_ _a_ ) _≤_ <sup><u>E</u></sup> _a_ <sup><u>[</u></sup> <sup>_<u>η</u>_</sup> <sup><u>]</u></sup> = <sup><u>2</u></sup> <sup>_<u>d</u>_</sup> _a_ <sup><u>[</u></sup> <sup>_<u>η</u>_</sup> <sup><u>]</u></sup> _a_ <sup>_<u>d</u>_</sup> _a_ <sup>exp</sup> _._ (S119) _−_ 2 <sup>_<u>l</u>_</sup> <sup>2</sup> _t_ - #### (a) (b) FIG. S1. Examples of 2D constant-depth circuit diagrams. First depth (black), second (red), third (blue), and fourth one (green). Examples of 5 _×_ 5 circuit appearing (a) elementary wall in a depth-3 circuit, (b) grid graph in a depth-4 circuit. Both have unbounded treewidth Θ( _N_ ). Since we are interested in the leakage rate of a source, we set _l_ = _κL_ = _κk_ <sup>1</sup> <sup>_/d_</sup> _N_ <sup>(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/d_</sup> with _L_ = ( _M/N_ ) <sup>1</sup> <sup>_/d_</sup> for a _d_ -dimensional case. Taking into account the dimension of the circuit, we set _t_ = _D/d_ . Especially for depth <u>2(</u> _<u>γd−</u>_ <u>1)</u> _D_ _≤_ _dk_ <sup>2</sup> <sup>_/d_</sup> _c_ 1 _κ_ <sup>2</sup> _N_ _−ϵ/_ 2 and _a_ = exp( _−N ϵ_ ) with an arbitrary _ϵ >_ 0, we find <u>2(</u> _<u>γd−</u>_ <u>1)</u> _−ϵ/_ 2 and _a_ = exp( _−N ϵ_ ) with an arbitrary _ϵ >_ 0, we find _._ (S120) _N_ <sup>_ϵ_</sup> _P_ [ _η_ _≥_ exp( _−N_ <sup>_ϵ_</sup> )] _≤_ 2 _d_ exp 1 _−_ _c_ <sup><u>1</u></sup> 1 �� Thus, the probability is exponentially small in _N_ when _c_ 1 _<_ 1. In other words, except for an exponentially small probability for ( _⃗θ,⃗φ_ ), the leakage rate _η_ ( _⃗θ,⃗φ_ ) is exponentially small. In addition, for _d_ = 1, if we set _l_ = _κL_ log _N_ = _κkN_ <sup>_γ−_</sup> <sup>1</sup> log _N_, we can similarly obtain for _D_ _≤_ _c_ 1 _k_ <sup>2</sup> _κ_ <sup>2</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_−ϵ_</sup> (log _N_ ) <sup>2</sup> _/_ 2 _N_ <sup>_ϵ_</sup> _._ (S121) _P_ [ _η_ _≥_ exp( _−N_ <sup>_ϵ_</sup> )] _≤_ 2 _d_ exp 1 _−_ _c_ <sup><u>1</u></sup> 1 �� S6. PROOF OF THEOREM 3 In this section, we provide the proof of Theorem 3. First, let us consider single-photon boson sampling. By the assumption, _D_ _≤_ _D_ easy _≡_ _dk_ <sup>2</sup> <sup>_/d_</sup> _N_ <sup>2(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/d−ϵ_</sup> _/_ 8. It corresponds _κ_ = 1 _/_ 2, so that _l_ = _L/_ 2; thus, the sources are confined at the initial sublattices under the approximate matrix _U_ <sup>˜</sup> . Since the photons are detected at their initial sublattices for typical circuits, the corresponding outcomes are represented by disjoint graphs with two vertices (input photon and output photon for each sublattice). Therefore, the graph has treewidth _w_ = 1. Thus the complexity is _O_ ( _MN_ <sup>2</sup> ) by Theorem 1. Now we check whether the error satisfies the condition _O_ (1 _/_ poly( _N_ )). We start with the total variation distance as _∥dU_ _∥_ <sup>2</sup> _F_ TVD _≤_ poly( _N_ ) <sup>2</sup> _F_ <sup>+</sup> <sup>_∥dU_</sup> <sup>_∥F_</sup> <sup>_≤_</sup> <sup>_O_</sup> <sup>(1</sup> <sup>_/_</sup> <sup>poly(</sup> <sup>_N_</sup> <sup>))</sup> <sup>_,_</sup> (S122) where we use Theorem 2 for the first equality, and Lemma 2 for the second inequality. Therefore, the approximate boson sampling can be efficiently performed. Now, let us move to the Gaussian boson sampling. The only difference is that a Gaussian source, i.e., squeezed vacuum state, can emit multiple photons so that output can be many photons even confined in the same sublattice. We still assume that this multiplicity is at most a constant _c_ without loss of generality. Then in a single sublattice, at most _c_ photons can be detected, which leads the treewidth _c −_ 1 because it yields the complete graph in the symmetric tree decomposition. Although each sublattice has a complete graph, there are only disjoint graphs, and total treewidth is bounded, i.e., _w_ _≤_ _c −_ 1. Consequently, the sampling complexity is _O_ ( _MN_ ) by Theorem 1, and the error analysis is the similar to the case of single-photon boson sampling. S7. CONSTANT-DEPTH 2D CIRCUIT In this section, we briefly show that for 2D structures, only constant-depth is enough to achieve unbounded treewidth of induced graphs. Let us focus on a dense circuit, i.e., _L_ = 1, in a 2D lattice, with local interactions. We can draw (a) (b) (c) (d) FIG. S2. (a) Virtual tree decomposition including all modes, which will be used to construct real bags of a symmetric tree decomposition. The former is the latter’s child. Here, we assume that a photon from source can jump up to 3 modes away. _M_ = 144 and _N_ = 16 (b) An example output distribution. (c) Corresponding symmetric graph. (d) True tree decomposition taking into account true outcomes only. An upper bound on the treewidth is _w_ = 8. 2D circuit diagrams Fig. S1, in which vertices represent input positions of the circuit, and edges correspond the connectivity by local interaction. In Fig. S1 (a), a graph with unbounded treewidth already appears for depth-3, called elementary wall [29]. If we step one depth more, we can obtain a grid (Fig. S1 (b)). Both have the treewidth _w_ = Θ( _N_ ) with _N_ is the height of the wall or length of the grid. One can find that there exist output configurations including the graph of circuit diagrams, which indicates that the treewidths of circuit diagrams are lower bounds on the maximal treewidths of the induced graphs over possible outcomes. Thus, the corresponding bipartite graph (symmetric graph) for single-photon (Gaussian) boson sampling has at least this unbounded treewidth. It is worth mentioning that the simulability of constant-depth circuits in the literature. For linear optical circuits with single-photon inputs, all depth-2 circuits are easy, some depth-4 circuits are hard, and the depth-3 case is unknown [30]. By our argument, some depth-3 circuits are hard using our treewidth-based algorithm. In addition, for a 2D Gaussian local random boson sampling, constant-depth hardness is suggested under certain conjectures [31]. For qubit circuits, there exist depth-3 circuits with treewidth Ω( _n_ ) by using expander graph [32]. S8. UPPER BOUND ON THE TREEWIDTH OF INDUCED GRAPHS (PROOF OF THEOREM 4) In this section, we explicitly give examples of boson sampling in 2D and prove Theorem 4 by finding the upper bound of treewidth we need. Fig. S2 shows an example of a 2D Gaussian boson sampling and its tree decomposition. Fig. S2 (a) shows a possible virtual tree decomposition before we obtain an output photon distribution. When output photons are clicked as shown in Fig. S2 (b), the corresponding symmetric graph is given by Fig. S2 (c). Finally, we can find the tree decomposition of an output distribution by obtaining an overlap of the virtual tree decomposition and output photons. Here, depending on how far a photon can propagate, we have to adjust the size of each bag accordingly. When a photon can propagate up to _κL_ (assuming _κ_ is a nonzero integer for simplicity), <u>for</u> the virtual tree decomposition, the size of a bag is upper-bounded by _√M ×_ (2 _κ_ + 1) _L_, and it contains at most _√M/L ×_ (2 _κ_ + 1) _L/L_ = (2 _κ_ + 1) _N_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> sources. One can easily check that even if photons outside of a bag propagate into the bag, the number of photons that can be clicked has the same scaling as the number of sources. Thus, the width is given by _w_ = Θ( _κN_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> ). If we let _κ_ = Θ( _N_ <sup>_α/_</sup> <sup>2</sup> ), _w_ = Θ( _N_ <u>1+2</u> _<u>α</u>_ ). The latter corresponds to the diffusive dynamics with _D_ = Θ( _N_ <sup>_α_</sup> _D_ easy). _√_ _M ×_ (2 _κ_ + 1) _L_, and it contains at most if photons outside of a bag propagate _M/L ×_ (2 _κ_ + 1) _L/L_ = (2 _κ_ + 1) _N_ <sup>1</sup> <sup>_/_</sup> <sup>2</sup> the bag, the number of photons _√_ <u>1+2</u> _<u>α</u>_ ). The latter corresponds to the diffusive dynamics with _D_ = Θ( _N_ <sup>_α_</sup> _D_ easy). (a) (b) (c) (d) FIG. S3. (a) Virtual tree decomposition including all modes (red: input modes, blue: output modes), which will be used to construct real bags of a bipartite tree decomposition. Here, we assume that a photon from source can jump up to 3 modes away. The colored region represents the first bag. _M_ = 144 and _N_ = 16 (b) An example output distribution. (c) Corresponding bipartite graph. We depict edges only from the first input mode for simplicity. (d) An equivalent graph including grids by rearrangement of the vertices. An upper bound on the treewidth is _w_ = 9. 1 2 3 4 1 2 3 2 3 4 5 3 4 5 6 4 5 6 7 5 6 7 8 6 7 8 9 4 7 5 6 8 9 FIG. S4. 3 _×_ 3 grid graph and its tree decomposition using band structure (left). The first bag (blue) has element _{_ 1 _,_ 2 _,_ 3 _,_ 4 _}_ and the second bag (yellow) has element _{_ 2 _,_ 3 _,_ 4 _,_ 5 _}_ . The width of this tree decomposition is 3 (right), which is exactly equal to the treewidth. Fig. S3 is for a similar case but single-photon boson sampling and bipartite tree decomposition. We remark here that our description represents an upper bound on the treewidth. The exact treewidth is hard to find in general, but we illustrate that for the 2D grid case, the band decomposition is enough for the exact treewidth, as shown in Fig. S4. Finally, let us consider an arbitrary dimension _d_ . One may find a similar virtual tree decomposition. For example, if a photon can jump up toand the number of sources is at most ( _κL_, the size of bags is upper-bounded by _M_ _<u>d−</u>_ <u>1</u> _M_ <sup>1</sup> <sup>_/d_</sup> _<u>d×−d</u>_ <u>1</u> _M_ ). <sup>1</sup> Therefore, the width is Θ( <sup>_/d_</sup> _×· · ·×_ (2 _κ_ +1) _L_ = _M_ <sup>(</sup> <sup>_d−_</sup> _κN_ <sup>1)</sup> <sup>_/d_</sup> _<u>d×−d</u>_ <u>1(2).</u> _κ_ +1)When _L_, _d_ _×_ (2 _κ_ +1) _L_ ) _/L_ <sup>_d_</sup> = Θ( _κN_ _<u>−d</u>_ <u>1</u> _×_ (2 _κ_ +1) _L_ ) _/L_ <sup>_d_</sup> = Θ( _κN_ _<u>αd</u>_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> <sup>_<u>−</u>_</sup> _d_ <sup><u>1</u></sup> ). It proves Theorem 4. _<u>d−</u>_ <u>1</u> _<u>d−d</u>_ <u>1</u> _<u>−d</u>_ <u>1</u> ). Therefore, the width is Θ( _κN_ and the number of sources is at most ( _M_ _<u>d−</u>_ <u>1</u> _<u>d−d</u>_ <u>1</u> ). Therefore, the width is Θ( _κN_ _<u>d−d</u>_ <u>1</u> ). When _d_ _×_ (2 _κ_ +1) _L_ ) _/L_ <sup>_d_</sup> = Θ( _κN_ _<u>α</u>_ _κ_ = Θ( _N_ <sup>_α/d_</sup> ), ( _D_ = Θ( _N_ <sup>2</sup> <sup>_α/d_</sup> _D_ easy) for diffusive dyanmics), the width is given by Θ( _N_ _d_ <sup>+</sup> <sup>_<u>d−</u>_</sup> _d_ <sup><u>1</u></sup> ). It proves Theorem 4. _<u>d−d</u>_ <u>1</u> S9. OTHER INITIAL CONFIGURATION FOR BOSON SAMPLING USING LOCAL HAAR-RANDOM BEAM SPLITTERS When we want to conduct an experiment or simulate for boson sampling that is believed to be hard [8], we need to ensure collision-free cases, i.e., _M_ = _ω_ ( _N_ <sup>2</sup> ) or _γ_ _>_ 2 in the main text. We first emphasize that there is a possibility that the sampling for _M_ = _O_ ( _N_ <sup>2</sup> ) is not as difficult as for _M_ = _ω_ ( _N_ <sup>2</sup> ) [33, 34]. Let us focus on achieving such conditions with two representatives examples of different initial configurations in 2D systems, as shown in Fig. S5. Here, we again assume local Haar-random circuits, which is motivated from the recent experimental setup [35, 36]. ##### (a) (b) FIG. S5. Examples of different initial configurations. We assume _M_ = Θ( _N_ <sup>2</sup> ). (a) _~~√~~_ _N_ _×_ _~~√~~_ FIG. S5. Examples of different initial configurations. We assume _M_ = Θ( _N_ <sup>2</sup> ). (a) _N_ _×_ _N_ grid shape of initial sources, (b) 1 _× N_ strip shape of sources. Also we assume that _γ_ is slightly larger than 2, which is the experimentally favorable and minimal condition to achieve collision-free cases. We have shown that when _D_ = Θ( _N_ <sup>_γ−ϵ_</sup> ), any modes can interact with all modes regardless of an initial configuration. Especially when the initial sources are equally distributed as we analyzed, the photons can be detected on all _M_ modes when _D_ = Θ( _D_ easy) = Θ( _N_ <sup>_γ−_</sup> <sup>1</sup> <sup>_−ϵ_</sup> ), i.e., all _M_ = Θ( _N_ <sup>_γ_</sup> ) modes are effectively involved. Therefore, for example, when _γ_ is slightly greater than 2, we only need an almost linear depth of _N_ to achieve c _√_ <u>ollis</u> _M_ _×_ ion- _√_ <u>free</u> _M_ latticecases. asOn _√N_ <u>the</u> _×_ ot _√_ <u>her</u> _N_ sublatticehand, whenas shownall inputin Fig.modesS5 are(a),concentratedat _D_ = Θ( _D_ easyat the), photonscenter canor thepropagatecorner ofuptheto Θ( _N_ <sup>(</sup> <sup>_γ−_</sup> <sup>1)</sup> <sup>_/_</sup> <sup>2</sup> ) and the number of effective modes is at most Θ( _N_ <sup>_γ−_</sup> <sup>1</sup> ). Thus, a linear depth is not enough to achieve collision-free cases and we need a larger depth when _γ_ is slightly larger than 2. To make the effective number of modes to be _M_ = _ω_ ( _N_ <sup>2</sup> ), the required depth is _D_ = _ω_ ( _N_ <sup>2</sup> <sup>_−ϵ_</sup> ) = _ω_ ( _N_ <sup>3</sup> <sup>_−γ_</sup> _D_ easy); the modes around edges do not effectively contribute before the depth. A difference from the equally distributed case is that even though initial sources can interact each other at a smaller depth, since the initial sources are dense, it does not guarantee collision-free case when _D_ = _O_ ( _N_ <sup>2</sup> <sup>_−ϵ_</sup> ) = _O_ ( _N_ <sup>3</sup> <sup>_−γ_</sup> _D_ easy). One can also show a similar behavior of another example shown in Fig. S5 (b). Finally, it is worth noting that if we do not assume local Haar-random circuits, there is an ensemble that reaches a global Haar-random and collision-free outcomes with a lower depth [37]. Nevertheless, we emphasize again that a local Haar-random circuit is the experimental setup currently used for quantum supremacy demonstration, and that under this assumption, it is advantageous to choose the equally spacing initial state to minimize the depth for collision-free. _M_ lattice as _M_ _×_ _√_ ot _√_ _√_ _N_ _×_ S10. NUMERICAL METHOD FOR LIKELIHOOD TEST In this section, we elaborate the numerical method that we have conducted to show that our treewidth-based algorithm gives a larger likelihood than GBS experiments. The recent GBS experiment has used two layers of 2dimensional beam-splitter arrays for 144 modes. To reveal the locality of the given circuit, we first rearranged the 144 modes one-dimensionally as shown in Fig. 5(a). In this procedure, we have randomly shuffled the input and output modes to find the best configuration for local approximation. For each case, we approximate the unitary matrix of the circuit by imposing a spatial locality, i.e., photons from a source can propagate only for _K_ steps. It means that we discard some elements of the matrix that correspond to the coupling between modes over than _K_ steps from each source. We then choose a configuration that gives the best fidelity between an approximated Gaussian state with the propagation length _K_ and the ideal Gaussian state. For this procedure, because the approximation effectively decreases the number of photons, we have increased the squeezing parameters and also thermal photons of the input state to have the same mean photon number as the experiment. We note that the likelihood test is equivalent to the test implemented in Refs. [35, 36]. More specifically, we compute the log-likelihood ratio: <u>Prideal(Samples</u> <u>from</u> <u>experiment)</u> ratio _≡_ log Prideal(Samples from treewidth algorithm) <sup>=</sup> _N_ samp _i_ =1 log <sup><u>Prideal(</u></sup> <sup>_<u>m</u>_</sup> <u>exp</u> <sup>(</sup> <sup>_i_</sup> <sup>)</sup> Prideal( _m_ <sup>(</sup> tree <sup>_i_</sup> <sup>)</sup> <u>exp</u> <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup><u>)</u></sup> <sup>(</sup> tree <sup>_i_</sup> <sup>)</sup> <sup>)</sup> _,_ (S123) where samples from experiments are written as _{_ _m_ <sup>(</sup> exp <sup>_i_</sup> <sup>)</sup> _i_ =1, and samples from treewidth algorithm are written as where samples from experiments are written as _{_ _m_ <sup>(</sup> exp <sup>_i_</sup> <sup>)</sup> <sup>_}N_</sup> <sup>samp</sup> _i_ =1, and _N_ samp is the number of samples. _{_ _m_ tree <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_}N_</sup> <sup>samp</sup> For the numerical demonstration, we have chosen the experimental data of focal waist 65 _µm_ and power _P_ = _i_ =1 tree <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_}N_</sup> <sup>samp</sup> the _i_ =1 <sup>(</sup> exp <sup>_i_</sup> <sup>)</sup> <sup>_}N_</sup> <sup>samp</sup> _i_ =1, and _N_ samp is the number of samples. _{_ _m_ tree <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_}N_</sup> <sup>samp</sup> For the numerical demonstration, we have chosen the experimental data of focal waist 65 _µm_ and power _P_ = 0 _._ 15 _,_ 0 _._ 3 _,_ 0 _._ 6 _,_ 1 _._ 0 _,_ 1 _._ 65 _W_ . In the main text, we have presented the first two cases, which are classically verifiable since (a) (b) (c) <u>P= 0.15W, K= 50</u> <u>P= 0.3W, K= 50</u> <u>P= 0.3W, K= 50</u> <u>P= 0.6W, K= 50</u> 500 - 2000 - 4000 - 6000 - 8000 - 10000 Ns = 80000 - 1000 Ns = 6000 Ns = 5000 - 1000 - 2000 - 3000 - 4000 - 5000 - 500 - 1000 - 1500 - 2000 - 2500 0 0 20 40 60 80 100 120 140 The number of marginal modes (d) (e) <u>P= 1.0W, K= 55</u> 0 20 40 60 80 100 120 140 The number of marginal modes The number of marginal modes <u>P= 1.65W, K= 65</u> 10 20 30 40 50 60 - 500 - 1000 - 1500 - 2000 - 2500 Ns = 3000 - 400 Ns = 5000 - 600 - 800 - 1000 - 1200 - 1400 - 1600 5 10 15 20 25 30 35 40 The number of marginal modes 5 10 15 20 25 30 The number of marginal modes FIG. S6. Log-likelihood ratio for different powers and different number of marginal modes. We have averaged over 60, 20, 10, 30, 20 different choices of marginal modes for each point for (a)-(e), respectively. the classical simulation is possible. For the larger powers, we have tested for the many different randomly chosen marginal modes and averaged the score, and the results are presented in Fig. S6. First, we observe how the score changes for the classically verifiable cases in Fig. S6(a)(b). While the overall behavior is not monotonic, the largest likelihood ratio is attained for the smallest number of marginal modes. Now for the quantum supremacy regime, the behavior is almost consistent with the classically verifiable cases in the sense that the score decreases up to 60 marginal modes. Due to the computational cost, we cannot test for larger number of marginals and ultimately for full distribution, but based on the classically verifiable cases, we expect that our classical algorithm may have a better likelihood than the experiment. It is worth emphasizing that we had to choose a larger _K_ to attain a larger likelihood from our treewidth-based algorithm as the power grows, which is due to the fact that for a large number of photons, more photons can propagate further even under the same unitary matrix, so that the approximation error inevitably increases (e.g. Eq. (S110)). [1] R. Dechter, D. Cohen, _et_ _al._, _Constraint_ _processing_ (Morgan Kaufmann, 2003). [2] H. L. Bodlaender and A. M. Koster, Combinatorial optimization on graphs of bounded treewidth, The Computer Journal 51, 255 (2008). [3] D. Marx, Can you beat treewidth?, in _48th_ _Annual_ _IEEE_ _Symposium_ _on_ _Foundations_ _of_ _Computer_ _Science_ _(FOCS’07)_ (IEEE, 2007) pp. 169–179. [4] S. Arnborg, D. G. Corneil, and A. Proskurowski, Complexity of finding embeddings in a k-tree, SIAM Journal on Algebraic Discrete Methods 8, 277 (1987). [5] H. L. Bodlaender, A linear-time algorithm for finding tree-decompositions of small treewidth, SIAM Journal on computing 25, 1305 (1996). [6] D. Cifuentes and P. A. Parrilo, An efficient tree decomposition method for permanents and mixed discriminants, Linear Algebra and its Applications 493, 45 (2016). [7] A. Bj¨orklund, T. Husfeldt, P. Kaski, and M. Koivisto, Fourier meets m¨obius: fast subset convolution, in _Proceedings_ _of_ _the_ _thirty-ninth_ _annual_ _ACM_ _symposium_ _on_ _Theory_ _of_ _computing_ (2007) pp. 67–74. [8] S. Aaronson and A. Arkhipov, The computational complexity of linear optics, in _Proceedings_ _of_ _the_ _forty-third_ _annual_ _ACM_ _symposium_ _on_ _Theory_ _of_ _computing_ (2011) pp. 333–342. [9] D. F. Elliott, _Handbook_ _of_ _digital_ _signal_ _processing:_ _engineering_ _applications_ (Elsevier, 2013). [10] H. Qi, D. Cifuentes, K. Br´adler, R. Israel, T. Kalajdzievski, and N. Quesada, Efficient sampling from shallow Gaussian quantum-optical circuits with local interactions, arXiv preprint arXiv:2009.11824 (2020). [11] P. Clifford and R. Clifford, The classical complexity of boson sampling, in _Proceedings_ _of_ _the_ _Twenty-Ninth_ _Annual_ _ACM-_ _SIAM_ _Symposium_ _on_ _Discrete_ _Algorithms_ (SIAM, 2018) pp. 146–155. [12] X.-B. Wang, T. Hiroshima, A. Tomita, and M. Hayashi, Quantum information with Gaussian states, Phys. Rep 448, 1 (2007). [13] C. Weedbrook, S. Pirandola, R. Garc´ıa-Patr´on, N. J. Cerf, T. C. Ralph, J. H. Shapiro, and S. Lloyd, Gaussian quantum information, Rev. Mod. Phys. 84, 621 (2012). [14] G. Adesso, S. Ragy, and A. R. Lee, Continuous variable quantum information: Gaussian states and beyond, Open Syst. Inf. Dyn. 21, 1440001 (2014). [15] A. Serafini, _Quantum_ _continuous_ _variables:_ _a_ _primer_ _of_ _theoretical_ _methods_ (CRC press, 2017). [16] C. S. Hamilton, R. Kruse, L. Sansoni, S. Barkhofen, C. Silberhorn, and I. Jex, Gaussian boson sampling, Phys. Rev. Lett. 119, 170501 (2017). [17] N. Quesada and J. M. Arrazola, Exact simulation of Gaussian boson sampling in polynomial space and exponential time, Phys. Rev. Res. 2, 023005 (2020). [18] A. Barvinok, _Combinatorics_ _and_ _complexity_ _of_ _partition_ _functions_, Vol. 9 (Springer, 2016). [19] N. Quesada, R. S. Chadwick, B. A. Bell, J. M. Arrazola, T. Vincent, H. Qi, R. Garc´ıa, _et_ _al._, Quadratic speed-up for simulating gaussian boson sampling, PRX Quantum 3, 010306 (2022). [20] A. Bj¨orklund, B. Gupt, and N. Quesada, A faster hafnian formula for complex matrices and its benchmarking on a supercomputer, Journal of Experimental Algorithmics (JEA) 24, 1 (2019). [21] F. Zhang, _The_ _Schur_ _complement_ _and_ _its_ _applications_, Vol. 4 (Springer Science & Business Media, 2006). [22] R. Kruse, C. S. Hamilton, L. Sansoni, S. Barkhofen, C. Silberhorn, and I. Jex, Detailed study of Gaussian boson sampling, Phys. Rev. A 100, 032326 (2019). [23] D. G. Brown, How I wasted too long finding a concentration inequality for sums of geometric variables, `https://cs.` `uwaterloo.ca/~browndg/negbin.pdf` . [24] L. Mirsky, Symmetric gauge functions and unitarily invariant norms, The quarterly journal of mathematics 11, 50 (1960). [25] A. Arkhipov, Bosonsampling is robust against small errors in the network matrix, Phys. Rev. A 92, 062326 (2015). [26] C. A. Fuchs and J. Van De Graaf, Cryptographic distinguishability measures for quantum-mechanical states, IEEE Trans actions on Information Theory 45, 1216 (1999). [27] G. Spedalieri, C. Weedbrook, and S. Pirandola, A limit formula for the quantum fidelity, J. Phys. A Math. Theor. 46, 025304 (2012). [28] L. Banchi, S. L. Braunstein, and S. Pirandola, Quantum fidelity for arbitrary Gaussian states, Phys. Rev. Lett. 115, 260501 (2015). [29] B. A. Reed and C. L. Sales, _Recent_ _advances_ _in_ _algorithms_ _and_ _combinatorics_ (Springer, 2003). [30] D. J. Brod, The complexity of simulating constant-depth bosonsampling, Phys. Rev. A 91, 042316 (2015). [31] A. Deshpande, A. Mehta, T. Vincent, N. Quesada, M. Hinsche, M. Ioannou, L. Madsen, J. Lavoie, H. Qi, J. Eisert, D. Hangleiter, B. Fefferman, and I. Dhand, Quantum computational advantage via high-dimensional Gaussian boson sampling, Science Advances 8, eabi7894 (2022). [32] I. L. Markov and Y. Shi, Simulating quantum computation by contracting tensor networks, SIAM Journal on Computing 38, 963 (2008). [33] P. Clifford and R. Clifford, Faster classical boson sampling, arXiv preprint arXiv:2005.04214 (2020). [34] J. F. Bulmer, B. A. Bell, R. S. Chadwick, A. E. Jones, D. Moise, A. Rigazzi, J. Thorbecke, U.-U. Haus, T. Van Vaerenbergh, R. B. Patel, _et_ _al._, The boundary for quantum advantage in gaussian boson sampling, Science Advances 8, eabl9236 (2021). [35] H.-S. Zhong, H. Wang, Y.-H. Deng, M.-C. Chen, L.-C. Peng, Y.-H. Luo, J. Qin, D. Wu, X. Ding, Y. Hu, _et_ _al._, Quantum computational advantage using photons, Science 370, 1460 (2020). [36] H.-S. Zhong, Y.-H. Deng, J. Qin, H. Wang, M.-C. Chen, L.-C. Peng, Y.-H. Luo, D. Wu, S.-Q. Gong, H. Su, _et_ _al._, Phase-programmable gaussian boson sampling using stimulated squeezed light, Physical review letters 127, 180502 (2021). [37] N. J. Russell, L. Chakhmakhchyan, J. L. O’Brien, and A. Laing, Direct dialling of haar random unitary matrices, New J. Phys. 19, 033007 (2017).

섹션 본문

섹션 본문이 없습니다.

참고문헌

참고문헌 정보가 없습니다.