prune_angles#
- iqm.qaoa.tree_calculation.tree_calculation.prune_angles(layer, big_gamma, big_beta)#
Take the full array of Gamma / Beta angles and shorten them to those relevant for layer
layer.The arrays of Gamma / Beta angles are assumed to have the form described in equation (A8) in [8], that is \(\Gamma = (\gamma_1, ..., \gamma_p, 0, -\gamma_p, ..., -\gamma_1)\), where
pis the total number of QAOA layers. This is pruned to only include angles relevant for QAOA layerlayerand to remove the central 0. Note that onlylayer-1Beta angles are relevant for layerlayer.- Parameters:
layer (int) – Specifying up to which layer should the arrays of angles be trimmed.
big_gamma (ndarray[tuple[Any, ...], dtype[float64]]) – An array of the gamma QAOA angles (sorted ascedingly and descendingly in an array).
big_beta (ndarray[tuple[Any, ...], dtype[float64]]) – An array of the beta QAOA angles (sorted ascedingly and descendingly in an array).
- Returns:
A tuple containing the pruned arrays of angles
big_gammaandbig_beta.- Raises:
ValueError – If the input
layeris more than the number of QAOA layers.ValueError – If the input
layeris less than 1.
- Return type:
tuple[ndarray[tuple[Any, …], dtype[float64]], ndarray[tuple[Any, …], dtype[float64]]]