Hamiltonian Encoding
Encodes data via Hamiltonian time evolution with configurable interaction types (IQP, XY, Heisenberg).
Qubits
4
Depth
25
Total Gates
52
Simulability
Not simulable
Mathematical Formulation
Description
Hamiltonian encoding maps classical data into quantum states through simulated time evolution under a data-dependent Hamiltonian. The circuit implements U(t) = exp(-iHt) via Trotterized time steps, where the Hamiltonian H incorporates the classical features as coupling strengths.
Four Hamiltonian types are supported: (1) IQP — diagonal Z⊗Z interactions with (π−x_i)(π−x_j) couplings, (2) XY — transverse X⊗X + Y⊗Y interactions modeling quantum spin chains, (3) Heisenberg — full X⊗X + Y⊗Y + Z⊗Z interactions capturing isotropic spin coupling, and (4) Pauli-Z — simplified Z-only single-qubit terms. Each type has different gate decompositions and resource requirements.
This encoding is particularly well-suited for physics simulation tasks where the data naturally maps to Hamiltonian parameters (e.g., molecular energies, lattice couplings). The Heisenberg type requires the most gates (6 CNOTs per pair per rep) but provides the richest interaction structure.
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 | 9 | 14 | 4 |
| 4 | 4 | 25 | 52 | 24 |
| 8 | 8 | 61 | 200 | 112 |
| 16 | 16 | 121 | 784 | 480 |
Code Examples
Hamiltonian encoding with PennyLane using IQP-type interactions.
from encoding_atlas import HamiltonianEncoding
import pennylane as qml
import numpy as np
enc = HamiltonianEncoding(n_features=4, hamiltonian_type="iqp", 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
- Physics simulation tasks (molecular Hamiltonians, lattice models)
- Encoding data with natural physical interaction structure
- Quantum chemistry feature maps
- Time evolution-based quantum ML
- Research into physics-inspired quantum kernels
Pros & Cons
Advantages
- Physically motivated — natural fit for physics simulation data
- Four Hamiltonian types for different interaction structures
- High expressibility from entangling Hamiltonian evolution
- Trotterized evolution provides systematic approximation control
- Configurable single-qubit and two-qubit terms
Limitations
- Deep circuits, especially for Heisenberg type (6 CNOTs per pair per rep)
- O(n²) gate scaling with full entanglement
- Not NISQ-friendly for large feature counts
- Critical point at x = π causes zero interaction angles
- Higher noise sensitivity due to circuit depth
References
- [1]Suzuki, M. (1991). General theory of fractal path integrals with applications to many-body theories and statistical physics. Journal of Mathematical Physics, 32(2), 400–407.
- [2]Lloyd, S. (1996). Universal quantum simulators. Science, 273(5278), 1073–1078.
- [3]Childs, A.M. & Wiebe, N. (2012). Hamiltonian simulation using linear combinations of unitary operations. Quantum Information & Computation, 12(11-12), 901–924.