tensorcircuit.templates.ansatz#

Shortcuts for reusable circuit ansatz

tensorcircuit.templates.ansatz.QAOA_ansatz_for_Ising(params: List[float], nlayers: int, pauli_terms: Any, weights: List[float], full_coupling: bool = False, mixer: str = 'X') Any[source]#

Construct the QAOA ansatz for the Ising Model. The number of qubits is determined by pauli_terms.

Parameters
  • params – A list of parameter values used in the QAOA ansatz.

  • nlayers – The number of layers in the QAOA ansatz.

  • weights – A list of weights corresponding to each Pauli term.

  • (optional) (full_coupling) – A flag indicating whether to use all-to-all coupling in mixers. Default is False.

Pauli_terms

A list of Pauli terms, where each term is represented as a list of 0/1 series.

Paran mixer (optional)

The mixer operator to use. Default is “X”. The other options are “XY” and “ZZ”.

Returns

QAOA ansatz for Ising model.