The Quantum Engineer

68. Project 3 — Noisy Quantum Simulator

Implement: bit flip, phase flip, depolarizing noise, amplitude damping, measurement errors. (Chapters 29–31.)

Specification. Extend qsim (or new package qnoise) with: (1) channel framework apply_channel(state, kraus_ops) — pure-state stochastic (sample one Kraus per application, tracking the outcome) and density-matrix evolution ρ → Σ K ρ K†; (2) the named channels with tunable probabilities: bit flip (X with p), phase flip (Z with p), depolarizing (Ch. 29's mixture), amplitude damping (Kraus pair with γ — T1 physics), measurement error (confusion matrix per qubit, applied at readout); (3) T1/T2 modeling: idling as thermal-relaxation channels parameterized by real device numbers (T1=200 µs, T2=100 µs, gate times from Ch. 15); (4) validation experiments — amplitude-damping |1⟩ population decays as (1−γ)ᵗ exactly; depolarizing shrinks Bloch vectors toward origin isotropically; measurement-error matrix recovered by prepare-and-measure calibration.

Milestones. M1: Kraus framework, bit/phase flip verified. M2: depolarizing + Bloch-vector shrinkage plot. M3: amplitude damping + T1 decay curve matched to theory. M4: measurement error + calibration inversion. M5: a full noisy run — Grover-4 under a composite noise model, compared to ideal, gap explained quantitatively; then Aer's NoiseModel.from_backend on the same circuit, three-way comparison (yours/Aer/ideal).

Acceptance criteria. Every channel's action verified against closed-form predictions in tests; density-matrix and stochastic-sampling evolution agree statistically; the composite-noise Grover analysis quantitatively attributes the fidelity loss to channels (gate error vs. damping vs. readout — a decomposition table, not a vibe).

What it proves. Part IX is real to you: noise is no longer a black box called "decoherence" but an operator algebra you have implemented and measured. Effort: 2–3 weekends.