Skip to main content
SU(2)-equivariant circuits preserve global spin symmetry. A unitary is SU(2)-equivariant when it commutes with the three global spin generators 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

The utilities covered in this guide are:
FunctionPurpose
su2_equivariant_2_qubit_gate(theta)Return the 2-qubit SU(2)-equivariant primitive gate.
su2_equivariant_3_qubit_gate(theta0, theta1, theta2, theta3)Return the exact 3-qubit SU(2)-equivariant gate.
su2_equivariant_ansatz(num_qubits, layout="brickwork", num_layers=1, name="theta")Build a parameterized equivariant ansatz from 2-qubit primitives.
brickwork_pattern(num_qubits, num_layers)Return nearest-neighbor even-then-odd pair layout.
is_su2_equivariant(U, tol=1e-8)Check whether a dense unitary commutes with all three global spin generators.
spin_generators(num_qubits)Return dense (S_x, S_y, S_z).
total_spin_ops(num_qubits)Return (S^2, S_z).

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]].
Use a custom layout when your problem graph is not a simple chain:

Verify structural equivariance

The ansatz remains equivariant for any parameter values because every block is equivariant.
By contrast, a generic hardware-efficient ansatz usually breaks global spin symmetry because single-qubit rotations do not commute with all global spin generators.

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

Use haiqu.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.
You can compare the original and compiled circuits after transpilation: