Partition function estimators

The main methods to compute partition functions. To see the details of how the partition function is computed with tensor network methods, we refer to the quimb documentation. But the important message is that they can compute the partition function relatively efficiently for system sizes up to 70 qubits as long as the underlying graph is sufficiently sparse.

For the Markov chain method, a more detailed explanation may be found in the corresponding page in the auxilliary modules, see Markov chain methods. Their main advantage is that they can compute partition functions for significantly larger system sizes, up to thousands of qubits. However, they generally obtain loser estimates and for smaller sizes the tensor networks are faster.

class partfunc_estimators.external_field(b)

This class creates a callable for the external field that is required for the quimb tensor network contraction algorithm for Ising models.

partfunc_estimators.partition_function_estimator_Ising(beta0, beta1, A, method, b=0, step_size=0.05, samples=1000)

Returns the value of the log partition function of the Ising model defined by the matrix A and with external field b for all inverse temperatures in the interval [beta0,beta1]. The partition function is evaluated at every step-size. The method can either be Tensor networks or Monte Carlo. For Monte Carlo methods, the annealing schedule and the number of samples will be set automatically. Note that for Monte Carlo methods it could be the case that the estimate is not reliable for high values of beta1. Tensor network methods, on the other hand, cannot handle very large instances.


a list of inverse temperatures and the corresponding log partition functions.

Return type

[betas,partitions] ([list of floats, list of floats])

  • beta0 (float) – initial inverse temperature.

  • beta1 (float) – final inverse temperature.

  • A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose energy we wish to minimize.

  • b (vector) – the external fields.

  • method (str) – either ‘TN’ or ‘MC’. Determines which method will be used to compute the partition function. TN is tensor network, MC is Monte Carlo.

  • step_size (float) – interval at which we evaluate the partition function.

  • samples (int) – only applies to the MC method. How many samples we take at each value of beta to estimate the partition function.

class partfunc_estimators.weights_graph(G)

This class creates a callable for the weight of an edge from the adjacency matrix. This is required for the quimb tensor network contraction algorithm for Ising models.