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:
Rz(q, θ) → Ry(q, θ)on every qubit (parameterised).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:
- Returns:
A
Circuitobject containing the ansatz gates.- Raises:
ValueError – params length does not match
2 * n_qubits * depth.- Return type:
Example
>>> from uniqc.algorithmics.ansatz import hea >>> c = hea(n_qubits=4, depth=2) >>> c.max_qubit + 1 4