Set the coin operator based on the graph’s structure.

Builds a coin operator considering the degree of each vertex. The same coin can be applied to all vertices, or multiple coins can be assigned, each to a specific subset of vertices. After setting the coin operator, the evolution operator is updated accordingly.


Coin to be used. Several types of arguments are acceptable.

  • strcoin type

    Type of the coin to be used. The following are valid entries.

    • ‘default’, ‘d’ : default coin,

    • ‘fourier’, ‘F’ : Fourier coin,

    • ‘grover’, ‘G’ : Grover coin,

    • ‘hadamard’, ‘H’ : Hadamard coin,

    • ‘identity’, ‘I’ : Identity,

    • ‘minus_fourier’, ‘-F’ : Fourier coin with negative phase,

    • ‘minus_grover’, ‘-G’ : Grover coin with negative phase,

    • ‘minus_hadamard’, ‘-H’ : Hadamard coin with negative phase,

    • ‘minus_identity’, ‘-I’ : Identity with negative phase.

  • list of str

    List of the coin types to be used. Expects list with ‘number of vertices’ entries.

  • dict

    A dictionary with structure {coin_type : list_of_vertices}. That is, with any valid coin type as key and the list of vertices to be applied as values. If list_of_vertices = [], the respective coin_type is applied to all vertices that were not explicitly listed.

  • scipy.sparse.csr_array

    The explicit coin operator.

See also



The output of this method is a block-diagonal operator, which results from the specific ordering of arcs in the computational basis (refer to the Notes in Coined for more details). Each block is associated with a \(\deg(v)\)-dimensional coin. As a result, there are \(|V|\) blocks in total. Note that a loop at a vertex \(u\) is treated as the arc \((u,u)\), contributing an additional one to the degree of \(u\).