graph LR S["Halton sites\n20 x 2"] --> D["distance matrix D"] D --> B["basis matrices\nSigma_1 ... Sigma_m"] Y["biased sample\ncovariance Y"] --> O["cutting-plane\noracles"] B --> O O --> P["coefficients p\nOmega(p)"] style S fill:#eceff4,stroke:#4c566a,stroke-width:3px style D fill:#fff9c4,stroke:#f57f17,stroke-width:3px style B fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style Y fill:#fadbd8,stroke:#c0392b,stroke-width:3px style O fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style P fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px
graph TB PY["Python\ncorr-solver\nnumpy + Protocol"] --> C["identical math\nidentical experiments"] CPP["C++20\ncorr-solver-cpp\ntemplates + Werror"] --> C RS["Rust\ncorr-solver-rs\nndarray + traits"] --> C C --> E["four CSV tables\nbit-for-bit identical"] style PY fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style CPP fill:#fde2e4,stroke:#c0392b,stroke-width:3px style RS fill:#fff3cd,stroke:#b8860b,stroke-width:3px style C fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style E fill:#ffccbc,stroke:#bf360c,stroke-width:3px
graph LR T["tests"] --> H["corr_solver.hpp"] B["benchmark"] --> H E["experiments"] --> H H --> C["corr_solver.cpp"] H --> O["oracles\nhpp + cpp"] H --> L["layouts\nhpp + cpp"] H --> G["geometry + sites\ncpp"] style H fill:#ffccbc,stroke:#bf360c,stroke-width:3px style T fill:#eceff4,stroke:#4c566a,stroke-width:3px style B fill:#eceff4,stroke:#4c566a,stroke-width:3px style E fill:#eceff4,stroke:#4c566a,stroke-width:3px style C fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style O fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style L fill:#fff9c4,stroke:#f57f17,stroke-width:3px style G fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
graph TB F["fit(Y, site, m, oracle, core, basis)"] --> B1["PolynomialBasis"] F --> B2["BSplineBasis"] B1 --> L["Layout\ninitial guess"] B2 --> L L --> M["MleLayout\nplain n"] L --> A["LsqAugmented\ncoeffs + t"] style F fill:#ffccbc,stroke:#bf360c,stroke-width:3px style B1 fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style B2 fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style L fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style M fill:#fff9c4,stroke:#f57f17,stroke-width:3px style A fill:#fff9c4,stroke:#f57f17,stroke-width:3px
graph LR M["MleOracle"] --> S["MleScratch\nR, S, SY"] C["CccpMleOracle"] --> S M --> O["optim_cut\nt + cut"] C --> O S --> L["LDLT sqrt\ninv_upper_tri"] style M fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style C fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style S fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style O fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px style L fill:#eceff4,stroke:#4c566a,stroke-width:3px
graph TB W["make_backend(name)"] --> P["PurePythonBackend"] W --> N["NumbaBackend"] P --> O1["LMI0 / LMI / QMI\nLSQ / MLE"] N --> O2["JIT kernels\nsame interface"] K["KERNELS[name]"] --> G["gaussian"] K --> X["exponential / matern32 / matern52"] style W fill:#ffccbc,stroke:#bf360c,stroke-width:3px style K fill:#ffccbc,stroke:#bf360c,stroke-width:3px style P fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style N fill:#fde2e4,stroke:#c0392b,stroke-width:3px style O1 fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style O2 fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style G fill:#fff9c4,stroke:#f57f17,stroke-width:3px style X fill:#fff9c4,stroke:#f57f17,stroke-width:3px
graph LR CORE["core"] --> W{"n_coeff set?"} W -->|yes| D["MonoDecreasingOracle2"] W -->|no| R["raw oracle"] D --> B["basis oracle"] style CORE fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style W fill:#fff9c4,stroke:#f57f17,stroke-width:3px style D fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px style R fill:#eceff4,stroke:#4c566a,stroke-width:3px style B fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px
graph LR G1["global RNG"] -.->|before| S1["create_2d_isotropic"] R1["explicit StdRng"] -->|after| S2["create_2d_isotropic_with"] S1 --> Y1["Y"] S2 --> Y2["Y\nsame stream"] style G1 fill:#fde2e4,stroke:#c0392b,stroke-width:3px style R1 fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style S1 fill:#eceff4,stroke:#4c566a,stroke-width:3px style S2 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style Y1 fill:#fff9c4,stroke:#f57f17,stroke-width:3px style Y2 fill:#fff9c4,stroke:#f57f17,stroke-width:3px
graph TB H["fit() driver"] --> B["Basis\npoly / bspline"] H --> S["solvers\nLayout + cores"] S --> P["protocols"] S --> M["math_utils"] B --> K["kernels"] T["tests / experiments"] --> H style H fill:#ffccbc,stroke:#bf360c,stroke-width:3px style B fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style S fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style P fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px style M fill:#fff9c4,stroke:#f57f17,stroke-width:3px style K fill:#fff9c4,stroke:#f57f17,stroke-width:3px style T fill:#eceff4,stroke:#4c566a,stroke-width:3px
graph TB A["Halton sites\nhalton.hpp"] --> D["distance matrix\ngeometry.cpp"] D --> M["polynomial basis\ncorr_solver.cpp"] M --> O["LsqOracle / MleOracle\nCccpMleOracle"] O --> L["layouts\ninitial guesses"] O --> S["MleScratch + optim_cut\noracles.hpp"] O --> Q["QmiOracle\nqmi_oracle.cpp"] style A fill:#eceff4,stroke:#4c566a,stroke-width:3px style D fill:#eceff4,stroke:#4c566a,stroke-width:3px style M fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style O fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style L fill:#fff9c4,stroke:#f57f17,stroke-width:3px style S fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px style Q fill:#ffccbc,stroke:#bf360c,stroke-width:3px
graph TB CV["convert\nArr to Array2"] --> F["fitting\nFitResult + drivers"] ND["ndops\nmatmul trace inv_upper_tri"] --> F LY["layouts\ninitial guesses"] --> F MC["mle_common\nMleScratch optim_cut"] --> F EM["mle_oracle"] --> MC F --> BIN["benchmark / experiments / tests"] style CV fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style ND fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style LY fill:#fff9c4,stroke:#f57f17,stroke-width:3px style MC fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px style F fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style EM fill:#eceff4,stroke:#4c566a,stroke-width:3px style BIN fill:#ffccbc,stroke:#bf360c,stroke-width:3px
graph TB PY["Python\npytest 23 passed\npre-commit\nmypy"] --> E["iteration bounds\nUNCHANGED"] CPP["C++\nxmake build -a\nxmake test"] --> E RS["Rust\ncargo test\nclippy + fmt + doc"] --> E E --> C["4 CSV tables\nBIT-FOR-BIT IDENTICAL"] style PY fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style CPP fill:#fde2e4,stroke:#c0392b,stroke-width:3px style RS fill:#fff3cd,stroke:#b8860b,stroke-width:3px style E fill:#d5f5e3,stroke:#2e7d32,stroke-width:3px style C fill:#ffccbc,stroke:#bf360c,stroke-width:3px