A header-only C++ quantum simulation stack spanning statevector, Clifford/stabilizer, and MPS simulation, plus continuous-variable photonic simulation (Gaussian Boson Sampling) — with hardware transpilation, RB/XEB/GST characterization, QASM 2.0/3.0 interoperability, and pulse-level gate compilation. Zero Python dependency. Eight independently runnable demos with measured benchmark numbers.
phi-quantum-sim-cpp is the integration layer of the φCoherent quantum stack — the package that pulls together phi-quantum-mps-cpp, phi-quantum-tomography-cpp, phi-quantum-transpile-cpp, phi-quantum-qasm-cpp, phi-quantum-pulse-cpp, and phi-quantum-photonic-cpp into a single buildable, testable, benchmarkable binary. Eight demo programs exercise each major capability area with measured throughput numbers, exact-fidelity verification, and competitive comparisons against IBM Qiskit/Aer, Google Cirq/qsim, Stim, and photonic frameworks (Strawberry Fields, Perceval, PennyLane). Demo 7 extends the suite into quantum cryptography: Shor's algorithm, φHash resistance analysis, Bell-pair key generation, BB84 key distribution, and a complete quantum-secure φCipher channel. Demo 8 introduces the self-dual surface code sweep, comparing the standard Fibonacci surface code ensemble against its self-dual variant (odd distances only) across the physical error rate regime.
The common thread across all seven capability areas is the Fibonacci structure of the algorithms: stabilizer generators extracted in Fibonacci priority order, MPS bond dimensions allocated on a Fibonacci schedule, RB sequence lengths drawn from Fibonacci numbers {2,3,5,8,13,21,34,55}, QASM validator using a five-stage Soma pipeline, pulse gate durations at Fibonacci nanoseconds, and photonic sweep benchmarks across Fibonacci mode counts {2,4,6,8}. This is not cosmetic — each choice produces a measurably better tradeoff in accuracy, memory use, or throughput than the uniform alternatives.
PauliTableau + StabilizerSimulator — 500-qubit GHZ circuit in 1.32 ms (Qiskit Aer: ~500–2000 ms, 100–1000× faster). Ten distance-7 surface code patches (490 qubits, 1190 gates) with syndrome extraction in 3.97 ms total. Fibonacci-ordered generator extraction places highest-confidence stabilizers first — matching the N-nacci priority structure needed for active QEC decoding. Statevector for 500 qubits would require 2^500 bytes — impossible; the stabilizer tableau needs only 122 KB.
MpsSimulator with automatic bond-dimension allocation. GHZ states are exact at bond dim = 2 for any qubit count: 10q in 0.040 ms, 50q in 0.169 ms, 200q in 0.829 ms — all verified 100/100 correct. A 200-qubit statevector would require 2^200 ≈ 10^60 amplitudes; the MPS needs O(800) complex numbers. The MPS crossover point is 8 qubits: below that, statevector is faster (SV 0.017 ms vs MPS 0.046 ms at 4q); above it, MPS wins (MPS 0.126 ms vs SV 0.290 ms at 8q). 30-qubit VQE ansatz (164 gates): circuit in 0.22 ms, 1000 shots in 7.07 ms. Fibonacci bond schedule zero-configuration: caller specifies max_bond, schedule determines per-site allocation automatically.
Randomized Benchmarking at Fibonacci sequence lengths {2,3,5,8,13,21,34,55} — EPC matches theory 2p/3 to 4 decimal places across five noise levels (0–5%). Interleaved RB isolates T-gate error from Clifford baseline. Linear XEB fidelity F_XEB = 1.532 noiseless (n=6, depth=4), dropping to 0.067 at p=0.10. GST extracts per-gate diamond distances in 0.01 ms — zero external dependencies (no pyGSTi required). Qiskit Experiments: RB available but no built-in GST; Cirq: no built-in GST; Stim: no characterization protocols.
CouplingGraph + NativeGateSet + SABRE routing + ZYZ Euler decomposition. Supports IBM heavy-hex, Google grid, IonQ all-to-all, linear chain, and star topologies. ZYZ decomposition error < 1e-15 (H·S·T: 3.04e-16) — machine precision. Routing performance: 8q in 0.06 ms, 64q in 2.35 ms. Fibonacci qubit layout maps logical qubit k → physical F(k), providing quasicrystal-like spacing that minimises SWAP overhead for QEC-structured circuits. All-to-all (IonQ) routing produces zero SWAPs, validating the routing engine. Header-only C++: no Python subprocess required for transpilation in firmware or embedded systems.
Five-stage Soma pipeline (tokenise → validate → AST → Circuit → readiness). QASM 2.0 round-trip fidelity: exact (statevector diff = 0.000) for GHZ, BV, QAOA circuits. Parse latency: 0.003 ms for GHZ(5), 0.008 ms for BV(8), 0.088 ms for QAOA(6q, 3 layers). QASM 3.0: DynamicCircuit with mid-circuit measurement and classical feed-forward — quantum teleportation circuit parsed and re-exported correctly. Validator catches out-of-bounds qubit indices, unknown gates, and syntax errors with line-number annotations. 100–500× faster QASM I/O than Python-based Qiskit for small circuits.
PulseEnvelope (Gaussian, DRAG, flat-top) + PulseChannel (virtual-Z frame tracking) + GateToPulseCompiler. DRAG coefficient β = 1/(2|Δ|) — same formula as IBM Qiskit Pulse, computed from transmon anharmonicity. For |Δ| = 0.3 GHz: β = 1.67 ns, peak Q/I = 20.2%, leakage suppression ~100× vs plain Gaussian. Virtual-Z gates are zero-duration LO frame changes — Rx(π/2) compiles to one 8 ns SX pulse plus two zero-time phase shifts, exact to machine precision. Fibonacci gate durations {5, 8, 13, 21, 34} ns align T2-optimal gate times with the Fibonacci sequence. Header-only C++ embeds in firmware AWG controllers without a Python runtime.
GaussianSimulator (O(n²) symplectic covariance-matrix evolution, 30 modes) + FockSimulator (truncated Fock space, cutoff=10, 8 modes, gate unitaries precomputed once per run and reused across shots) + DVPhotonicsSimulator (dual-rail qubit bridge delegating to HAL StatevectorBackend). GBS demo: 4-mode squeezed interferometer (r=0.8) → Haar interferometer → PNR; even-parity fraction = 1.000 — GBS signature confirmed. Single-mode squeezed vacuum |S(r)|0⟩ has only even Fock components; photon-number-preserving operations (beam splitters, phase shifts) conserve total parity; Fock simulation reproduces this exactly via joint sampling with state collapse between measurements. Photon-number distribution computed via stable generating-function recursion — (n+1)P(n+1) = D(2n+1)/(2C)·P(n) − En/C·P(n−1) — replacing Laguerre quadrature which is unstable at large n. Gaussian always faster than Fock: 8/8 sweep points. Only C++ framework providing CV Gaussian + Fock + DV dual-rail in a single header-only library, with no Python runtime — unlike Strawberry Fields, Perceval, and PennyLane. Requires phi-quantum-photonic-cpp.
Compares SelfDualFibonacciSurfaceQEC (odd N-nacci distances only — self-dual by construction) against the standard FibonacciConcatenatedSurfaceQEC across a physical error rate sweep. At order 2 with 4 levels, the self-dual family selects distances {3, 5, 13, 21} (skipping even Fibonacci values d=8, d=34) for 1,284 total qubits, versus the standard {3, 5, 8, 13} at 530 qubits — a 2.4× qubit overhead in exchange for the HX = HZT structural symmetry guarantee. At p_phys ≤ 0.005 both families achieve comparable logical error rates; the standard variant has an advantage at higher noise levels where its denser Fibonacci spacing covers the distance range more efficiently. Winner reported per sweep point with Wilson 95% CI. Requires phi-quantum-codes-cpp.
Against IBM Qiskit/Aer, Google Cirq/qsim, Stim, Strawberry Fields, Perceval, and PennyLane: phi-quantum-sim-cpp is the only framework in this comparison that provides stabilizer simulation, MPS with automatic Fibonacci bond scheduling, RB + XEB + GST, hardware transpilation, QASM 3.0 with mid-circuit measurement, pulse-level DRAG compilation, photonic simulation (CV Gaussian + Fock + DV dual-rail), and discrete symmetry verification (CPT — all 7 non-trivial {C,P,T} check combinations) — all in a single header-only C++ stack with no Python dependency. Photonic frameworks (Strawberry Fields, Perceval, PennyLane) are Python-only; none provides all three photonic paradigms in one library; none bridges photonic ops to a qubit backend without code duplication. No existing framework provides a self-dual surface code ensemble with parity-period analysis and structural symmetry guarantees derived from the N-nacci sequence. Measured numbers and full methodology in docs/COMPETITIVE_ANALYSIS.md.
Automatic Fibonacci bond schedule — exact GHZ simulation at 200 qubits in 0.829 ms, zero configuration.
RB + XEB + GST in one header. Fibonacci sequence lengths. EPC matches theory to 4 decimal places.
ZYZ decomposition error < 1e-15. SABRE routing with Fibonacci qubit layout. 64-qubit chain in 2.35 ms.
Exact round-trip fidelity for GHZ, BV, QAOA. 0.003 ms parse. QASM 3.0 DynamicCircuit + feed-forward.
CV Gaussian (O(n²), 30 modes), Fock-space (cutoff=10, 8 modes), DV dual-rail bridge to HAL. GBS even-parity bias confirmed. Header-only C++, no Python runtime.
Published under the GNU AGPLv3 with reference implementation and full demo suite. Commercial licensing is available for closed-source deployments.