get_exp_vals#
- iqm.qaoa.tree_calculation.tree_calculation.get_exp_vals(p, big_d, h, big_gamma, big_beta, basis_list_t=None)#
Calculates the expectation values of <Z> and <ZZ> terms.
Basically, this reproduces the full calculation in equations A41-A44 and A49. The sum in equation A43 over \(t_a>t_b\) is split in two cases, \(t_b = 0\) and \(t_b > 0\).
- Parameters:
p (int) – The number of QAOA layers, corresponding to the largest order of the fixed points that we want to calculate.
big_d (int) – Graph regularity minus one. Note that in expressions with \(\gamma\), we use \(\sqrt{D}\) in the denominator instead of \(\sqrt{d} = \sqrt{D+1}\), but this just introduces a small factor to the gamma angles.
h (float) – The local field of the problem.
big_gamma (ndarray) – The array of the \(\gamma\) angles of the QAOA. The full array, with a 0 in the middle (see A8).
big_beta (ndarray) – The array of the \(\beta\) angles of the QAOA. The full array, with a 0 in the middle (see A8).
basis_list_t (None | list[list[ndarray]]) – For some compatibility, the basis list sorted by the symmetry sectors can be pregenerated and given as an input. Otherwise it’s generated internally.
- Returns:
A tuple of two floats representing the expectation values of <Z> and <ZZ> respectively. The output values are typed as np.complex128, but they are in fact real values (so their imaginary component is minimal).
- Return type:
tuple[complex128, complex128]