Swap Equivariant Feature Map
Pairwise permutation-equivariant encoding using symmetric CZ gates for paired feature data.
Qubits
4
Depth
6
Total Gates
20
Simulability
Not simulable
Mathematical Formulation
Description
The Swap Equivariant Feature Map constructs a circuit equivariant under pairwise permutations: swapping feature pairs (x_0, x_1) ↔ (x_2, x_3) results in the corresponding swap of qubits. This is achieved using only gates that commute with SWAP operations — CZ (symmetric two-qubit gate) and Hadamard (symmetric single-qubit gate).
Each layer applies: (1) RY rotations encoding features x_i on each qubit, (2) Hadamard gates for basis mixing, and (3) CZ gates on the feature pairs (0,1), (2,3), etc. The key insight is that CZ is symmetric (CZ = SWAP · CZ · SWAP), H commutes with SWAP, and RY under SWAP exchanges feature values — together ensuring pairwise swap equivariance.
This encoding requires an even number of features (paired structure) and is well-suited for problems with natural feature pair structure, such as comparing measurement pairs, stereo data processing, or problems with permutation symmetry between groups of variables.
Circuit Diagram
Property Radar
Properties
Resource Scaling
How resource requirements grow with the number of input features.
| Features | Qubits | Depth | Gates | 2Q Gates |
|---|---|---|---|---|
| 2 | 2 | 6 | 10 | 2 |
| 4 | 4 | 6 | 20 | 4 |
| 8 | 8 | 6 | 40 | 8 |
| 16 | 16 | 6 | 80 | 16 |
Code Examples
Swap equivariant encoding with PennyLane using CZ gates on feature pairs.
from encoding_atlas import SwapEquivariantFeatureMap
import pennylane as qml
import numpy as np
enc = SwapEquivariantFeatureMap(n_features=4, reps=2)
dev = qml.device("default.qubit", wires=enc.n_qubits)
@qml.qnode(dev)
def circuit(x):
enc.get_circuit(x, backend="pennylane")
return qml.state()
x = np.array([0.1, 0.5, 1.2, 2.3])
state = circuit(x)When to Use This Encoding
- Problems with natural feature pair structure
- Stereo data processing (left/right measurements)
- Comparing measurement pairs with permutation symmetry
- Molecular property prediction for symmetric atom pairs
- Any task where swapping feature groups should not change the prediction
Pros & Cons
Advantages
- Rigorous pairwise swap equivariance — mathematically guaranteed
- Efficient O(n/2) CZ gates per layer — minimal entanglement overhead
- Constant depth per repetition (3 layers per rep)
- Simple circuit structure — easy to implement on hardware
- CZ symmetry naturally respects SWAP operations
Limitations
- Requires even number of features (hard constraint)
- Only captures pairwise permutation — not general permutation symmetry
- Limited expressibility due to sparse CZ pattern
- Features must have meaningful pairing structure
- Not applicable to problems without pair symmetry
References
- [1]Schatzki, L., et al. (2022). Theoretical guarantees for permutation-equivariant quantum neural networks. npj Quantum Information, 8, 130.
- [2]Nguyen, Q.T., et al. (2022). Theory for equivariant quantum neural networks. PRX Quantum, 3(3), 030322.
- [3]Meyer, J.J., et al. (2023). Exploiting symmetry in variational quantum machine learning. PRX Quantum, 4(1), 010328.