Simple estimate generator¶
In this module we provide some functions that make it easy to perform some simple estimates “out of the box”. So far it mostly focus on QAOA circuits and quantum annealing algorithms.
We provide functions that, given an architecture, noise model and Hamiltonian we wish to minimize, allow for lowerbounding the energy of the output of circuits or annealers.
We provice functions to lowerbound the energy on SK models and random dregular graphs for square architectures under depolarizing noise. These allow for an easy testing of how limited connectivity of quantum devices affects the performance of the QAOA under noise.

simplified_estimator.
best_estimate_rel_ent
(betas, log_partitions, rel_ent, n, temp_noise=0)¶ Returns a lower bound on the energy outputted by a circuit given the partition function for a range of inverse temperatures.
 Parameters
betas (vector of floats) – list of inverse temperatures.
log_partitions – the corresponding values for the logpartition function. Note that if the noise is biased, this should also be takne into account when computing the partition function.
rel_ent (float) – the relative entropy between the output of the noisy circuit and the fixed point of the noise.
n (int) – number of qubits.
temp_noise – the inverse temperature of the fixed point of the noise. In formulas, the fixed point of the noise is proportional to \(e^{\lambda Z}\), where \(\lambda\) corresponds to the temp_noise parameter. The standard setting gives the maximally mixed state.
 Returns
a lower bound to the energy of the circuit with this relative entropy.
 Return type
max_estimate (float)

simplified_estimator.
estimator_energy_QAOA
(noise_model, A, device, gammas, betas, verbose=1, method='TN')¶ Returns a lower bound on the energy outputted by a QAOA circuit under noise.
 Parameters
noise_model (cirq quantum channel) – cirq quantum channel specifying the noise affecting the device.
A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose energy we wish to minimize.
device (pytket device) – the connectivity of the underllying device.
gammas (list of floats) – the Gamma parameters of the QAOA circuit, which correspond to the parameters of the unitary generated by the Ising model.
betas (list of floats) – the Beta parameters of the QAOA circuit, which correspond to the paremeters of the X unitaries.
verbose (bool) – if set to 1, it will also print the depth of the compiled circuit and at which stage of the process we are at. If 0 there will be no output.
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.
 Returns
a lower bound to the energy of the QAOA circuit.
 Return type
output_energy (float)

simplified_estimator.
estimator_energy_QAOA_dep_device_SK
(p, n, device, depth, verbose=1)¶ Returns a lower bound on the energy outputted by a QAOA circuit under depolarizing noise and a connectivity graph for the device for the SK model. Note that as the SKmodel corresponds to the complete graph, even moderate values of n already take a considerable time to compute and in this function we compute the partition function brute force.
 Parameters
p (float) – local depolarizing probability.
n (int) – the number of spins in the SK model.
device (pytket device) – connectivity graph of the device
depth (int) – the depth of QAOA circuit.
verbose (bool) – if set to 1, it will also print the depth of the compiled circuit and at which stage of the process we are at. If 0 there will be no output.
 Returns
a lower bound to the energy of the QAOA circuit.
 Return type
output_energy (float)

simplified_estimator.
estimator_energy_QAOA_dep_square
(p, A, depth, verbose=1, method='TN')¶ Returns a lower bound on the energy outputted by a QAOA circuit under depolarizing noise and a squarelattice connectivity graph for the device.
 Parameters
p (float) – local depolarizing probability.
A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose energy we wish to minimize.
depth (int) – the depth of QAOA circuit.
verbose (bool) – if set to 1, it will also print the depth of the compiled circuit and at which stage of the process we are at. If 0 there will be no output.
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.
 Returns
a lower bound to the energy of the QAOA circuit.
 Return type
output_energy (float)

simplified_estimator.
estimator_energy_QAOA_dep_square_SK
(p, n, depth, verbose=1, method='TN')¶ Returns a lower bound on the energy outputted by a QAOA circuit under depolarizing noise and a squarelattice connectivity graph for the device for the SK model. Note that as the SKmodel corresponds to the complete graph, even moderate values of n already take a considerable time to compute.
 Parameters
p (float) – local depolarizing probability.
n (int) – the number of spins in the SK model.
depth (int) – the depth of QAOA circuit.
verbose (bool) – if set to 1, it will also print the depth of the compiled circuit and at which stage of the process we are at. If 0 there will be no output.
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.
 Returns
a lower bound to the energy of the QAOA circuit.
 Return type
output_energy (float)

simplified_estimator.
estimator_energy_QAOA_dep_square_d_regular
(p, n, d, depth, verbose=1, method='TN')¶ Returns a lower bound on the energy outputted by a QAOA circuit under depolarizing noise and a squarelattice connectivity graph for the device for a random dregular graph.
 Parameters
p (float) – local depolarizing probability.
n (int) – the number of spins in the graph.
d (int) – the number of neighbors of each node.
depth (int) – the depth of QAOA circuit.
verbose (bool) – if set to 1, it will also print the depth of the compiled circuit and at which stage of the process we are at. If 0 there will be no output.
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.
 Returns
a lower bound to the energy of the QAOA circuit.
 Return type
output_energy (float)

simplified_estimator.
estimator_energy_annealer_dep
(r, A, T, method='TN')¶ Returns a lower bound on the energy outputted by a quantum annealer under depolarizing noise for an Ising model.
 Parameters
r (float) – local depolarizing rate.
A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose energy we wish to minimize.
T (float) – total annealing time.
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.
 Returns
a lower bound to the energy of the annealer.
 Return type
output_energy (float)

simplified_estimator.
find_minimum_brute
(A, n)¶ Computes the minimum energy of an Ising model brute force. Should not be attempted at moderate system sizes.
 Parameters
A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose partition function we wish to compute
n (int) – system size.
 Returns
the true minimum.
 Return type
energy_min (float)

simplified_estimator.
part_brute_force
(A, n, beta)¶ Computes the partition function brute force. Should not be attempted at moderate system sizes.
 Parameters
A (scipy sparse matrix) – the (weighted) adjacency matrix of the Ising model whose partition function we wish to compute
n (int) – system size.
beta (float) – inverse temperature of the partition function.
 Returns
the partition function.
 Return type
part (float)

simplified_estimator.
sk_model
(n)¶ Returns the graph for the SKmodel.