A Variational Quantum Eigensolver prepares a parameterized trial state |ψ(θ)⟩ = U(θ)|0…0⟩ with a hardware-efficient ansatz circuit, measures the energy of a target Hamiltonian, and lets a classical optimizer update θ to drive that energy down — the variational principle guarantees ⟨ψ(θ)|H|ψ(θ)⟩ ≥ Eground for every θ.
Per layer l = 1..p, per qubit i:
RY(θ_ry[l,i]) RZ(θ_rz[l,i])
then one ring of CNOTs: (0→1)(1→2)…(N−1→0)
Target Hamiltonian (antiferromagnetic Ising ring):
H = Σᵢ Zᵢ Zᵢ₊₁ (mod N)
Parameter-shift gradient (exact, no finite-difference error):
∂⟨H⟩/∂θ = [⟨H⟩(θ+π/2) − ⟨H⟩(θ−π/2)] / 2
This simulator runs a genuine complex statevector of 2N amplitudes — no approximation. Each Bloch sphere shows one qubit's reduced state, obtained by tracing out the others. The arrow tip pulls in toward the sphere's center exactly when that qubit is entangled with its neighbors (the reduced state becomes mixed, |Bloch vector| < 1) — a real, measurable entanglement signature, not a visual trick.
- Qubits / layers — grows the ansatz; more layers and qubits generally reach lower energy, but also cost more circuit depth on real NISQ hardware.
- Entangler ring — toggling CNOTs off makes every qubit stay a separable pure state (arrows always reach the surface); the optimizer can then only align each spin individually, unable to reach the true entangled ground state of the ring.
- Run Optimization — repeated parameter-shift gradient descent steps. Watch Avg |∂C/∂θ|: as N and p grow, gradients across a random landscape shrink on average — a small-scale, hands-on look at the barren plateau phenomenon (McClean et al. 2018) that makes deep, wide hardware-efficient ansätze hard to train classically.
The reference "Classical ground E_min" is found by brute-force enumeration over all 2N classical spin configurations — useful to see how close the trained quantum ansatz gets to the true minimum.