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 [7].
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 in an array of length 2*p 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 a is not a 1D array.
ValueError – If a does not have length 2*p+1.
ValueError – If big_beta is not a 1D array.
ValueError – If big_beta does not have length 2*p.
ValueError – If a contains other entries than +1 or -1.
ValueError – If big_beta is not antisymmetric.
- Return type:
complex128