get_f#
- iqm.qaoa.tree_calculation.tree_calculation.get_f(p, a, big_beta)#
Represents the function \(f(\mathbb{a})\) defined in (9) and (10) in [8].
For a given basis state \(\mathbb{a}\) (i.e., an array of +1 and -1), this calculates the function \(f\). The function is one half of a product of expectation values of the form \(\langle a_k | e^{i\beta_k X} | a_{k+1} \rangle}\) for variable \(k\).
- Parameters:
p (int) – The number of QAOA layers.
a (ndarray[tuple[Any, ...], dtype[int8]]) – The array of basis states of the ket and bra vector which appear in the definition of :math`f(mathbb{a})`.
big_beta (ndarray[tuple[Any, ...], dtype[float64]]) – The array containing the beta angles of the QAOA, sorted ascendingly and descendingly as \((\beta_1, \beta_2, ... , \beta_p, -\beta_p, -\beta_{p-1}, ..., -\beta_2, -\beta_1)\).
- Returns:
The value of the \(f(\mathbb{a})\) function.
- Raises:
ValueError – If
ais not a 1D array.ValueError – If
adoes not have length2*p+1.ValueError – If
big_betais not a 1D array.ValueError – If
big_betadoes not have length2*p.ValueError – If
acontains other entries than +1 or -1.ValueError – If
big_betais not antisymmetric.
- Return type:
complex128