S_x, S_y, and S_z.
Use these primitives when your variational model should stay inside a spin-symmetry-respecting subspace, such as Heisenberg-style spin systems.
This page is a workflow guide: it shows how the building blocks fit together, with runnable examples. For exact signatures, parameter defaults, and return types, see the SU(2)-equivariant gates API reference.
Overview
Two-qubit equivariant gate
su2_equivariant_2_qubit_gate(theta) returns a 2-qubit QuantumCircuit. It phases the singlet sector and leaves the triplet sector unchanged, making it the basic building block for SU(2)-equivariant ansatze.
Three-qubit equivariant gate
su2_equivariant_3_qubit_gate(theta0, theta1, theta2, theta3) returns a 3-qubit QuantumCircuit. The four angles parameterize the allowed mixing between the two spin-1/2 copies while preserving the spin-3/2 sector.
Build an equivariant ansatz
su2_equivariant_ansatz(...) wires the 2-qubit gate into a parameterized circuit. Supported layouts are:
"brickwork": nearest-neighbor even bonds, then odd bonds, repeated."linear": adjacent chain pairs, repeated.- A custom list of qubit pairs, such as
[[0, 1], [1, 2], [0, 2]].
Verify structural equivariance
The ansatz remains equivariant for any parameter values because every block is equivariant.Spin operators
spin_generators(n) returns dense (S_x, S_y, S_z). total_spin_ops(n) returns (S^2, S_z). These are useful for diagnostics and for building symmetry-aware observables.
Compile an equivariant target
Usehaiqu.su2_equivariant_compilation(...) to fit a shallow brickwork circuit of 2-qubit SU(2) gates to an equivariant target.
This is a Haiqu cloud job. It requires a logged-in SDK session and an API key. The target can be a
QuantumCircuit, Gate, or dense numpy.ndarray. The fit builds a dense unitary, so targets are capped at 10 qubits.