Utilities

A collection of utility functions used throught JuliQAOA.

JuliQAOA.statesMethod
states(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]
source
JuliQAOA.dicke_statesMethod
dicke_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]
source
JuliQAOA.get_operator_periodMethod
get_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.

source