uniqc.algorithmics.ansatz.hea module#

Hardware-Efficient Ansatz (HEA).

Generates a parameterised circuit with alternating layers of single-qubit rotations and entangling CNOT gates, suitable for NISQ devices.

uniqc.algorithmics.ansatz.hea.hea(n_qubits, depth=1, qubits=None, params=None)[source]#

Build a Hardware-Efficient Ansatz (HEA) circuit.

The ansatz consists of depth repeated layers. Each layer applies:

  1. Rz(q, θ) Ry(q, θ) on every qubit (parameterised).

  2. A ring of CNOT gates: CNOT(i, (i+1) % n) for i = 0..n-1.

The total number of parameters is 2 * n_qubits * depth.

Parameters:
  • n_qubits (int) – Number of qubits.

  • depth (int) – Number of repeated layers (default 1).

  • qubits (List[int] | None) – Qubit indices. Nonelist(range(n_qubits)).

  • params (ndarray | None) – 1-D array of rotation angles. None → random initialisation.

Returns:

A Circuit object containing the ansatz gates.

Raises:

ValueErrorparams length does not match 2 * n_qubits * depth.

Return type:

Circuit

Example

>>> from uniqc.algorithmics.ansatz import hea
>>> c = hea(n_qubits=4, depth=2)
>>> c.max_qubit + 1
4