We establish a polynomial-time approximation algorithm for partition functions of quantum spin models at high temperature. Our algorithm is based on the quantum cluster expansion of Netočný and Redig and the cluster expansion approach to designing algorithms due to Helmuth, Perkins, and Regts. Similar results have previously been obtained by related methods, and our main contribution is a simple and slightly sharper analysis for the case of pairwise interactions on bounded-degree graphs.

## I. INTRODUCTION

Classical algorithms for approximating partition functions of quantum models that make use of cluster expansions have occurred in two recent papers.^{1,2} In this paper, we provide a simple and concise exposition of how to construct such algorithms, with the intent of making the technique accessible to a wide audience.

A *quantum spin system* is modelled by a hypergraph *G* = (*X*, *E*). At each vertex *x* of *G*, there is a *d*-dimensional Hilbert space $Hx$ with *d* < *∞*. The Hilbert space on the hypergraph is given by $HG\u2254\u2a02x\u2208XHx$. An interaction Φ assigns a self-adjoint operator Φ(*e*) on $He\u2254\u2a02x\u2208eHx$ to each hyperedge *e* of *G*. The Hamiltonian on *G* is defined by *H*_{G} ≔ *∑*_{e∈E(G)}Φ(*e*). We are interested in the *quantum partition function* *Z*_{G}(*β*) at inverse temperature *β*, defined by $ZG(\beta )\u2254Tre\u2212\beta HG$.

