Utilities
A collection of utility functions used throught JuliQAOA.
JuliQAOA.states — Methodstates(n)Iterate over all n-bit binary arrays.
Example
julia> for state in states(2)
println(state)
end
[0, 0]
[1, 0]
[0, 1]
[1, 1]JuliQAOA.dicke_states — Methoddicke_states(n, k)Iterate over all n-bit binary arrays with exactly k 1's.
The uniform superposition over these states is often referred to as "the" Dicke state $|D^n_k\rangle$.
Example
julia> for state in dicke_states(3,2)
println(state)
end
[1, 1, 0]
[1, 0, 1]
[0, 1, 1]JuliQAOA.get_operator_period — Methodget_operator_period(eigvals; tol=1e-10)Calculate the period of the unitary transformation $e^{i \beta \mathcal{O}}$, where the operator $\mathcal{O}$ has eigenvalues eigvals.
If eigvals is a list of integers, returns 2π/gcd(eigvals). rounds entries of eigvals to integers within tol. Returns Inf if any of the eigvals are non-integers.
JuliQAOA.clean_angles — Methodclean_angles(angles, mixer, obj_vals)Takes angles and mods them into the ranges $\beta_i \in [0,T_{H_M}],~\gamma_i \in [0,T_{H_C}]$, where the operator periods $T$ are calculated with get_operator_period.