In what follows, we shall focus our attention on quantum spin systems modeled by bounded-degree graphs; however, generalizations to bounded-degree bounded-rank hypergraphs are also possible. We shall assume that $\Phi (e)\u22641$ for every *e* ∈ *E*, where $\u22c5$ denotes the operator norm. Note that this is always possible by a rescaling of *β*. To state our main result, recall that a *fully polynomial-time approximation scheme* for a sequence of complex numbers $(zn)n\u2208N$ is a deterministic algorithm that, for any *n* and *ϵ* > 0, produces a complex number $z\u0302n$ such that $zn\u2212z\u0302n\u2264\u03f5zn$ in time polynomial in *n* and 1/*ϵ*.

*Fix* $\Delta \u2208Z+$*. There is a fully polynomial-time approximation scheme for the partition function* *Z*_{G}(*β*) *for all graphs* *G* *of maximum degree at most* Δ *and all complex numbers* *β* *such that* $\beta \u22641e4\Delta $*.*

Our algorithm is based on combining the abstract cluster expansion for quantum spin systems of Netočný and Redig^{3} with the algorithmic framework of Helmuth, Perkins, and Regts.^{4} The condition $\beta =O1\Delta $ is optimal under the complexity-theoretic assumption that RP (randomized polynomial time) is not equal to NP (non-deterministic polynomial time) due to the results on the hardness of approximate counting.^{5,6} We remark that these results concern real values of *β*; however, similar computational complexity transitions from P (polynomial time) to BQP-hard (bounded-error quantum polynomial time) and P to #P-hard can also be observed for complex values of *β* by using the methods of Refs. 7–9. For a formal definition of these complexity-theoretic notions, we refer the reader to Ref. 10.

Previous work on polynomial-time approximate counting algorithms for classical models have typically followed one of the three approaches: the correlation decay method,^{11,12} Markov-chain Monte Carlo,^{13} or interpolation-type methods.^{4,14} The latter two of these methods have also been used to design classical algorithms for quantum models.^{1,2,9,15–17} The goal of this paper is to convey the simplicity and flexibility of the third method that results from using the cluster expansion formalism. We emphasize that ideas of this type have previously been used to establish similar algorithms: for $\beta \u2264(10e2\Delta )\u22121$ with quasi-polynomial runtime^{1} and for $\beta \u2264(16e3\Delta )\u22121$ with polynomial runtime.^{2} Both the runtime of our algorithm and that of Ref. 2 are polynomials of a relatively high degree; examining our proof gives an upper bound of *O*(log(*d*Δ)) for the degree. While our results represent a modest improvement in the bound for $\beta $, we view our main contribution as being the simplicity of our analysis.

We note also that *a priori* information on the location of zeros of the partition function can be combined with the methods of this paper to develop polynomial-time algorithms. As noted in Ref. 4, this is an alternate route to the results of Patel and Regts^{18} using Barvinok’s method.^{14} For quasi-polynomial time results of this flavour in the quantum setting, see Ref. 1.

This paper is structured as follows: In Sec. II, we introduce the abstract cluster expansion. Then, in Sec. III, we show how the partition function of quantum spins systems admits such a cluster expansion. In Sec. IV, we use this framework to establish our approximation algorithm for the quantum partition function at high temperature. Finally, we conclude in Sec. V with some remarks and open problems.

## II. THE ABSTRACT CLUSTER EXPANSION

The *cluster expansion* is a powerful tool from mathematical physics that allows one to express, via power series expansions, perturbations of a well-understood reference model. When the perturbations are sufficiently small, the power series expansions are convergent and allow one to draw many conclusions regarding correlation decay, zero-freeness, and other related properties. This method was originally introduced by Mayer in the study of imperfect gases^{19} but has since been greatly abstracted and simplified. The formulation we use is due to Kotecký and Preiss.^{20}

An *abstract polymer model* is a triple $(C,w,\u223c)$, where $C$ is a countable set whose objects are called *polymers*, $w:C\u2192C$ is a function that assigns to each polymer $\gamma \u2208C$ a complex number *w*_{γ} called the *weight* of the polymer, and ∼ is a *symmetric compatibility relation* such that each polymer is incompatible with itself. Equivalently, the *incompatibility relation* ≁ is a symmetric and reflexive relation. A set of polymers is called *admissible* if all the polymers in the set are all pairwise compatible. Note that the empty set is admissible. Let $G$ denote the collection of all admissible sets of polymers from $C$. Then, the abstract polymer partition function is defined by

Our algorithm is based on reformulating the partition function of a quantum spin system in the abstract polymer model language (see Sec. III). The utility of this is due to the following fact about $log(Z(C,w))$.

Let Γ be a non-empty ordered tuple of polymers. The *incompatibility graph* *H*_{Γ} of Γ is the graph with vertex set Γ and edges between any two polymers if and only if they are incompatible. Γ is called a *cluster* if its incompatibility graph *H*_{Γ} is connected. Let $GC$ denote the set of all clusters of polymers from $C$. The *abstract cluster expansion*^{20,21} is a formal power series for $log\u2061Z(C,w)$ in the variables *w*_{γ}, defined by

where *φ*(*H*) denotes the *Ursell function* of a graph *H*,

## III. THE QUANTUM CLUSTER EXPANSION

In this section, we shall show how the partition function of a quantum spin system admits an abstract polymer representation and hence an abstract cluster expansion. We return to the more general setting of hypergraphs for the remainder of this section.

Consider a quantum spin system modeled by the hypergraph *G* = (*X*, *E*) with interaction Φ, where at each vertex *x* of *G*, there is a *d*-dimensional Hilbert space $Hx$ with *d* < *∞*. Recall that Φ assigns a self-adjoint operator Φ(*e*) on $He\u2254\u2297x\u2208eHx$ to each hyperedge *e* of *G*. Define a polymer *γ* in this model to be a multiset (*E*_{γ}, *m*_{γ}) of hyperedges *E*_{γ} ⊆ *E* with the multiplicity function $m\gamma :E\gamma \u2192Z+$ whose support *E*_{γ} induces a connected subgraph. Say that two polymers are compatible if and only if their supporting subgraphs are vertex disjoint. For a polymer *γ*, let $\gamma \u2254\u2211e\u2208E\gamma m\gamma (e)$ denote its size and let $\gamma \u2254E\gamma $ denote the cardinality of its support; by a slight abuse of notation, we will write $\gamma ={\gamma i}i=1\gamma $. With these definitions, the partition function *Z*_{G}(*β*) admits an abstract polymer model representation^{3,22,23} as formalized by the following lemma:

*The partition function*

*Z*

_{G}(

*β*)

*admits the following abstract polymer model representation:*

*where*

Note that $S\gamma $ is the symmetric group of degree $\gamma $, and this assigns an ordering to the product of interactions. We prove Lemma 9 in Appendix A. Note that the abstract polymer model representation holds as a formal power series in *β*. As an immediate corollary, we obtain a cluster expansion for log(*Z*_{G}(*β*)).

*The partition function*

*Z*

_{G}(

*β*)

*admits the following cluster expansion:*

For algorithms, an important quantity is the *truncated cluster expansion* for log(*Z*_{G}(*β*)),

where $\Gamma \u2254\u2211\gamma \u2208\Gamma \gamma $.

## IV. APPROXIMATION ALGORITHM

We now establish our approximation algorithm. First, we show that the truncated cluster expansion provides a good approximation to log(*Z*_{G}(*β*)). Netočný and Redig^{3} provided a sufficient condition for the convergence of the quantum cluster expansion based on the formalism of Kotecký and Preiss.^{20} In the following lemma, we follow their analysis in the setting of bounded-degree graphs. In particular, we obtain convergence criteria based on the maximum degree alone.

*Fix*$\Delta \u2208Z+$

*. Let*

*G*= (

*V*,

*E*)

*be a graph of maximum degree at most*Δ,

*and let*

*β*

*be a complex number such that*$\beta \u22641e4\Delta $

*. The cluster expansion for*log(

*Z*

_{G}(

*β*))

*converges absolutely,*

*Z*

_{G}(

*β*) ≠ 0

*, and for*$m\u2208Z+$

*,*

We prove Lemma 10 in Appendix B. This lemma implies that to obtain an multiplicative *ϵ*-approximation to *Z*_{G}(*β*), it is sufficient to compute *T*_{m}(*Z*_{G}(*β*)) to order $m=logV(G)/\u03f5$. We shall proceed by establishing an algorithm for computing *T*_{m}(*Z*_{G}(*β*)) in time $exp(O(m))\u22c5V(G)O(1)$. Helmuth, Perkins, and Regts^{4} showed that such an algorithm exists, given the following three lemmas:

*Fix* $\Delta \u2208Z+$*, and let* *G* = (*V*, *E*) *be a graph of maximum degree at most* Δ*. The clusters of size at most* *m* *can be listed in time* $exp(O(m))\u22c5VO(1)$*.*

Our proof follows that of Ref. 4, Theorem 6. First, we enumerate all connected subgraphs in *G* of size at most *m*. This can be achieved in time $exp(O(m))\u22c5VO(1)$ by Ref. 18, Lemma 3.6. Then, for each subgraph *H*, we enumerate all polymers (multisets) of size at most *m* whose corresponding subgraph in *G* is *H*. If *H* has size *n*, then there are precisely $m\u22121n\u22121$ of these, and they can be enumerated in time exp(*O*(*m*)). The enumeration of clusters in the claimed time then follows as in the proof of Ref. 4, Theorem 6.■

*The Ursell function* *φ*(*H*) *can be computed in time* $exp(O(V(H)))$*.*

*The weight* *w*_{γ} *of a polymer* *γ* *can be computed in time* $exp(O(\gamma ))$*.*

We prove Lemma 11 in Appendix B.

*Fix* $\Delta \u2208Z+$*, and let* *G* = (*V*, *E*) *be a graph of maximum degree at most* Δ*. The truncated cluster expansion* *T*_{m}(*Z*_{G}(*β*)) *can be computed in time* $exp(O(m))\u22c5V(G)O(1)$*.*

We can list all clusters in *G* of size at most *m* in time $exp(O(m))\u22c5VO(1)$ by Lemma 5. For each of these clusters, we can compute the Ursell function in time exp(*O*(*m*)) by Lemma 6, and the polymer weights in time exp(*O*(*m*)) by Lemma 11. Hence, the truncated cluster expansion for log(*Z*_{G}(*β*)) can be computed in time $exp(O(m))\u22c5V(G)O(1)$.■

Combining Lemmas 10 and 8 gives a fully polynomial-time approximation scheme for the partition function *Z*_{G}(*β*) when *G* has maximum degree at most Δ and $\beta $ is at most $1e4\Delta $. This proves Theorem 1.

## V. CONCLUSION & OUTLOOK

We have discussed how classical algorithms based on cluster expansion methods apply to quantum spin systems at high temperature. Our focus has been on conveying the simplicity of the method, which has appeared previously in other forms.^{1,2} We note that it may be possible to use the Markov chain polymer approach of Ref. 25 to obtain an algorithm with an improved runtime.

For discrete classical spin systems, expansion methods have also been used at low temperatures, i.e., when *β* ≫ 1.^{4,26–29} It would be interesting to adapt these methods to quantum systems, e.g., by developing algorithms based on Pirogov–Sinai methods for quantum perturbations of classical systems.^{30} We remark, however, that it seems difficult to use this approach for low-temperature quantum systems with an infinite degeneracy of ground states, for example, when the set of ground states possesses a continuous symmetry.

## ACKNOWLEDGMENTS

We thank Michael Bremner, Adrian Chapman, Ashley Montanaro, and Will Perkins for helpful discussions. R.L.M. was supported by the QuantERA ERA-NET Cofund in Quantum Technologies implemented within the European Union’s Horizon 2020 Programme (QuantAlgo project) and EPSRC Grant Nos. EP/L021005/1 and EP/R043957/1. T.H. was supported by EPSRC Grant No. EP/P003656/1.

## DATA AVAILABILITY

No new data were created during this study.

### APPENDIX A: PROOF OF LEMMA 2

*The partition function*

*Z*

_{G}(

*β*)

*admits the following abstract polymer model representation:*

*where*

^{3}By definition,

*G*

_{S}be the graph with vertex set [

*n*] and edges between any two vertices

*i*and

*j*if and only if

*e*

_{i}∩

*e*

_{j}≠

*∅*. Define a sequential polymer to be a subsequence of

*S*that corresponds to a maximally connected component of

*G*

_{S}. Say that two sequential polymers are compatible if and only if their corresponding subgraphs in

*G*are vertex disjoint. Let Γ

_{S}denote the set of all sequential polymers in

*S*. It follows that

_{G}≔ ∪

_{S}Γ

_{S}denote the set of all sequential polymers in

*G*, and let $GG$ denote the collection of all admissible sets of sequential polymers in

*G*. Observe that for any admissible set of sequential polymers ${\gamma i}i=1k$, there are precisely $\u2211i=1k\gamma i!\u220fi=1k\gamma i!$ sequences

*S*that give rise to it. Thus, we may write

*n*and

*k*, we obtain

### APPENDIX B: PROOF OF LEMMA 4 AND LEMMA 7

*Fix*$\Delta \u2208Z+$

*. Let*

*G*= (

*V*,

*E*)

*be a graph of maximum degree at most*Δ,

*and let*

*β*

*be a complex number such that*$\beta \u22641e4\Delta $

*. The cluster expansion for*log(

*Z*

_{G}(

*β*))

*converges absolutely,*

*Z*

_{G}(

*β*) ≠ 0

*, and for*$m\u2208Z+$

*,*

*γ*

_{x}to every vertex

*x*in

*G*consisting of only that vertex. We define

*γ*

_{x}to be incompatible with every polymer that contains

*x*. Then, we have

*x*, there are at most $(e\Delta )n2$ connected subgraphs with

*n*edges that contain

*x*(Ref. 31, Lemma 2.1). Furthermore, for such a subgraph, there are precisely $k\u22121n\u22121$ polymers (multisets)

*γ*with $\gamma =k$ that correspond to it. Thus, we may write

*n*and

*k*, we obtain

*γ*. By summing over all vertices in

*γ*, of which there are at most $\gamma +1$, we obtain

*β*,

*Z*

_{G}(

*β*) ≠ 0, and

*G*,

(restatement). *The weight* *w*_{γ} *of a polymer* *γ* *can be computed in time* $exp(O(\gamma ))$*.*

*γ*

_{1}, …,

*γ*

_{n}of the multiset of edges in

*γ*. By an inclusion–exclusion argument as in the derivation of Ryser’s formula for the permanent,

^{32}we have

*n*], of which there are 2

^{n}. For each of these subsets

*A*, we diagonalize the sum of the interactions ∑

_{i∈A}Φ(

*γ*

_{i}) to obtain the eigenvalues. This can be achieved in time exp(

*O*(

*n*)); here, we are using our assumption that the single-spin Hilbert spaces $Hx$ are

*d*-dimensional with

*d*<

*∞*. The trace may then be evaluated in time exp(

*O*(

*n*)) by evaluating the sum of the

*n*th powers of the eigenvalues. Hence, the weight of a polymer can be computed in time $exp(O(n))=exp(O(\gamma ))$.■