diff --git a/.crumb b/.crumb index fc8316d4b..8d7c080a6 100644 --- a/.crumb +++ b/.crumb @@ -51,8 +51,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "c5fe948d9189727537c8fd182841fa0258f7e1399065a75a378a64cb98eb4627", - "last_commit": "5901baa5", + "digest": "26ad30306af327e06a46a0b30e06fa9726c95a627772ebcf31eb54a824ec5366", + "last_commit": "0f6d7151", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -63,8 +63,8 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "f6d1a9bb8d18f58cddfbea2f9ecce90f27f5b5f75b584b3a0f1ce1cea509044c", - "last_commit": "18531691", + "digest": "62dcb70a0d4fc4f1685b4067757119514c70ec97fbb31a2ef44b3a6f3ec7b3e6", + "last_commit": "ac35a166", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -87,33 +87,33 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "10a7c4a3722e34cc5476cb9feb128616b59dfb58bcf33f6aad7db51c014576ef", - "last_commit": "5901baa5", + "digest": "dbcd8678fc48b25073ce3a9c773de759d0782a3f9ee1aa051a09acddbf8da4a0", + "last_commit": "2ec9e45f", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "c5837ce9777c62e8a126c1be31fffcabf2a5291d901a682607ed2ce257ba521a", - "last_commit": "d05bb251", + "digest": "1a7ec3be8f1a68674ec997fc9c0f973a62432b1e19fdb977e1a0fd0ff3b9fdcb", + "last_commit": "2ec9e45f", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { - "digest": "751046d381404b4a7ed1c8c001d2525cf0fe79cf7570bca83ee67f12214563cc", - "last_commit": "5901baa5", + "digest": "830418862bdcd02444691e0b076e753a6eea237d4a018ce1704b58fdfa1da16d", + "last_commit": "48c6ed71", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:75a12e92451a668d461d62665111f3c89cd0c0c0d1c5a5586cd318106ffcd96c", - "compiled_at": "2026-10-14T14:51:53Z", + "children_root": "sha256:185564aefb27ae4685eaf016fc4b420e3cb30bcbe01124ac1ae48368e4757f77", + "compiled_at": "2026-10-14T17:30:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:3e830fcdd744598fc56e5d56fa1668d3fc84f4855092ff79e7854e2e55ba1fe1", - "evidence_files": 7245, - "evidence_root": "sha256:035beef5cdb99afaefd1743640f5e7eeaaed13c4a5ec6c8b4b6a4cb0c528407a", - "files": 9752, - "generated_at_commit": "d05bb251468046196d0ef01c8d3b2910ed0c497b", - "source_tree": "sha256:6cd5ce105a24af68a3005a83f4dd0032093785c7245162aed83b932e2c55d1a7" + "digest": "sha256:0a453766c0615157b0095773ee82c35982218b228c7018fd1c1e1e9d9d1350f7", + "evidence_files": 7247, + "evidence_root": "sha256:20290a287ff9e41206a9b6407aa8498d99f03353274c197209fddcafde24811a", + "files": 9778, + "generated_at_commit": "2ec9e45fbc14d6838cceffe5c164f2af43b61a31", + "source_tree": "sha256:45ff98ad2feeef6b4f467f0a0fdc6e1eeee707c563475a5cc35bc88dda9dc843" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/reservoir.yml b/.github/workflows/reservoir.yml new file mode 100644 index 000000000..3e81c0b74 --- /dev/null +++ b/.github/workflows/reservoir.yml @@ -0,0 +1,59 @@ +name: Omega reservoir + +# omega#440 ionic-droplet reservoir (docs/reservoir/RESERVOIR_REFERENCE.md). +# Path-filtered, physics-free, CPU only (nothing here opens a GPU): the Gate 1 +# simulator and readout tests, the Gate 2 archive-reader tests on the two +# committed CC-BY fixtures (plain and ASan/UBSan), the build of the Gate 2 +# tool and its config-drift check. The Gate 2 comparison itself needs the +# authors' archive (Zenodo 10.5281/zenodo.17296788) and runs locally +# (make qualify-reservoir RES_ARCHIVE=...); its receipts are under +# evidence/RESERVOIR/. +# On pull_request actions/checkout uses refs/pull/N/merge: the merged result is tested. + +on: + pull_request: + paths: + - 'src/reservoir/**' + - 'tests/reservoir/**' + - 'tools/reservoir/**' + - 'mk/reservoir.mk' + - 'docs/reservoir/gate2_config.json' + - 'src/omega_numeric*' + - 'src/omega_blackwell_*' + - 'src/sha256.*' + - '.github/workflows/reservoir.yml' + push: + branches: [main] + paths: + - 'src/reservoir/**' + - 'tests/reservoir/**' + - 'tools/reservoir/**' + - 'mk/reservoir.mk' + - 'docs/reservoir/gate2_config.json' + - 'src/omega_numeric*' + - 'src/omega_blackwell_*' + - 'src/sha256.*' + - '.github/workflows/reservoir.yml' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + reservoir: + name: reservoir-gates + runs-on: ubuntu-24.04-arm + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - name: Reservoir tests (Gate 1, Gate 2 reader, Gate 2 config) + run: | + set -o pipefail + make PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-reservoir | tee res.log + test "$(grep -cE '^test_reservoir: [0-9]+ checks, 0 failed' res.log)" -eq 2 + test "$(grep -cE '^test_res_mat: [0-9]+ checks, 0 failed' res.log)" -eq 2 + grep -q 'Gate 2 config unchanged' res.log diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 279cda6d8..47ff40719 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,6 +10,7 @@ Every model below did real work. A model is listed only for work it did. The orc | Codex (GPT-6.1 Sol) | Code review of the numeric changes (patch checks, receipt blobs, GPU lock handling) | | Gemini 3.8 Flash | Code review of the numeric changes (patch checks, qualifier script, build rules) | | Codex | Numeric uncertain-completion retention, exact completion checks, and simulated-driver lifecycle regression tests | +| Claude Opus 5.5 | Ionic-droplet reservoir (#440): pinned reference, CPU simulator and readout, `.mat` reader, Gate 2 comparison, benchmarks, timing and receipt | This table starts with the numeric work on this branch. Earlier work in this repository is not yet attributed here; add rows only for work that can be traced to a model. diff --git a/docs/.crumb b/docs/.crumb index 17f44ba0a..e7622e20d 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -64,7 +64,7 @@ }, { "digest": "1b01542d91e3b1c7c5263d6b393338a3d9d40e138a12ec833ce7852d83887ce2", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "crumbs", "purpose": "Directory docs/crumbs. Purpose not yet described by a human." }, @@ -88,16 +88,22 @@ }, { "digest": "5f91761066f42aceaa64aa34ac2e168ed70553c8174747c9a4a02938124609fd", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "osc", "purpose": "Directory docs/osc. Purpose not yet described by a human." }, { "digest": "4229246f2ec98403252caafc8fe7ad1fac5950accff0c94ffdaecb4a2341a32c", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "polyglot", "purpose": "Directory docs/polyglot. Purpose not yet described by a human." }, + { + "digest": "46d3e2d59a468271e044ccd2398eb32345df6436c15eb6d8c703953c838023a9", + "last_commit": "0f6d7151", + "name": "reservoir", + "purpose": "Reservoir reference and contracts (omega#440): RESERVOIR_REFERENCE.md pins the authors' paper an" + }, { "digest": "2ab37838f8694e5060a3789f08a16146996050af949fba329ed805429d85f695", "last_commit": "f633e343", @@ -112,20 +118,20 @@ }, { "digest": "a34f126f92a0ec36794a17c3c4834101c44bc9b0f6e412894e3f152598133638", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "turing", "purpose": "Directory docs/turing. Purpose not yet described by a human." } ], - "children_root": "sha256:21baf488e23c336e0bda51d4085a214730da428e07bb75e05318fda829527330", - "compiled_at": "2026-10-14T01:16:48Z", + "children_root": "sha256:bd77c6d04a64e013d571cb019c3ae53a6bd44997d0999ccaf3075f20f2cf58a4", + "compiled_at": "2026-10-14T17:04:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:c5fe948d9189727537c8fd182841fa0258f7e1399065a75a378a64cb98eb4627", + "digest": "sha256:26ad30306af327e06a46a0b30e06fa9726c95a627772ebcf31eb54a824ec5366", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", - "files": 121, - "generated_at_commit": "e0abd0b524f5bf8e3ba6960b53868980bdd41b4e", - "source_tree": "sha256:45069bfdaeb2bcf8d4c545c676ebf76ad39afa2a77d638c72950d7fa0c663cbe" + "files": 123, + "generated_at_commit": "ee2a3833b3abab5df585bd7e089f764c6dd273e9", + "source_tree": "sha256:637aaa352dd331f567968c2c14f136e91ac1b7629e3725a1dbfc1bda13ea484e" }, "owner_lane": "", "provenance": { diff --git a/docs/reservoir/.crumb b/docs/reservoir/.crumb new file mode 100644 index 000000000..d210c86cd --- /dev/null +++ b/docs/reservoir/.crumb @@ -0,0 +1,20 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-14T17:03:15Z", + "compiler": "crumb-compile/1", + "digest": "sha256:46d3e2d59a468271e044ccd2398eb32345df6436c15eb6d8c703953c838023a9", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 2, + "generated_at_commit": "0f6d71513dfd29b85b22fe2ca15e4287991e7303", + "source_tree": "sha256:17707abc7cf66b1b872b85e27530ade52f44f58f0f0c54348a9d2ebe8e2abbee" + } + }, + "layer": "docs/reservoir", + "name": "docs/reservoir", + "purpose": "Reservoir reference and contracts (omega#440): RESERVOIR_REFERENCE.md pins the authors' paper and code, lists discrepancies, declares the Gate 2 contract and benchmark protocol before any run, and reports the results; gate2_config.json is generated by res_qualify config and checked for drift.", + "schema_version": "1.0.0" +} diff --git a/docs/reservoir/RESERVOIR_REFERENCE.md b/docs/reservoir/RESERVOIR_REFERENCE.md new file mode 100644 index 000000000..8cfa86a41 --- /dev/null +++ b/docs/reservoir/RESERVOIR_REFERENCE.md @@ -0,0 +1,948 @@ +# Ionic-droplet reservoir: pinned reference and Gate 2 contract (omega#440) + +Status: Gate 0 (reference pinned), Gate 1 (CPU simulator, tests) and Gate 2 +(comparison against the archived reference outputs, benchmarks, timing) run +on branch `research/reservoir-440`; Gate 2 results and their receipt are in +section 11. Gate 2 result in one line: the three Lorenz networks PASS, the +one comparable NARMA case FAILs (an ill-conditioned reference fit, section +11.1), 63 NARMA cases are BLOCKED, and no reservoir beats the conventional +baselines in the benchmarks. The authors' MATLAB was not run: no MATLAB or +Octave on this machine (section 5). + +The design of `src/reservoir/` is Omega's own. The authors' code and numbers +are used only as a correctness reference: no line of MATLAB was ported, the +model was re-derived from the equations below, and every place where Omega +differs from the reference method is listed with the measurement that +justifies it (section 6). + +Tags used below: **[code]** read from the archived MATLAB (file:line), +**[paper]** stated in the article or supplement, **[archive]** read from an +archived `.mat` file, **[measured]** produced by `make test-reservoir` on +this branch, **UNVERIFIED (p%)** a claim not checked by a tool, with a +confidence. + +## 1. Provenance + +| Item | Value | +|---|---| +| Article | Armendarez, Mohamed, Hasan, Najem et al., "Neuromorphic tissues: Soft biomolecular networks for brain-inspired temporal computing", Science Advances 12(30), eaed0971 (2026). DOI 10.1126/sciadv.aed0971, PMC13394382. License of the article: CC BY-NC 4.0. | +| Supplement | Texts S4 (network model), S5 (parallel reservoir), S6 (error measures), local copy `/tmp/res440/paper/sm.txt` | +| Code and data | Zenodo record 17296788, DOI 10.5281/zenodo.17296788 (concept DOI 10.5281/zenodo.17296787), published 2025-10-08, no version string in the record metadata. Record license: CC-BY-4.0. Creators: Armendarez N., Mohamed A., Hasan M. S., Najem J. | +| Archive file | `repo.zip`, md5 `ad2c5057dfeafe890e624d8b1174f5d8`, sha256 `54582293dff8e9327b9187d3e5526b0e0cdcc41ca7ac87c762850bdb342dea15` | +| License inside the archive | `LICENSE` says MIT (Copyright 2025 Ahmed Salah Mohamed, Joseph Najem, and collaborators); `CITATION.cff` also says MIT with DOI "10.5281/zenodo.TBD". The record says CC-BY-4.0. Omega copies no code; the topology tables in `tests/reservoir/res_fixtures.h` are data taken from the archive with this attribution, which satisfies both licenses. | + +Files relied on (sha256 of the archived copy; paths under +`src/Codes for Zenodo/` or `data/raw/Codes for Zenodo/`): + +| File | sha256 | +|---|---| +| NARMA Final Code/Connected Reservoir/HyperParameterTuningOptimized.m (below: **H**) | `620640f002068048ab2c56f5090dc945e7b81595a9bc7f863331659a1850ceb5` | +| NARMA Final Code/Parallel Reservoir/ParallelReservoirNARMA.m | `f120f9150db590e3fcf767cbd1840e0924f513b45d44cf8439be2229be0fb507` | +| Lorenz Final Code/Lorenz63SolverCustomRegression.m (43 nodes, below: **L**) | `d291460fffe4efc1b2f013060c04e3a561dcd571de813a9c95277557daafdcac` | +| Lorenz Final Code/Lorenz63SolverCustomRegression13Nodes.m | `c9e2ad2b64832c50c95f9d61e86161496aef40640cc547d1d5ae3a9323eedbf1` | +| Lorenz Final Code/Lorenz63SolverCustomRegression25Nodes.m | `c1b31403cc9a2014c2f3b65056873306ed52174142259b5127b30c803927dece` | +| Lorenz Final Code/LorenzDataGenerator.m | `7295d55fa3e1209b74b4804f9de18f4952950020f32d0f318695286c5ccdfa1d` | +| Connected Reservoir/Length5.mat | `dc6e7914d216a21f664adcd4843e9f705616df47511879ba0bbeceb241b9b50a` | +| Connected Reservoir/Length10.mat | `ceca1f6e94f3239b2df072403a488f8929fe00673b5028319cd2094d6eae708e` | +| Connected Reservoir/Length20.mat | `aeb87fcec7655ce72386fdc28f2878b1f7b89097db523ab9fe5812fb6c4d1ee6` | +| Connected Reservoir/Length50.mat (identical copy under Parallel Reservoir/) | `ff4c9d14abb6f64b1ab9f301072dc67316b7fd59fe61d0b7632ee467a8c2aae3` | +| Connected Reservoir/trainSignal.mat | `48e8e2c775fda4ca85dfc14a3c202319d9c75e2d7db0baf237744ce51a4b02c1` | +| Connected Reservoir/testSignal.mat | `f0e34c5733e2cc20852caf4874b92bcb19fcb95bd4da4ce0eb7f4919cabee8c1` | +| Connected Reservoir/HyperParameterOptimizationVariablesToPlot.mat | `6311b719d47bfa92b76e1c71b3e9fe0e2e30d564d9ee7c7b2f231a03683e66fd` | +| Parallel Reservoir/ParallelReservoirDataToPlot.mat | `ccf13dd5045a50ce5e474915225f4961d6e56b949985ef701bffe3316822f1c6` | +| Lorenz Final Code/LorenzData1.mat | `6229d996681ef7e64336ef4f04e7bd82c0a8063e6e18e52667c699251091f6c4` | +| Lorenz Final Code/LorenzData2.mat | `d1c0dcccbee809e8880dd5b0e355dd456ab1605d0470dbfa99e1a54b2b51073a` | +| Lorenz Final Code/Figure5_Data.mat | `f6055bc6b79cc686a5c7cca703fdf2e35de50e202e245bfe07f10f91ecad3500` | +| Lorenz Final Code/Figure5_Data13Nodes.mat | `74988e19bd24540b0f623e20295a2813a0206917cdf6072d0dfaf69f8d091ed7` | +| Lorenz Final Code/Figure5_Data25Nodes.mat | `0d85b0eaef9c6bb4eed07a3fe8f395802afbde0c3a75403ba216b55220754205` | +| Lorenz Final Code/LorenzNormalizedNRMSEs.mat | `514ba3082a21eb541e0af8a9fbb80596742f9ddafee466391a00842a5d4e5616` | +| Lorenz Final Code/LorenzNormalizedNRMSEs13Nodes.mat | `5f2d18b150d5baa9e792aa967d46a541a6031ff2805467ba30b72db745d55733` | +| Lorenz Final Code/LorenzNormalizedNRMSEs25Nodes.mat | `881e92a0a5cd6b46fb588b41593e83d66ec2af25d16fb7198444fc82c3aaf14d` | + +All 19 `.mat` files are MAT version 5 (header "MATLAB 5.0 MAT-file, +Platform: PCWIN64"), data elements zlib-compressed (miCOMPRESSED). None is +v7.3/HDF5. They were read with a throwaway reader outside this repository; +nothing in the archive was executed or built. + +### 1.1 A newer version of the code and data exists (not the pinned reference) + +**[archive]** Zenodo concept 10.5281/zenodo.17296787 has a second version, +record 20277956, dated 2026-05-18, CC-BY-4.0, one file +`Neuromorphic_Tissues_Manuscript_Repo.zip`, 2,584,641,526 bytes, md5 +`61c10efb77f6140882ab16c6ab25dbe5` (record metadata, read by the +orchestrator through the Zenodo API). The pinned reference stays version 1 +(record 17296788): it is the version the paper's data-availability statement +cites, and Drake's decision is to compare against its archived outputs. + +Version 2 was examined without downloading it, from its zip central +directory (last 1 MiB of the file, HTTP range request) and one 8 KiB range +holding one changed file: + +- 78 entries, 2,586,892,630 bytes uncompressed. +- All 19 version-1 `.mat` files are present with the same size and CRC-32. +- 5 of the 6 `.m` files are identical (size and CRC-32). The exception is + `HyperParameterTuningOptimized.m` (v1 32,353 bytes, CRC-32 aaf83c2e; v2 + 32,689 bytes, CRC-32 001a836f, sha256 of the extracted v2 file + `125187e7697113c25186345eff93f3baba8ae16a0d96e2465720a50adcbe6aed`). Its + header now says "Edited filepath to work in arbitrary folder", and the + diff has two changes: the Length file path (v2 lines 54-58), and the + readout features, which now append squared states, `[statesSampled, + statesSampled.^2]` with twice the state columns (v2 lines 168, 176-177). + That is the paper's "augmented with squared states" (discrepancy 6) and is + a functional change, despite the v1 header. +- New in version 2: `src/.../Connected Reservoir/HyperParameterOutputAll.mat` + (2,506,601,735 bytes, the bulk of the archive; by its name the + `save('HyperParameterOutputAll.mat')` of the whole workspace at v1 H:212, + which would include the ode15s state trajectories `xTrainCell`, UNVERIFIED + (60%), not downloaded), a second + `HyperParameterOptimizationVariablesToPlot.mat` under `src/` (14,525,399 + bytes, CRC-32 fdea4aa1, differs from the v1 copy under `data/raw/`), + `Trainsignal.mat` and `Testsignal.mat` (about 1.4 MB each), editor + autosave files (`.asv`), a manuscript PDF and manifest files. + +The version 2 `src/.../HyperParameterOptimizationVariablesToPlot.mat` was +then fetched on its own (one HTTP range of its 14,239,572 compressed bytes at +the offset the central directory gives, spliced into a sparse copy of the +zip and extracted with `unzip -p`, which checks its CRC-32 fdea4aa1). The +extracted file is 14,525,399 bytes, sha256 +`317af7a76051e6c30aa0476a612c29e417b199c9ef226f4f00d7f7505512fc92`. Read with +the in-house MAT reader (section 7.1 item 10), compared with the version 1 +copy: + +- Same variables. The four option vectors and all 576 non-empty target cells + (`yTrainCell`, `yTestCell`) are bit-identical. +- All 576 non-empty prediction cells differ, and 504 of 640 `NRMSEtrain` and + 495 of 640 `NRMSEtest` entries differ. In each file the stored NRMSE equals + the S6 formula applied to that file's own predictions and targets (worst + relative difference 2.6e-15). +- At the G2-N1 cell (5 nodes, 0.1 nA, M = 2) version 2 is lower at every + order, for example NARMA-2 test 0.356722 against 0.421309, NARMA-10 test + 0.598446 against 0.623601. + +This is consistent with version 2's results having been produced by version +2's code (squared-state features) and version 1's results by a feature set +without squares; which code produced each file stays UNVERIFIED without +MATLAB (discrepancy 15). G2-N1 tests it numerically (section 7.1 items 1 and +10). + +## 2. What the paper claims + +- **[paper] S4 eq. 18**: one membrane, dV/dt = (h / (eps A)) (I_inj - V G_u N_a A). +- **[paper] S4 eq. 19**: alpha(V) = 1 / (0.001 e^(2.22 V)). +- **[paper] S4 eq. 20**: N_ss(V, c) = 0.002 e^(689.4 c V), c in micromolar. +- **[paper] S4 eq. 21**: dN_a/dt = alpha(V) N_a (1 - (N_a / N_ss(V))^Z), Z a shape parameter (no value given). +- **[paper] S4 network form**: KCL per node with membrane area matrix A; initial conditions "x_i(t = 0) = 0 for all nodes and membranes (zero initial voltages and pore densities)"; integrated with MATLAB ode15s (sm.txt:567-572). +- **[paper] NARMA (main text)**: u(k) uniform in [0, 0.5], mapped to I_inj in [I_min, I_max], binary mask (1 keeps the encoding, 0 flips the range), mask segment theta = 1 ms; 3000 training and 3000 testing inputs, last K = 800 kept; states = node voltages sampled at the end of each pulse; features augmented with squared states. Best configuration N = 50 nodes, M = 3; connected NARMA-2 train/test NRMSE 0.0103 / 0.0124, NARMA-10 0.236 / 0.327; parallel NARMA-2 0.433 / 0.458, NARMA-10 0.546 / 0.627. +- **[paper] Lorenz (main text)**: 1 Lorenz time unit = 1 s; inputs linearly scaled to -50 to +50 nA; branched network, three injection nodes, one grounded central node; ridge readout mapping states to the next Lorenz state; 43-node test NRMSE x, y, z = 0.071, 0.183, 0.174; 13- and 25-node networks obtained by removing outer layers. +- **[paper] S6**: NMSE = sum |y_ref - y_pred|^2 / sum |y_ref - mean(y_ref)|^2, NRMSE = sqrt(NMSE). + +## 3. What the code does + +### 3.1 Model (both tasks) + +State: node voltages V (V), then one pore density N_ij per directed membrane +side (i -> j), dimensionless count per the code's units. + +- Capacitance: **[code] H:228, H:354-356; L:26-27, L:72** M V' = B with + M = (eps / h_m) (diag(rowsum(Aarea)) - Aarea), Aarea = adjacency * 5e-8 m^2 + (all membranes the same area A = 5e-8 m^2; `conmat` entries are 0/1 + **[archive]**). Ground rows and columns removed and V'_ground = 0 + (**H:388-403** `solveWithMultipleKnown`, **L:74-76, L:320-326** Cholesky). + Injected current at a ground node is dropped. +- Currents: **[code] H:358-361, L:315-319** B_i = I_i + sum_j G_u A (N_ij + N_ji) (V_j - V_i), G_u = 5e-8 S (**H:249, L:26**). +- Pore kinetics: **[code] H:304-319, L:331-338** with dV = V_i - V_j and the + parameters of the side's start node i: + dN_ij/dt = (1e4 / (tau0 e^(dV / v_tau))) N_ij (1 - (N_ij / (N0(c_i) e^(dV / v_e)))^Z), + N0(c) = 0.002 e^(3.7919 c) (**H:236, L:58**), Z = 0.00015 (**H:317, L:335**), + tau0 = 0.001 s (**H:237, L:56**), v_e = 0.0055 V (**H:239, L:59**), + v_tau = 0.045 V NARMA (**H:238**), 0.0454 V Lorenz (**L:57**). + The result is passed through `real()`; NARMA replaces a NaN derivative + by 0 (**H:378-380**). +- Constants: h_m = 4e-9 m (**H:247, L:35**); eps = 8.85e-12 F/m NARMA + (**H:248**), 2.1 * 8.85e-12 F/m Lorenz (**L:34**). +- Concentrations: repeating 1, 2, 3 uM by node number (**H:231-234, L:52-54**); + 0-based node i has c = 1 + (i mod 3). +- Initial conditions: V = 0. NARMA N_ij(0) = N0(c_i) (**H:264-281**; the + `inex == 2` branch is never taken because every `inex` entry of the four + Length files is 1 **[archive]**). Lorenz N_ij(0) = 1 (**L:68, L:166-167**). +- Solver: ode15s, RelTol 1e-6, AbsTol 1e-8 (**H:287-290**; **L:83, L:102** + with a Jacobian sparsity pattern). Binary64 throughout (MATLAB default). + Output at the solver's own steps (two-element time span, **H:288, L:82**). + +### 3.2 Topologies + +- NARMA chains, `Length{5,10,20,50}.mat` **[archive]**: `conmat` 0/1, `ground`, `inex`. + Length5/10/20 are the path 1-2-...-L grounded at L. Length50 is one path + with permuted node numbers, 49 edges, leaves 1 and 2, ground 50 (an + interior node). All four are in `res_fixtures.h` or built by + `omega_res_topology_chain`. +- Lorenz lattices **[code]**: neighbour tables L:212-254 (43 nodes, ground 21, + inputs 1, 28, 42, L:30-31), 13Nodes.m:211-223 (ground 8, inputs 1, 2, 13), + 25Nodes.m:211-235 (ground 14, inputs 1, 2, 25). The tables are + symmetrized with max(A, A') and the diagonal zeroed. Counted after + symmetrization: 13 nodes 21 edges, 25 nodes 51 edges, 43 nodes 99 edges; + centre degree 6, every injection node degree 1 **[measured]** (tests + `test_reference_lattices`). + +### 3.3 Inputs + +- NARMA, condition 7 (**H:55, H:583-603**): rng(2), u = rand(1, 1000) * 0.5 + for train and test (**H:458-466**); I = u * I_hi / 0.5 with I_lo = 0 + (**H:468**); each sample lasts M sub-pulses of pw = 1 ms (**H:49**), each + sub-pulse 10 rows at dt = 0.1 ms (**H:462-463**); node n gets mask + `superSequence(M, n)` = a cyclic slice of the binary de Bruijn sequence + B(2, ceil(log2 M)) starting at randi(2^n) after rng(n) (**H:404-423**); mask + bit 1 -> I, bit 0 -> I_hi - I (`inverter`, **H:297-301**). Currents are + linearly interpolated between the 0.1 ms rows (**H:328**). Grid: I_hi in + {0.1, 0.25, 0.5, 1} nA, M in {2, 3, 4, 5}, L in {5, 10, 20, 50} (**H:17-19**). +- Lorenz (**L:17, L:41-49, L:150-163**): X, t from LorenzData1.mat (train, + 2105 samples, t in [0, 40], non-uniform) and LorenzData2.mat (test, 2185 + samples, starts at 1.01) **[archive]**. I_in1 = (x * 1.05e-10 + 1e-9) / 10, + I_in2 = (y * 1.05e-10 + 1e-9) / 10, I_in3 = z * 2.05e-10 / 10, linear + interpolation on the non-uniform t (`griddedInterpolant`), Lorenz time + used as seconds. + +### 3.4 Sampling, features, readout, error + +- NARMA sampling (**H:616-640**): row i (1-based) is V of every node at + t = i * pw * M + k * pw, k = 1..M, linearly interpolated in the ode15s + output; a row with any time past the end is set to zero. Features + (**H:163-177**): [zeros row; sampled rows], L * M voltage columns plus the + input u as last column, no squared terms. NARMA-o targets (**H:110-142**): + y(c) = 0.3 y(c-1) + 0.05 y(c-1) sum_{i=0}^{o-1} y(c-1-i) + 1.5 u(c-o) u(c-1) + 0.1. + Readout (**H:180-201**): rows 100 .. 995 (896 samples), `fitlm` ordinary + least squares with intercept, no ridge, orders 2..10, NRMSE by + `goodnessOfFit(pred, ref, 'NRMSE')`. +- Lorenz (**L:106-139, L:173-183**): features = all node voltages at every + ode15s output time (ground column pinned to 0), range-scaled to [0, 1] with + the training min and max, bias column prepended (**L:344-360**); targets = + the Lorenz signal interpolated at the same times (**L:118, L:179**); + multi-output ridge with unpenalized bias, W = (Phi'Phi + lambda P) \ Phi'Y + (**L:362-369**); lambda from linspace(0.033, 0.035, 101) by 5-fold blocked + cross-validation, folds round(linspace(0, n, 6)), score = mean of the three + NRMSEs (**L:121-123, L:371-405**). +- NRMSE: `goodnessOfFit` with 'NRMSE' is ||ref - pred|| / ||ref - mean(ref)||, + the same as S6 eq. 25. UNVERIFIED (85%): taken from the MathWorks + description, not checked against MATLAB. + +### 3.5 Archived results usable as reference + +- **[archive]** HyperParameterOptimizationVariablesToPlot.mat: NRMSEtrain and + NRMSEtest (4 x 4 x 4 x 10: L, I_hi, M, order), predictionTrainCell, + predictionTestCell, yTrainCell, yTestCell (896 samples each). Test NRMSE at + L = 50, I_hi = 0.1 nA, M = 3: NARMA-2 0.0124, NARMA-10 0.3269 (matches the + paper's 0.0124 and 0.327). +- **[archive]** trainSignal.mat / testSignal.mat (connected): uTrain, uTest, + sequenceTrain/Test, Itrain/Itest 20000 x 5, trainsignaltime 0..1.9999 s: + the inputs of grid cell L = 5, I_hi = 0.1 nA, M = 2. +- **[archive]** Figure5_Data{,13Nodes,25Nodes}.mat: Ytrain, Ytest, predicted + X/Y/Z (train and test) at the ode15s output times, timeSolutionTrain/Test + (43 nodes: 55134 / 55425 points), nrmseTraining, nrmseTest. 43-node test + NRMSE 0.0707, 0.1825, 0.1737; train 0.0607, 0.1669, 0.1326. 13 nodes test + 0.1245, 0.2435, 0.2223. 25 nodes test 0.1099, 0.1556, 0.2172. +- **[archive]** ParallelReservoirDataToPlot.mat: parallel NARMA NRMSE (test + NARMA-2 0.4577, NARMA-10 0.6273). + +## 4. Discrepancies + +Paper against code: + +1. alpha: paper 1 / (0.001 e^(2.22 V)); code 1e4 / (0.001 e^(dV / 0.045)), that is e^(22.2 dV) and an extra factor 1e4. +2. N_ss: paper 0.002 e^(689.4 c V) (one exponent, product of c and V; 689.4 = 3.7919 / 0.0055); code 0.002 e^(3.7919 c) e^(dV / 0.0055) (sum of exponents). Different functions of c and V. +3. Initial conditions: paper zero pore densities; code N0(c) (NARMA) or 1 (Lorenz). N = 0 is a fixed point of eq. 21, so the paper's stated initial state would never move. +4. Z: no value in the paper; code 0.00015. +5. NARMA data size: paper 3000 + 3000 inputs, last 800 kept; code 1000 + 1000, rows 100..995 (896). +6. NARMA features: paper adds squared states; code has none (voltages plus u). +7. NARMA sampling: paper "at the end of each pulse"; code row i samples the sub-pulses of input i + 1 (query times i * pw * M + k * pw with 1-based i, the comment at H:625 states the 0-based formula). +8. NARMA best configuration: the paper calls N = 50, M = 3 optimal; in the archived grid M = 5 is better for NARMA-2 (0.0058) and NARMA-3 (0.0182). +9. Lorenz current range: paper -50 to +50 nA; code, over the archived training and test data, -0.091 to +0.306 nA (x node), -0.158 to +0.386 nA (y node), +0.020 to +0.982 nA (z node). +10. Lorenz target: paper "next Lorenz state"; code fits the signal at the same time as the state (L:118, L:179). +11. Permittivity: the code uses eps = 8.85e-12 for NARMA and 2.1 * 8.85e-12 for Lorenz; the paper gives no value. + +Code against its own archive: + +12. LorenzDataGenerator.m writes `Lorenz63_Data.mat` on a 266485-point uniform grid from (1, 1, 1); the solvers load LorenzData1.mat (2105 non-uniform points) and LorenzData2.mat (starts at 1.01). The archived Lorenz data were not produced by the archived generator. +13. Signal file names: the code saves `Trainsignal.mat` (H:611), the archive holds `trainSignal.mat`. +14. The 25-node builder is named `buildAdjacencyMatrix43` (25Nodes.m:208-209). +15. Every `.m` file carries "Added comments/documentation only; no functional changes" and "arithmetic update" markers: the archived results may come from an earlier version of the code. Not checkable without MATLAB. +16. Silent repairs in the reference: `real()` of the pore derivative, NaN derivative replaced by 0 (H:378-380), NaN sample rows replaced by 0 (H:633-635). Omega refuses these cases instead. + +## 5. Reproduction of the reference: NOT_RUN + +`command -v matlab`, `command -v octave` and `command -v octave-cli` all +return nothing on this machine; nothing was installed. Running the reference +also needs `fitlm` (Statistics and Machine Learning Toolbox) and +`goodnessOfFit` (System Identification Toolbox, UNVERIFIED 85%). This is a +decision for Drake (section 9). Gate 2 below is designed to run without +MATLAB against the archived outputs. + +## 6. The Omega implementation (Gate 1) + +Files: `src/reservoir/omega_reservoir.{h,c}` (simulator), +`src/reservoir/omega_reservoir_readout.{h,c}` (ridge and NRMSE), +`tests/reservoir/` (tests, binary64 oracle, fixtures), `mk/reservoir.mk`. + +Same model as section 3.1, written in Omega's own form: + +- Separate types: topology (canonical sorted edges, degree per node, + grounds, every component grounded), parameters, integrator, built + configuration (factored Laplacian, derived constants, identity), state, + input table, workspace, run receipt, readout. +- State y = ln N per side (exact change of variables): y' = alpha (1 - e^w), + w = Z (y - ln N_ss). Densities stay positive under an explicit method, and + 1 - e^w is evaluated without cancellation (series for |w| <= 0.5). +- binary32, round to nearest, no flush to zero, `-ffp-contract=off`, all + exp/log/div/sqrt through `omega_math_*`; declared update order in the + header; deterministic, bit-identical across runs. +- Classical RK4, fixed step h, integer time; compensated (TwoSum) state update. +- Input: piecewise-linear current on a uniform knot grid (the NARMA + reference grid exactly: 0.1 ms rows). +- Stiffness guard: refuses a step with h * lambda > 2 (lambda bounds the + fastest decay rate). +- Refusals with error codes for invalid topology or parameters, NaN or + infinity, a membrane voltage |V_a - V_b| > 1 V (node voltages: finite + only; section 12), ln N outside [-80, 80], |I| > 1 uA, time past the + last knot, state of another configuration, aliasing. Membranes above + 0.3 V are counted as physically implausible and recorded, not refused. +- Caller-owned fixed-size buffers (up to 64 nodes, degree 6), no + allocation (checked by `reservoir-purity` with `nm -u`), no OmegaTensor use. +- Content identity: SHA-256 with domain separation through `src/sha256.c` + (config id, input digest, state digest, run id). No new crypto. + +Implemented topologies: those the reference uses, chains and the hexagonal +lattices (any graph of degree <= 6 with a ground in every component). +Not implemented: the parallel reservoir (voltage-clamped membranes, +ParallelReservoirNARMA.m), per-membrane areas other than one shared value. + +### 6.1 Where Omega differs from the reference method, and the evidence + +The reference integrates in binary64 with ode15s (variable order NDF/BDF, +RelTol 1e-6, AbsTol 1e-8). Omega uses binary32 RK4 at a fixed step. The +check: an independent binary64 oracle (`tests/reservoir/res_oracle64.c`: +N itself as state, libm `pow`/`exp`, LU with partial pivoting, adaptive +Dormand-Prince 5(4) restarted at each knot) run at a tight tolerance +(rtol 1e-10, atol 1e-14) as truth and at the reference's tolerances +(rtol 1e-6, atol 1e-8) as the matched-tolerance run. The oracle is not +ode15s (not the same method); it matches the tolerance and precision. + +**[measured]** maximum |V_omega - V_truth| over all nodes and knots (plain +build; the ASan build runs shorter scenarios with the same pattern): + +| Scenario | max abs V | h = 1e-4 s | 5e-5 | 2e-5 | 1e-5 | 5e-6 | binary64 at ref. tol. | +|---|---|---|---|---|---|---|---| +| 1 membrane, 0.1 nA, 200 ms | 85.9 mV | 1.43e-8 V | 1.47e-8 | 1.47e-8 | 1.47e-8 | 1.47e-8 | 3.9e-16 | +| chain 5, masked NARMA-style drive, 200 ms | 289 mV | 3.84e-8 | 3.84e-8 | 3.58e-8 | 3.58e-8 | 3.58e-8 | 4.0e-12 | +| hex 13, Lorenz constants, sine drive, 100 ms | 86.1 mV | 2.38e-8 | 2.51e-8 | 2.60e-8 | 2.60e-8 | 2.60e-8 | 6.1e-16 | + +Reading: the binary32 error is 2 to 5 ulps of V (at most 3e-7 of the +largest voltage) and flat in h, so truncation error is below binary32 +resolution over the whole range; the reference tolerances are tight enough +that the matched-tolerance run sits 4 orders of magnitude closer to truth +than binary32 can. Before the compensated update the error grew as h +shrank (one membrane: 2.1e-6 V at h = 1e-5 s, 6.0e-6 V at 5e-6 s) because +increments near equilibrium fell below half an ulp; the TwoSum carry +removed it (header comment, `omega_reservoir.h`). + +Step choice: h = 1e-5 s with 10 steps per 0.1 ms knot is the declared +Gate 2 step. Accuracy would allow 1e-4 s; the smaller step keeps a 10x +margin to the stability limit for stiffer states (larger voltage swings +raise alpha by e^(|dV| / v_tau)), and the guard refuses a step rather +than run unstable. + +Other deliberate differences: no `real()` and no NaN-to-0 repair (refusal +instead); state variable ln N instead of N; current at a ground node +ignored (as the reference does). + +### 6.2 Gate 1 tests and results + +`make PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-reservoir`: +purity check, then 656 checks in a plain and an ASan/UBSan build: topology +validation and canonical form, the reference lattices and the 50-chain +(edge counts, degree histograms, boundary degree, grounds, injection nodes), +parameter refusals, identity (order-independent, -0 = +0, one ulp in any +field changes it), zero-input fixed point, closed-form decay of ln N, +charging V = I t / C and I t / (2C), saturation at the bisected V*, +connected response and an exactly-at-rest disconnected component, the +43-node lattice smoke run, bit-identical reproducibility (two runs, +step-by-step against `advance`, dirty all-NaN workspace), digests and run +receipts, every refusal path, oracle agreement (contract: every step size +within 1e-6 of max |V|; reference tolerances within 1e-9), ridge readout +and S6 NRMSE (sqrt(1/5) case). Result: all pass in both builds. + +Mutation controls (scratch copies outside the repo, test run against each): +uncompensated update -> 13 failures; RK4 weight 2 -> 1.9 -> 25 failures; +stiffness guard disabled -> 1 failure. `make test-numeric-cpu` passes +(21 of 21, 5 declared chip-only skips). + +## 7. Gate 2 comparison contract (declared before any comparison is run) + +All comparisons use the archived files of section 1 as inputs and as +reference outputs, the Omega simulator at h = 1e-5 s, K = 10, and the +binary64 readout. Inputs are stored in binary32 knots (relative rounding +6e-8, declared). Tolerances are engineering choices fixed here; a failure +is investigated, never answered by loosening them. + +**G2-N1, NARMA, executable now.** Grid cell L = 5 (Length5.mat, path +grounded at node 5), I_hi = 0.1 nA, M = 2, condition 7. +- Inputs: archived Itrain and Itest (20000 x 5) used as the knot table, + 20000 knots at 0.1 ms; uTrain, uTest archived. +- Simulation: V = 0, N(0) = N0(c_i) per side, to t = 1.9999 s. +- Sampling and features exactly as section 3.4 (including the one-sample + offset, zeroed rows past the end, the zero first row and the appended u). +- Readout: least squares with intercept (lambda = 0) on rows 100..995 for + orders 2..10. +- Metrics and acceptance: (a) NARMA targets against yTrainCell / + yTestCell{1,1,1,o}: max abs difference <= 1e-12; (b) predictions against + predictionTrainCell / predictionTestCell{1,1,1,o}: RMS difference <= 1 % + of the target standard deviation; (c) NRMSE against NRMSEtrain / + NRMSEtest(1,1,1,o): |difference| <= max(0.005, 5 % of the reference + value). All nine orders must pass. + +**G2-L1, Lorenz, executable now.** 43, 25 and 13 nodes. +- Inputs: archived LorenzData1 (train) and LorenzData2 (test); currents as + section 3.3, resampled onto a uniform 0.1 ms knot grid (400001 knots). + This resampling is an approximation of the reference's interpolation on + the non-uniform t; its maximum current error is computed and reported + before the comparison. +- Simulation: V = 0, N(0) = 1, t in [0, 40] s. +- Sampling: V at the archived timeSolutionTrain / timeSolutionTest points + (linear interpolation between Omega steps 1e-5 s apart); targets by + linear interpolation of X at those times. +- Readout: range scaling with training min/max, bias, ridge with + unpenalized bias, lambda by the 5-fold blocked CV over + linspace(0.033, 0.035, 101) as section 3.4; the chosen lambda is + reported (it is not archived). +- Metrics and acceptance: predictions against archived predictedX/Y/Z + (train and test): RMS difference <= 1 % of the target standard deviation + per variable; NRMSE against nrmseTraining / nrmseTest: |difference| <= + max(0.005, 5 % of the reference value). + +### 7.1 Amendments, declared 2026-10-14 before any Gate 2 comparison was run + +Committed before the comparison tool was first run against the archive +(the commit order on the branch shows it). They clarify or tighten the +contract above; none loosens a tolerance. + +1. **Second NARMA feature set (N1b).** Zenodo version 2 of the same concept + (section 1.1) changes HyperParameterTuningOptimized.m to append squared + states: features [V, V.^2, u] (v2 lines 168, 176-177). G2-N1 is therefore + run twice with identical inputs, simulation and acceptance criteria: + **N1a** = v1 code features (V, u), as contracted above; **N1b** = v2 code + features (V, V^2, u). Each gets its own PASS or FAIL. Neither substitutes + for the other. If exactly one passes, that is evidence about which code + produced the archived v1 results (discrepancy 15), not a choice of the + better number. +2. Feature columns that are identically zero over the fit rows (the ground + node's voltage and its square) are removed before the fit. fitlm drops + them as rank deficient; the predictions do not depend on them. +3. PASS or FAIL uses `omega_res_readout_fit` (lambda = 0, LDL of the normal + matrix). A Householder QR solve of the same least-squares problem (the + method family of fitlm) is reported as a diagnostic only. +4. "Target standard deviation" in criterion (b) of both cases is the + population standard deviation of the archived reference targets of that + split and output. +5. State traces: the v1 archive holds no reservoir state trajectories, only + inputs, targets, predictions and NRMSE. A state-trace comparison against + the authors' code is BLOCKED. The intermediate quantities compared are the + input currents (knot rounding and resampling error), the targets and the + predictions. Omega's state traces were compared with the independent + binary64 oracle in Gate 1 (section 6.1). +6. Negative controls, expected to FAIL: **NC-N** = N1a with the permittivity + multiplied by 2.1 (the Lorenz value); **NC-L** = G2-L1 on 13 nodes with + the NARMA permittivity 8.85e-12 F/m. A control that passes is reported as + a finding that the contract cannot see that error. +7. Positive controls: each archived NRMSE is recomputed from the archived + predictions and targets with the S6 formula (checks the metric + definition); for Lorenz, archived Ytrain/Ytest must equal LorenzData1/2 X. +8. Lorenz time mapping: an archived sample time t maps to step position + t / 1e-5. The binary32 step is fl32(1e-5) = 9.99999975e-6 s, so Omega's + integration time runs 2.5e-8 relative short of nominal (1 us over 40 s); + declared, not corrected. +9. Lorenz knot grid: 400001 knots, k * 1e-4 s for k = 0..400000 (archived t + runs from 0 to 40 exactly). +10. **Added before the first run, after the version 2 results file was read + (section 1.1): N1b-v2.** N1b's Omega predictions are also compared, + under the same criteria (a), (b) and (c), with the version 2 archived + results (the sha256-pinned 14,525,399-byte file). N1a and N1b against + version 1 stay as declared in item 1. This adds a case and loosens + nothing. The pinned reference remains version 1; N1b-v2 is reported as + a separate row, and a PASS there is agreement with version 2's code and + outputs, not with the version the paper cites. + +**BLOCKED or out of scope** +- NARMA grid cells other than (5, 0.1 nA, 2): their masks come from + MATLAB's rng(n) / randi, which is not reimplemented. Needs MATLAB, or a + verified reimplementation (the only check available offline is the 5 + mask bits recoverable from the archived cell). +- The parallel reservoir (S5): not implemented in Omega. +- Rerunning the authors' MATLAB, and whether the archived results came from + the archived code (discrepancy 15): needs MATLAB. +- Lorenz data generation (discrepancy 12): the archived LorenzData files are + taken as given inputs. +- Physical droplets and experiments: outside any numerical comparison. + +## 8. What a receipt proves + +`omega_res_run_receipt` binds config id (topology, parameters, step, and the +numeric policy string), input digest, step count and final-state digest. +It proves that this configuration, this input and this numeric policy +produced this final state on Omega's CPU tier, bit for bit, and lets anyone +rerun and compare. Together with the test results above it records +agreement with the binary64 oracle on the stated scenarios. Agreement with +the published reference is what Gate 2 adds; section 11.7 states what its receipt proves and what it does not. No receipt or test here says +the model describes real droplets: that is the authors' physical claim, and +section 4 lists where their own paper and code disagree about the model. + +## 9. Decisions for Drake + +Decided by Drake on 2026-10-14: + +1. MATLAB access (section 5): no MATLAB or Octave is installed. Gate 2 + compares against archived outputs only: the one NARMA grid cell whose + inputs are archived and the three Lorenz networks. The authors' code + stays NOT_RUN and the other 63 NARMA cells stay BLOCKED. +2. Where paper and code disagree (discrepancies 1-3, 9-10), the canonical + model is the authors' code, because the archived numbers come from the + code. The discrepancy list (section 4) is kept. + +Decided by the orchestrator on 2026-10-14, under Drake's standing +delegation, after the first Gate 2 run (receipt `6d1c5abb...`): + +3. The simulator's 1 V refusal applies to each membrane voltage + |V_a - V_b|, not to the node voltages. Node voltages are referenced to + the common ground and add up along a chain; the pores see only the + voltage across their own membrane. 1 V is a numerical guard against + blowups, not physics. The paper says rupture can occur "when voltages + exceed ~200 to 300 mV", so a membrane above 0.3 V is flagged as + physically implausible and recorded, never refused. Node voltages are + checked for finiteness only. Full rule, reasoning and evidence: + section 12. Under this rule the 50-node NARMA chain is still refused, + now by the stiffness guard (section 11.2). + +Open, raised by the rerun (section 11.2), not decided: + +4. Whether to run the 50-node chain at a step smaller than the declared + h = 1e-5 s. A smaller step raises the decay rate the guard accepts + (h * lambda <= 2); whether the run would then complete is UNVERIFIED. + Any such run would be post hoc and labeled so. None has been run. + +## 10. Gate 2 benchmark protocol (declared 2026-10-14, before any benchmark run) + +Omega's own benchmark, on data from Omega's own generator. It is not a +reproduction of the paper's numbers (those are section 7). The same +simulator, step (h = 1e-5 s, K = 10) and readout serve every reservoir. + +**Generator.** splitmix64 (`tools/reservoir/res_common.c`), one stream per +(seed, purpose). Seeds 1, 2, 3, 4, 5. Every seed is reported, including +failures. + +**Readout (all models alike).** Features standardized with the training +mean and population standard deviation; ridge with an unpenalized bias +(`omega_res_readout_fit`); lambda from {1e-6, 1e-5, ..., 1e2} (9 values) by +5-fold blocked cross-validation on the training rows only (contiguous folds, +score = mean validation NRMSE); refit on all training rows; the test run is +touched once, for the reported test NRMSE (S6 formula). + +**NARMA-2, -5, -10.** u ~ U[0, 0.5) i.i.d.; 2000 training and 1000 test +inputs, separate runs from rest; targets by the reference recursion +(section 3.4); the first 100 targets of each run are washout. Drive as the +reference condition 7: M = 3 sub-pulses of 1 ms, I_hi = 0.1 nA, mask bit 1 +-> I = 2 u I_hi, bit 0 -> I_hi - I; per-node masks are cyclic slices of the +de Bruijn sequence 0011 with a start drawn from the generator. Sampling: the +voltages at the end of each sub-pulse of input c - 1, plus u(c - 1), are the +features for target y(c) (the paper's "end of each pulse"; not the code's +one-sample offset, discrepancy 7). +- **RC-connected**: the 50-node reference chain (Length50.mat), NARMA + constants, 49 driven nodes, 148 features. +- **RC-disconnected**: the same 49 driven nodes, concentrations, masks and + currents; every inter-droplet membrane removed and each driven node given + one membrane to a grounded droplet of its own concentration (grounds shared + by at most six driven nodes; a grounded droplet is held at 0 V, so this + couples nothing). 58 nodes, 148 features. This is the coupling ablation in + the same current-driven model. The paper's parallel reservoir (S5, + ParallelReservoirNARMA.m) is a different, voltage-clamped model with other + kinetics and is not implemented. +- **RC with squared states**: NOT_RUN for NARMA (295 features, above the + readout bound of 256). +- **BL-linear**: ridge on the delay line u(c-1) .. u(c-12) (12 features). +- **BL-quadratic**: the same plus every product u(c-i) u(c-j), i <= j + (90 features). + +**Lorenz63.** sigma 10, rho 28, beta 8/3, binary64 RK4 at dt = 1e-4 (1 +Lorenz time unit = 1 s, as the paper). Initial state from the generator +(x, y in [-10, 10), z in [10, 40)), 20 time units discarded, then 20 time +units recorded; training and test are separate trajectories. Currents into +injection nodes 1, 28, 42 of the 43-node lattice as the reference code +(section 3.3); the 1e-4 s trajectory points are the knots. Sampling every +10 ms; the first 2 s are washout; rows 200 .. 1975 (1776 per run) for every +task. Tasks: **T0** target X(t) (what the reference code fits, +discrepancy 10), **T1** X(t + 0.01 s) (the paper's "next state"), **T25** +X(t + 0.25 s). One ridge fit per task with three outputs. +- **RC-connected**: 43-node lattice, Lorenz constants, the 42 non-ground + voltages (RC-lin) or those plus their squares (RC-sq, 84 features). +- **RC-disconnected**: the three injection nodes, each with one membrane to + a grounded droplet of its own concentration (5 nodes); 3 or 6 features. + Without coupling the other 40 droplets receive nothing, so this ablation + also has far fewer features; reported as such. +- **BL-linear**: the input X at t, t - 10 ms, .., t - 40 ms (15 features); + **BL-quadratic**: plus all 120 pairwise products (135 features). On T0 the + baselines see the target itself, so they are expected to be near exact: + the reference Lorenz task is a reconstruction of the current input. + +**Reported per model, task and seed:** test NRMSE (per output for Lorenz), +training NRMSE, chosen lambda, CV score, simulator status and run receipt. +Summaries: mean, sample standard deviation, min and max over seeds, and the +paired difference connected minus disconnected and connected minus best +baseline, with the number of seeds where connected wins. No significance +test is claimed with five seeds. + +**Performance (task e).** On an idle machine (quiet flag checked), one +process pinned to one core: per-step latency of `omega_res_step` for the +5-node chain (G2-N1), the 50-node chain and the 43-node lattice, 5 +repetitions of 40,000 timed steps after 10,000 warm-up steps; p50, p95, +p99, max; throughput in steps/s and simulated seconds per wall second; CPU +time over wall time from getrusage; peak resident memory of the process +(ru_maxrss) and the fixed sizes of the simulator structs; host, core, +kernel, compiler, flags and commit. Energy and power: NOT_RUN (not +instrumented). No efficiency claim. + +**AIEN telemetry workload (task d).** Run only if real telemetry with a +time-ordered train/validation/test split exists in the repository or on +this machine; otherwise NOT_RUN with the reason. + +### 10.1 Amendment after the first NARMA benchmark run (post hoc, labeled) + +The declared RC-connected NARMA network (the 50-node chain, 49 driven nodes +at up to 0.1 nA each) is refused by the simulator in every seed, training +and test alike: a node voltage leaves the model's declared range +(|V| <= 1 V, `OMEGA_RES_V_LIMIT`) after about 3.5 ms (step 347 to 359). The +currents of 49 nodes add up along the chain toward its single ground. That +refusal stands as the declared result and is reported as such. + +Added after seeing it, and marked post hoc wherever it is reported: the +same NARMA protocol on the 5-node reference chain (`Length5.mat`, the G2-N1 +network: 4 driven nodes, ground node 5, 13 features) and its disconnected +ablation built the same way (4 driven nodes and 3 grounded droplets). Its +masks are the first four of the 49 drawn for that seed. Nothing else +changes, and no network size or current was searched. The 50-node runs are +kept in the output. + +Update after the voltage guard decision (section 12; the text above is +kept as written): the node-voltage bound named above (`OMEGA_RES_V_LIMIT`) +no longer exists. Under the membrane rule (`OMEGA_RES_VM_LIMIT`) the same +50-node chain is refused later, by the stiffness guard, at step 1,312 to +1,465 (section 11.2). The post hoc 5-node runs stay as declared here. + +## 11. Gate 2 results + +All numbers in this section come from one receipt, +`evidence/RESERVOIR/0043b137712388079be90ab408afc6a7bffc93146a8fbabd530fc01fe2dae9e4.json` +**[measured]**, written by `make qualify-reservoir` on commit +`48c6ed7175909543be6098c1866d179c27c61c1d` (tree `fb52582c`), clean tree +(`tree_dirty` false), unchanged during the run (`tree_stable_during_run` +true), 2026-10-14 16:49:49 to 16:54:30 UTC, host NVIDIA DGX Spark (Linux +7.0.0-1019-nvidia aarch64, 20 cores), gcc 13.3.0, CPU only. That commit +carries the membrane-voltage guard of section 12. The receipt status is +RECORDED: every step ran, the tree was clean and stable, the 22 archive +pins matched, the unit tests passed (681 + 681 simulator checks, 67 + 52 +reader checks, plain and ASan/UBSan; `unit_tests`) and both negative +controls failed as they must. RECORDED says the run is complete and clean; +it is not a PASS of Gate 2 (11.1). Later commits on the branch change only +this document, crumbs and evidence/. + +History. The first Gate 2 receipt, +`evidence/RESERVOIR/6d1c5abbb524ca557989a1dc9a9eae53469892d096ab9ae4ed712e9d1eacedcb.json` +(commit `ac35a166`, 2026-10-14 15:55 to 16:00 UTC, 656 + 656 simulator +checks), ran with the earlier node-voltage bound. It stays in evidence/ +unchanged. Comparing the two receipts field by field, with the per-run +`membranes` objects (new), `config_id`, `run_id`, `final_state_digest`, +the performance section (11.3) and the wall-clock fields (`wall_s`, +`cv.seconds`, `timing.note`) set aside, the only differences are the candidate +commit and tree, the start and finish times, the unit-test counts and log +digest, and the 50-node NARMA chain: its 10 runs and 15 fits changed from +ERR_RANGE to ERR_STIFF and its stop steps moved (11.2). Every verdict and +every other number is identical. The ids and digests differ because the +numeric policy string, which states the guard, is part of the config id +(`src/reservoir/omega_reservoir.c:200`), and the state digest binds the +config id (`omega_reservoir.c:607`). + +### 11.1 Comparison with the archived reference outputs (section 7) + +| Case | Verdict | Numbers | +|---|---|---| +| Archive pins (22 files) | PASS | 22 of 22 sha256 match | +| G2-N1 N1a (v1 features V, u) | **FAIL** | the declared solver refuses the fit at every order (ERR_SINGULAR; smallest pivot ratio of the design -8.9e-16, refusal at or below 1e-13); (a) targets match exactly (max difference 0); QR diagnostic: (b) prediction difference 2.5 % to 25 % of the target std at orders 2 to 10, train and test (bound 1 %), (c) NRMSE within bound at orders 2 to 9, out at order 10 (test 0.661 against 0.624) | +| G2-N1 N1b (v2 features V, V^2, u) against v1 outputs | **FAIL** | the declared solver refuses at every order; the QR diagnostic also finds the design rank deficient | +| G2-N1 N1b-v2 against v2 outputs | **FAIL** | as N1b | +| NC-N (N1a, permittivity x 2.1) | FAIL, as required | not discriminating here: the case it controls fails too | +| G2-L1 13 nodes | **PASS** | prediction difference at most 6e-6 of the target std; test NRMSE x, y, z 0.124515 / 0.243520 / 0.222342 against 0.124516 / 0.243520 / 0.222343 | +| G2-L1 25 nodes | **PASS** | at most 6.5e-5; test NRMSE 0.109878 / 0.155553 / 0.217199 against 0.109889 / 0.155561 / 0.217220 | +| G2-L1 43 nodes | **PASS** | at most 1.04e-4; test NRMSE 0.070690 / 0.182553 / 0.173749 against 0.070683 / 0.182511 / 0.173711 (paper: 0.071, 0.183, 0.174) | +| NC-L (13 nodes, NARMA permittivity) | FAIL, as required | prediction difference 12 % to 19 % of the target std | + +Positive controls pass in every case: each archived NRMSE recomputes from +the archived predictions to 1e-9, and the archived Lorenz Ytrain and Ytest +equal LorenzData1 and LorenzData2. The Lorenz input resampling error is at +most 3.1e-5, 5.9e-5 and 4.8e-5 of the largest current (x, y, z channels), +reported before the comparison as declared. The chosen ridge lambdas are +0.035 (13 and 25 nodes) and 0.033 (43 nodes). + +**Why G2-N1 fails (diagnosis, [archive] and [measured]).** In the archived +NARMA inputs the summed current into the four non-ground nodes is the same +at every knot (2e-10 A, to 1e-25 A). The chain therefore carries almost the +same total current at every moment, and the voltages are close to linear +combinations of one another: node 4's last and first sub-pulse samples +differ by 5.2e-9 V RMS, about one binary32 step at that voltage. The +least-squares problem is then ill conditioned. Perturbing Omega's features +by 1e-6 relative moves the QR predictions by 3 % to 11 % of the target std, +three to eleven times the 1 % tolerance. A binary32 simulator cannot be +expected to reproduce predictions that sensitive, and the declared solver +refuses instead of returning them. This is a finding about the reference +case, not tuned away: the tolerances stay as declared and G2-N1 stays FAIL. +Whether the authors' MATLAB, rerun, reproduces its own archived predictions +to 1 % is not checkable here (BLOCKED, needs MATLAB). + +### 11.2 Benchmarks (section 10), test NRMSE, mean over seeds 1 to 5 + +NARMA (one output; lower is better): + +| Model | NARMA-2 | NARMA-5 | NARMA-10 | +|---|---|---|---| +| RC-connected, 50-node chain (declared) | REFUSED, ERR_STIFF (5 of 5 seeds) | REFUSED | REFUSED | +| RC-disconnected, 50-node ablation | 0.0876 | 0.491 | 0.544 | +| BL-linear (12 delays) | 0.334 | 0.381 | 0.446 | +| BL-quadratic (90 features) | **0.0068** | **0.0189** | **0.299** | +| RC-connected, 5-node chain (post hoc, 10.1) | 0.230 | 0.486 | 0.590 | +| RC-disconnected, 5-node ablation (post hoc) | 0.220 | 0.534 | 0.567 | + +- The declared connected 50-node chain is refused in every seed, training + and test, now by the stiffness guard (ERR_STIFF), at step 1,312 to 1,465 + (13.1 to 14.7 ms of a 6 s training or 3 s test run; + `results.bench-narma.per_seed[*].runs[0..1].stopped_at_step`). The 15 + RC-connected fits are ERR_STIFF with no numbers + (`per_seed[*].fits[0..2]`). The paper's best NARMA configuration is this + network size; the chain sums 49 injected currents toward one ground, and + the reference drive is one-signed (every current in [0, I_hi]). +- Why it is refused **[code]**. Before every step the simulator bounds the + fastest decay rate lambda as the larger of a conductance term + (`lambda_unit * (N_ab + N_ba)`, `src/reservoir/omega_reservoir.c:374-379`) + and a pore-kinetics term (`alpha * Z * e^w`, `omega_reservoir.c:351`), and + refuses with ERR_STIFF when h * lambda > 2 (`omega_reservoir.c:476`, + `OMEGA_RES_STABILITY_LIMIT`). The pore rate is + alpha = rate_scale / (tau0 * e^(dV / v_tau)) (`omega_reservoir.c:347`), + so it grows e-fold for every 45 mV (NARMA v_tau) that the voltage across a + membrane goes negative on that side. +- Which term trips **[measured, diagnostic, not in the receipt]**: a + throwaway build of the same commit with a print at the refusal, run on + seeds 1 to 5, reproduced all ten stop steps of the receipt exactly. In + every case the pore-kinetics term tripped, on the same membrane (edge 47, + droplets 45 and 49 in Omega's zero-based numbering, the side owned by + droplet 49) at a membrane voltage of -0.2202 to -0.2203 V: alpha 1.334e9 to 1.337e9 /s, + times Z = 1.5e-4, gives lambda about 2.0e5 /s, so h * lambda = 2.0004 to + 2.0059. The conductance term was 242 to 469 /s, more than 400 times + smaller. +- Voltages **[measured]** (`runs[*].membranes`): in the 10 refused runs the + largest membrane voltage was 0.2202 to 0.2203 V (below the 0.3 V flag; + inside the 200 to 300 mV band where the paper says rupture can begin) + while node voltages reached 2.85 to 2.96 V. No membrane passed 0.3 V in + any run of the receipt (section 12). +- History: the first receipt refused the same runs at step 316 to 377 + (3.2 to 3.8 ms) with ERR_RANGE, because a node voltage passed the old + 1 V node bound. Its text also cited a diagnostic in which the largest + membrane voltage was about 0.83 V when a node voltage reached 1 V; that + diagnostic is in no receipt, and the receipt measurement above (0.2203 V + membrane at 2.96 V node, stiffness refusal) supersedes it. Whether the + authors' ode15s runs of this chain stay below 0.3 V per membrane cannot + be checked without MATLAB (UNVERIFIED). +- Post hoc 5-node chain: connected beats disconnected in 2 of 5 seeds + (NARMA-2, mean difference +0.010), 5 of 5 (NARMA-5, -0.048) and 1 of 5 + (NARMA-10, +0.023). It never beats the best baseline (0 of 15 seed-task + pairs). No significance test is claimed with five seeds. +- The paper reports connected NARMA-2 test 0.0124 and NARMA-10 0.327 on 50 + nodes with squared states. This benchmark does not reproduce or refute + those numbers: its 50-node connected run is refused, squared states are + NOT_RUN for NARMA (295 features above the readout bound of 256), and its + masks and sampling follow section 10, not the reference code. + +Lorenz63 (mean over x, y, z; connected = 43-node lattice, disconnected = 5 +nodes): + +| Model | T0 (X(t)) | T1 (X(t + 0.01 s)) | T25 (X(t + 0.25 s)) | +|---|---|---|---| +| RC-connected-lin (42 features) | 0.206 (sd 0.147) | 0.181 | 0.953 | +| RC-connected-sq (84) | 0.195 (sd 0.245) | 0.174 | 0.977 | +| RC-disconnected-lin (3) | 0.479 | 0.501 | 0.981 | +| RC-disconnected-sq (6) | 0.259 | 0.290 | 0.911 | +| BL-linear (15) | 1.1e-6 | 1.3e-4 | 0.670 | +| BL-quadratic (135) | **1.2e-7** | **9.0e-7** | **0.475** | + +- Connected-lin beats disconnected-lin in 5 of 5 seeds on T0 and T1 and 4 + of 5 on T25; connected-sq beats disconnected-sq in 4, 4 and 3 of 5. The + disconnected ablation also has far fewer features (section 10), so this + is not a clean measure of coupling alone. +- No reservoir beats the best baseline in any seed or task. On T0 and T1 + the baselines see the input itself, so near-exact baseline scores are + expected (section 10). On T25 the quadratic delay-line baseline is best + (0.475 against 0.911 to 0.981). +- Every failure and null result above is kept in the receipt, seed by seed. + +### 11.3 Performance (task e) + +Quiet flag CLEAR, no GPU job running. One process pinned to CPU 5 (Cortex +X925), gcc 13.3.0 `-O2 -ffp-contract=off -fno-fast-math`, 5 repetitions of +40,000 timed steps after 10,000 warm-up steps; latency of one +`omega_res_step` (one RK4 step of 1e-5 s, including a 22 ns clock read): + +| Network | p50 | p95 | p99 | steps/s | simulated s per wall s | +|---|---|---|---|---|---| +| 5-node chain (G2-N1) | 768 ns | 800 ns | 816 ns | 1.30 M | 13.0 | +| 50-node chain | 10.6 us | 10.7 us | 11.5 us | 94.4 k | 0.94 | +| 43-node lattice (99 membranes) | 14.8 us | 14.9 us | 16.5 us | 67.6 k | 0.68 | + +Percentiles are pooled over the 5 repetitions +(`results.perf.networks[*].pooled`). CPU time over wall time 0.9999 (one +core busy). Peak resident memory of the process 8,528 KiB. History: the +first receipt measured 752 / 784 / 800 ns, 10.9 / 11.0 / 12.1 us and +14.9 / 15.1 / 16.9 us on the same host. The guard change moves the 1 V +check from each node to each membrane (`state_check`, +`src/reservoir/omega_reservoir.c:320-340`); the run-to-run spread of these +figures was not measured, so no speed change is claimed. Fixed struct sizes: config 19,948 B, state +3,632 B, workspace 13,360 B, readout workspace 538,672 B. Energy and power: +NOT_RUN (not instrumented). No efficiency claim is made, and nothing here is +GPU qualification. + +### 11.4 Timing inputs + +The NARMA drive cannot be used for the 50-node timing run: it is refused +after 1,312 to 1,465 steps (11.2; about 350 steps under the first +receipt's node bound), which would end the loop. The two chains are +timed instead with zero-mean pulses of 1 ms on every non-ground node, +uniform in +-0.1 nA divided by the number of driven nodes, drawn from the +benchmark generator (seed 1). These keep the 50-node chain running for the +whole timed loop (`results.perf.networks[1].status` OK in both receipts), +while one-signed pulses of the same size do not (diagnostic run under the +first receipt's node bound, not in any receipt). The 43-node lattice is timed with the reference +Lorenz currents of a trajectory. The simulator is fixed-step RK4 with no +adaptive step or iteration, so the timing input mainly has to stay in +range; any value-dependent cost inside the math library (exp) was not +measured. + +### 11.5 BLOCKED and NOT_RUN + +- BLOCKED: 63 of the 64 archived NARMA grid cells (masks from MATLAB's + random stream, not reimplemented); a state-trace comparison with the + authors' code (the v1 archive holds no state trajectories); whether the + archived outputs came from the archived code (discrepancy 15); rerunning + the authors' MATLAB; the paper's parallel reservoir (S5, a different, + voltage-clamped model, not implemented). +- NOT_RUN: energy and power (not instrumented); RC with squared states on + the 50-node NARMA chain (295 features above the readout bound of 256); + the AIEN telemetry workload (task d). The only telemetry-like data in the + repository are the ARGUS A/B benchmark rounds under `evidence/ARGUS` + (at most about 600 rows of wall times per configuration). They have no + forecasting target and no declared time-ordered train, validation and + test split, so the condition of section 10 is not met. + +### 11.6 Committed fixtures + +`tests/reservoir/fixtures/Length5.mat` (sha256 +`dc6e7914d216a21f664adcd4843e9f705616df47511879ba0bbeceb241b9b50a`, 2,130 +B) and `tests/reservoir/fixtures/Length50.mat` (sha256 +`ff4c9d14abb6f64b1ab9f301072dc67316b7fd59fe61d0b7632ee467a8c2aae3`, 3,324 +B) are unmodified copies of the archived files of the same name (section +1), from Armendarez N., Mohamed A., Hasan M. S., Najem J., Zenodo +10.5281/zenodo.17296788, licensed CC-BY-4.0 (the `LICENSE` inside the +archive says MIT; both permit this with attribution). They let CI test the +`.mat` reader without the archive. No other archive file is committed. + +### 11.7 What the Gate 2 receipt proves, and what it does not + +It proves, for commit `48c6ed71` with gcc 13.3.0 on this host (receipt +`0043b137...`): agreement, under the tolerances declared before the runs, +between Omega's binary32 simulator with its binary64 readout and the +authors' archived outputs for the three Lorenz networks (13, 25 and 43 +nodes; targets, predictions and NRMSE on the archived inputs); that G2-N1 +does not meet the declared criteria, in all three variants, with the +diagnostics above; the benchmark and timing numbers of 11.2 and 11.3; that +under the membrane-voltage guard of section 12 every run that completed +kept every membrane below 0.3 V (0 implausible states in 76 recorded runs; +largest membrane voltage 0.0970 V in a completed run, 0.2203 V in a +refused one); and that the declared 50-node NARMA chain is refused by the +stiffness guard at the declared step in every seed. All verdicts and +numbers of the first receipt (`6d1c5abb...`, commit `ac35a166`) are +reproduced unchanged except the 50-node chain's refusal code and stop step +(11, history). Anyone with the archive can rerun +`make qualify-reservoir RES_ARCHIVE=...` and compare. + +It does not prove: anything about real droplets or devices; agreement on +the BLOCKED cases or with the authors' code beyond its archived outputs; +that a reservoir beats a conventional baseline (it does not, in any seed +or task here); that the 50-node chain would run at a smaller step, or what +the authors' ode15s does on it; that 0.3 V is the right plausibility line +for real membranes (it is the upper end of the paper's 200 to 300 mV +rupture range); GPU qualification of any kind; energy, power or +efficiency; production readiness. + +## 12. Voltage guard decision + +Decided by the orchestrator on 2026-10-14, under Drake's standing +delegation, after the first Gate 2 run (receipt `6d1c5abb...`, section 11 +history). Recorded as section 9, item 3. Implemented in commits `cc6db6cd` +and `48c6ed71`; header comment in `src/reservoir/omega_reservoir.h`. + +**Rule.** + +- Refused (ERR_RANGE): any membrane voltage |V_a - V_b| > 1 V + (`OMEGA_RES_VM_LIMIT`), checked on every state (`state_check`, + `src/reservoir/omega_reservoir.c:320-340`). +- Flagged, recorded, never refused: any membrane voltage above 0.3 V + (`OMEGA_RES_VM_PLAUSIBLE`). Every bench and Gate 2 run records a + `membranes` object: `states_observed`, `states_implausible` (states with + at least one membrane above 0.3 V), `membranes_implausible`, + `max_membrane_abs_v` and `max_node_abs_v`. +- Node voltages: finite only, no bound. Ground nodes stay exactly 0. +- Everything else is unchanged: the stiffness guard (h * lambda <= 2), ln N + bounds, current bound, finiteness and the declared step. + +**Reasoning.** + +1. Node voltages are measured against the one common ground. Along a chain + they add up membrane by membrane, so a long chain can carry node + voltages of several volts while each membrane sees a fraction of a volt. + A bound on the node voltage therefore depends on chain length, not on + anything a membrane experiences. +2. The pore kinetics in the model see only the voltage across their own + membrane (dV_ab = V_a - V_b in alpha and Nss, header comment). That is + the physically meaningful quantity to guard. +3. 1 V is a numerical guard that catches blowups; it is not a physical + limit. It sits far above the 200 to 300 mV the paper gives for rupture + (point 4), so a membrane that reaches it means the numbers have run away. +4. The paper (main text) says the current-driven mode "minimizes the risk + of electroporation or membrane rupture, which can occur when voltages + exceed ∼200 to 300 mV". A membrane above 0.3 V is therefore outside what + the authors consider physical, so it is flagged. It is recorded instead + of refused: the model has no rupture term (section 3.1), and recording + shows where a run leaves the physical range instead of hiding it. + +**Tests.** `test_membrane_guard` (`tests/reservoir/test_reservoir.c`): a +30-node chain whose membranes neither conduct nor adapt, 10 nA into node 0. +The run must continue past a node voltage of 1 V (where the old guard +refused), flag every membrane once it passes 0.3 V, and refuse only when a +membrane passes 1 V. `make test-reservoir` runs it, plain and with +ASan/UBSan (681 checks each in the receipt's `unit_tests`). + +**Effect on Gate 2 [measured], receipt `0043b137...`.** + +- 76 runs record membrane statistics (16 Gate 2 runs, 20 Lorenz and 40 + NARMA benchmark runs). Across all of them `states_implausible` and + `membranes_implausible` are 0: no membrane passed 0.3 V in any state. +- The 66 completed runs: largest membrane voltage 0.0970 V + (`results.g2-lorenz-13-NC-L.runs[1].membranes.max_membrane_abs_v`), + largest node voltage 0.349 V + (`results.g2-lorenz-43.runs[0].membranes.max_node_abs_v`). +- The 10 refused runs (50-node NARMA chain, 5 seeds, train and test): + largest membrane voltage 0.2202 to 0.2203 V, node voltages up to 2.85 to + 2.96 V, refused by the stiffness guard at step 1,312 to 1,465, where the + old node bound refused them at step 316 to 377 (11.2). +- No verdict changed. Every other number is identical to the first receipt + (11, history). diff --git a/docs/reservoir/gate2_config.json b/docs/reservoir/gate2_config.json new file mode 100644 index 000000000..7736f0c5d --- /dev/null +++ b/docs/reservoir/gate2_config.json @@ -0,0 +1,15 @@ +{ + "schema": "omega-reservoir-gate2-config/1", + "doc": "docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1, 10, 10.1, 12", + "reference_record": "10.5281/zenodo.17296788", + "reference_zip_sha256": "54582293dff8e9327b9187d3e5526b0e0cdcc41ca7ac87c762850bdb342dea15", + "simulator": {"step_s": 9.99999975e-06, "steps_per_knot": 10, "numeric_policy": "omega.reservoir.numeric.v2: binary32 RNE no-FTZ; ffp-contract=off; omega_math_exp/log/div/sqrt; state y=lnN; rk4 fixed step, TwoSum-compensated update; 1-e^w Taylor9 |w|<=0.5; dense Cholesky of reduced Laplacian; refuse |Va-Vb|>1 V per membrane, node V finite only", "refused_membrane_abs_v_above": 1, "implausible_membrane_abs_v_above": 0.300000012, "node_voltage_bound": "finite only"}, + "g2_narma": {"grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2}, "variants": ["N1a", "N1b", "N1b-v2"], "v2_results_sha256": "317af7a76051e6c30aa0476a612c29e417b199c9ef226f4f00d7f7505512fc92", "negative_control": "NC-N", "fit_rows_1based": [100, 995], "orders": [2, 10]}, + "g2_lorenz": {"nodes": [13, 25, 43], "negative_control": "NC-L (13 nodes)", "knots": 400001, "lambda_grid": "linspace(0.033, 0.035, 101)", "folds": 5}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "benchmark": {"seeds": [1, 2, 3, 4, 5], "generator": "splitmix64", "lambda_grid": [1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1, 10, 100], "folds": 5, + "narma": {"orders": [2, 5, 10], "train": 2000, "test": 1000, "washout": 100, "mask_length": 3, "current_hi_a": 1e-10, "networks": ["Length50 chain (declared)", "Length5 chain (post hoc, section 10.1)"], "delay_line": 12}, + "lorenz": {"dt": 1e-4, "transient_s": 20, "record_s": 20, "sample_s": 0.01, "washout_samples": 200, "rows": [200, 1975], "horizons_samples": [0, 1, 25], "network": "hex43", "delay_line": 5}}, + "performance": {"warmup_steps": 10000, "timed_steps": 40000, "repetitions": 5, "networks": ["chain5 NARMA", "chain50 NARMA", "hex43 Lorenz"]}, + "energy": "NOT_RUN (not instrumented)" +} diff --git a/evidence/RESERVOIR/0043b137712388079be90ab408afc6a7bffc93146a8fbabd530fc01fe2dae9e4.json b/evidence/RESERVOIR/0043b137712388079be90ab408afc6a7bffc93146a8fbabd530fc01fe2dae9e4.json new file mode 100644 index 000000000..c4f84a3eb --- /dev/null +++ b/evidence/RESERVOIR/0043b137712388079be90ab408afc6a7bffc93146a8fbabd530fc01fe2dae9e4.json @@ -0,0 +1,519 @@ +{ + "schema": "omega-reservoir-qualification/1", + "issue": "aien-spark/omega#440, Gate 2", + "doc": "docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1, 8, 10, 10.1", + "config": "docs/reservoir/gate2_config.json (test-reservoir checks the tool still emits it)", + "started_utc": "2026-10-14T16:49:49Z", + "finished_utc": "2026-10-14T16:54:30Z", + "candidate_commit": "48c6ed7175909543be6098c1866d179c27c61c1d", + "candidate_tree": "fb52582c4b900bd29a06cef5d2eded35b53c7071", + "tree_dirty": false, + "tree_stable_during_run": true, + "host": {"uname": "Linux 7.0.0-1019-nvidia aarch64", "nproc": 20, "product_name": "NVIDIA_DGX_Spark"}, + "compiler": "cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0", + "unit_tests": "test_reservoir: 681 checks, 0 failed;test_reservoir: 681 checks, 0 failed;test_res_mat: 67 checks, 0 failed;test_res_mat: 52 checks, 0 failed;", + "unit_tests_log_sha256": "680ed83ea382658da6687ad8c9f05b13e3a0fd25625f1a9a99774485b8a95ec4", + "archive": {"record": "10.5281/zenodo.17296788", "license": "CC-BY-4.0", "pins": "results.pins", "v2_results_file_given": true}, + "quiet_flag": "quiet flag: CLEAR; forge: not running queue: 0 job(s)", + "timing": {"state": "RUN", "note": "load average before: 4.42 2.77 2.01"}, + "hardware_scope": "CPU only; no GPU opened, no silicon, no energy or power measurement", + "summary": {"pins": "PASS", "g2-narma-N1a": "FAIL", "g2-narma-N1b": "FAIL", "g2-narma-N1b-v2": "FAIL", "g2-narma-NC-N": "FAIL", "g2-lorenz-13": "PASS", "g2-lorenz-25": "PASS", "g2-lorenz-43": "PASS", "g2-lorenz-13-NC-L": "FAIL", "bench-narma": "RAN", "bench-lorenz": "RAN", "perf": "RAN"}, + "blocked": [ + "63 of the 64 archived NARMA grid cells: their input masks come from MATLAB's rng/randi stream, which is not reimplemented (no MATLAB or Octave here)", + "state-trace comparison against the authors' code: the version 1 archive holds no state trajectories", + "whether the archived outputs came from the archived code (discrepancy 15): needs MATLAB", + "the paper's parallel reservoir (S5): a different, voltage-clamped model, not implemented" + ], + "not_run": [ + "energy and power: not instrumented, no efficiency claim", + "AIEN telemetry workload: no real telemetry with a time-ordered train/validation/test split exists (section 11)", + "RC with squared states on the 50-node NARMA chain: 295 features, above the readout bound of 256" + ], + "proves": [ + "For the cases whose verdict is PASS: numerical agreement, under the tolerances declared before the runs, between Omega's binary32 simulator with its binary64 readout and the outputs the authors archived from their MATLAB code (targets, predictions and NRMSE), on the archived inputs.", + "For the cases whose verdict is FAIL: that Omega does not meet the declared criteria there, with the diagnostics recorded in the case.", + "The benchmark and timing numbers below, for this commit, compiler and host." + ], + "does_not_prove": [ + "physical validity of the droplet model, or anything about real droplets or devices", + "agreement on the BLOCKED cases, or with the authors' code beyond its archived outputs", + "GPU qualification of any kind (CPU only)", + "energy, power or efficiency (NOT_RUN)", + "production readiness" + ], + "status": "RECORDED", + "status_reasons": [], + "results": { + "pins": { + "schema": "omega-reservoir-pins/1", + "record": "10.5281/zenodo.17296788", + "files": [ + {"key": "code.narma_connected", "path": "src/Codes for Zenodo/NARMA Final Code/Connected Reservoir/HyperParameterTuningOptimized.m", "sha256": "620640f002068048ab2c56f5090dc945e7b81595a9bc7f863331659a1850ceb5", "match": true}, + {"key": "code.narma_parallel", "path": "src/Codes for Zenodo/NARMA Final Code/Parallel Reservoir/ParallelReservoirNARMA.m", "sha256": "f120f9150db590e3fcf767cbd1840e0924f513b45d44cf8439be2229be0fb507", "match": true}, + {"key": "code.lorenz43", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression.m", "sha256": "d291460fffe4efc1b2f013060c04e3a561dcd571de813a9c95277557daafdcac", "match": true}, + {"key": "code.lorenz13", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression13Nodes.m", "sha256": "c9e2ad2b64832c50c95f9d61e86161496aef40640cc547d1d5ae3a9323eedbf1", "match": true}, + {"key": "code.lorenz25", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression25Nodes.m", "sha256": "c1b31403cc9a2014c2f3b65056873306ed52174142259b5127b30c803927dece", "match": true}, + {"key": "code.lorenz_gen", "path": "src/Codes for Zenodo/Lorenz Final Code/LorenzDataGenerator.m", "sha256": "7295d55fa3e1209b74b4804f9de18f4952950020f32d0f318695286c5ccdfa1d", "match": true}, + {"key": "narma.length5", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length5.mat", "sha256": "dc6e7914d216a21f664adcd4843e9f705616df47511879ba0bbeceb241b9b50a", "match": true}, + {"key": "narma.length10", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length10.mat", "sha256": "ceca1f6e94f3239b2df072403a488f8929fe00673b5028319cd2094d6eae708e", "match": true}, + {"key": "narma.length20", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length20.mat", "sha256": "aeb87fcec7655ce72386fdc28f2878b1f7b89097db523ab9fe5812fb6c4d1ee6", "match": true}, + {"key": "narma.length50", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length50.mat", "sha256": "ff4c9d14abb6f64b1ab9f301072dc67316b7fd59fe61d0b7632ee467a8c2aae3", "match": true}, + {"key": "narma.train_signal", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/trainSignal.mat", "sha256": "48e8e2c775fda4ca85dfc14a3c202319d9c75e2d7db0baf237744ce51a4b02c1", "match": true}, + {"key": "narma.test_signal", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/testSignal.mat", "sha256": "f0e34c5733e2cc20852caf4874b92bcb19fcb95bd4da4ce0eb7f4919cabee8c1", "match": true}, + {"key": "narma.results", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/HyperParameterOptimizationVariablesToPlot.mat", "sha256": "6311b719d47bfa92b76e1c71b3e9fe0e2e30d564d9ee7c7b2f231a03683e66fd", "match": true}, + {"key": "narma.parallel_results", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Parallel Reservoir/ParallelReservoirDataToPlot.mat", "sha256": "ccf13dd5045a50ce5e474915225f4961d6e56b949985ef701bffe3316822f1c6", "match": true}, + {"key": "lorenz.data1", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzData1.mat", "sha256": "6229d996681ef7e64336ef4f04e7bd82c0a8063e6e18e52667c699251091f6c4", "match": true}, + {"key": "lorenz.data2", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzData2.mat", "sha256": "d1c0dcccbee809e8880dd5b0e355dd456ab1605d0470dbfa99e1a54b2b51073a", "match": true}, + {"key": "lorenz.fig43", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data.mat", "sha256": "f6055bc6b79cc686a5c7cca703fdf2e35de50e202e245bfe07f10f91ecad3500", "match": true}, + {"key": "lorenz.fig25", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data25Nodes.mat", "sha256": "0d85b0eaef9c6bb4eed07a3fe8f395802afbde0c3a75403ba216b55220754205", "match": true}, + {"key": "lorenz.fig13", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data13Nodes.mat", "sha256": "74988e19bd24540b0f623e20295a2813a0206917cdf6072d0dfaf69f8d091ed7", "match": true}, + {"key": "lorenz.nrmse43", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs.mat", "sha256": "514ba3082a21eb541e0af8a9fbb80596742f9ddafee466391a00842a5d4e5616", "match": true}, + {"key": "lorenz.nrmse25", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs25Nodes.mat", "sha256": "881e92a0a5cd6b46fb588b41593e83d66ec2af25d16fb7198444fc82c3aaf14d", "match": true}, + {"key": "lorenz.nrmse13", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs13Nodes.mat", "sha256": "5f2d18b150d5baa9e792aa967d46a541a6031ff2805467ba30b72db745d55733", "match": true} + ], + "verdict": "PASS" +}, + "g2-narma-N1a": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1a", + "negative_control": false, + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v1 code: [V, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "ae6afde7263cec2d694df305e655d5fe2e52eeaa637ef7907dc1565bd5dd7f02", "steps": 199990, "run_id": "5caaf0f46136eefd847b5be57c4487bca91f98702e65b2ab0c406f00b0511727", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286993057}}, {"split": "test", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "2b9756280b71166f7d47244e1eb9dd0af75f0efc6a0e9d8c8d9256e84a6e9a04", "steps": 199990, "run_id": "409a253e460e4a2c3299e08f755ed21b34e4e47d042c55e633c1f1ef94185ca4", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286739916}}], + "fit": {"rows_1based": [100, 995], "columns": 11, "columns_dropped_zero": [8, 9], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -8.8667496889673835e-16, "design_min_pivot_column": 7, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.030174555999207979, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.071346038631669509, "nrmse_omega": 0.4082975651409958, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.071784948216767799, "nrmse_omega": 0.42492037102690028, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.038525432403273829, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.051827716707148926, "nrmse_omega": 0.41925059946868493, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.049957996811968858, "nrmse_omega": 0.44896335034236551, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.036255734808217963, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.042167597063641031, "nrmse_omega": 0.52179708340611675, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.041124287527688236, "nrmse_omega": 0.54448359858024742, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.05155978646047811, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.024754818289879313, "nrmse_omega": 0.58528169707318778, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.026049478131157912, "nrmse_omega": 0.61335136701843285, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.06682024537974797, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.087043109748080966, "nrmse_omega": 0.58289724560327549, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.090663197305839771, "nrmse_omega": 0.61970852051926328, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.081309422699841927, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.065795068820320893, "nrmse_omega": 0.5924142848736822, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.067974795407398883, "nrmse_omega": 0.62238614296524197, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.10632941842243072, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.10101926996753294, "nrmse_omega": 0.56017304993449479, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.10206369958217575, "nrmse_omega": 0.6089475787987042, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.097865405108893661, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.16807750158058452, "nrmse_omega": 0.5512816316469642, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.18030826923098939, "nrmse_omega": 0.62470372806358299, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.088851880564151511, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.25523167323793849, "nrmse_omega": 0.64169783288868254, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.23703687327531672, "nrmse_omega": 0.66073063881370431, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-N1b": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1b", + "negative_control": false, + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v2 code: [V, V^2, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "ae6afde7263cec2d694df305e655d5fe2e52eeaa637ef7907dc1565bd5dd7f02", "steps": 199990, "run_id": "5caaf0f46136eefd847b5be57c4487bca91f98702e65b2ab0c406f00b0511727", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286993057}}, {"split": "test", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "2b9756280b71166f7d47244e1eb9dd0af75f0efc6a0e9d8c8d9256e84a6e9a04", "steps": 199990, "run_id": "409a253e460e4a2c3299e08f755ed21b34e4e47d042c55e633c1f1ef94185ca4", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286739916}}], + "fit": {"rows_1based": [100, 995], "columns": 21, "columns_dropped_zero": [8, 9, 18, 19], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.081112764943575652, 0.081091531814583728, 0.041298763507715754, 0.041287270502294228, 0.018902550748144085, 0.018900125044228985, 0.0078747786141906313, 0.0078747785772953077, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -1.0391237175191562e-14, "design_min_pivot_column": 15, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-N1b-v2": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1b-v2", + "negative_control": false, + "reference_results": "Zenodo record 20277956 (version 2), sha256 317af7a7...fc92", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v2 code: [V, V^2, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "ae6afde7263cec2d694df305e655d5fe2e52eeaa637ef7907dc1565bd5dd7f02", "steps": 199990, "run_id": "5caaf0f46136eefd847b5be57c4487bca91f98702e65b2ab0c406f00b0511727", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286993057}}, {"split": "test", "status": "OK", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "2b9756280b71166f7d47244e1eb9dd0af75f0efc6a0e9d8c8d9256e84a6e9a04", "steps": 199990, "run_id": "409a253e460e4a2c3299e08f755ed21b34e4e47d042c55e633c1f1ef94185ca4", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925771073, "max_node_abs_v": 0.286739916}}], + "fit": {"rows_1based": [100, 995], "columns": 21, "columns_dropped_zero": [8, 9, 18, 19], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.081112764943575652, 0.081091531814583728, 0.041298763507715754, 0.041287270502294228, 0.018902550748144085, 0.018900125044228985, 0.0078747786141906313, 0.0078747785772953077, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -1.0391237175191562e-14, "design_min_pivot_column": 15, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.34212972603646297, "nrmse_recomputed_from_archived_predictions": 0.34212972603646297, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.35672232160044881, "nrmse_recomputed_from_archived_predictions": 0.35672232160044881, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.3757432778088296, "nrmse_recomputed_from_archived_predictions": 0.37574327780882932, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42209287432529125, "nrmse_recomputed_from_archived_predictions": 0.42209287432529158, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.4898052426855502, "nrmse_recomputed_from_archived_predictions": 0.48980524268555009, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52904832026137327, "nrmse_recomputed_from_archived_predictions": 0.52904832026137205, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56521559154562295, "nrmse_recomputed_from_archived_predictions": 0.56521559154562295, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59545570968467709, "nrmse_recomputed_from_archived_predictions": 0.59545570968467743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56440810632257798, "nrmse_recomputed_from_archived_predictions": 0.56440810632257832, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.60784256781680046, "nrmse_recomputed_from_archived_predictions": 0.60784256781679991, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57175555791374966, "nrmse_recomputed_from_archived_predictions": 0.57175555791374977, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.60472348077546945, "nrmse_recomputed_from_archived_predictions": 0.604723480775469, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.53927320240957921, "nrmse_recomputed_from_archived_predictions": 0.53927320240957888, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58301429749824274, "nrmse_recomputed_from_archived_predictions": 0.58301429749824274, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.50599927037023351, "nrmse_recomputed_from_archived_predictions": 0.50599927037023351, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58068897454997703, "nrmse_recomputed_from_archived_predictions": 0.58068897454997714, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56507547934173019, "nrmse_recomputed_from_archived_predictions": 0.56507547934172986, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59844584988444183, "nrmse_recomputed_from_archived_predictions": 0.59844584988444205, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-NC-N": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "NC-N", + "negative_control": "NC-N: permittivity x 2.1", + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v1 code: [V, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849981e-11, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "3e1fe6efc6c60c5dbd0b304ae8430bf69b7209dc5a11c1dde142c975a95acfa9", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "9ebde887c78db4584bc184b397f09bcbbea67bda6b7376234a09b0e31687eb88", "steps": 199990, "run_id": "06ff0a8268678e5e8ac974c8d207acb77e30e8a81e6a567d9d739e2120b03b5f", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0895529836, "max_node_abs_v": 0.285738677}}, {"split": "test", "status": "OK", "config_id": "3e1fe6efc6c60c5dbd0b304ae8430bf69b7209dc5a11c1dde142c975a95acfa9", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "3cbcbc5038ccfe97632c14520a40074382fd5162dc4637b9822b273c7e653d4b", "steps": 199990, "run_id": "f7f6778123ea0e08fae3e06ca853d41146aca7a0f7c3d0b29c11bd946bd75ab2", "membranes": {"states_observed": 199990, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0895529836, "max_node_abs_v": 0.285686731}}], + "fit": {"rows_1based": [100, 995], "columns": 11, "columns_dropped_zero": [8, 9], "column_rms": [0.28281174055156366, 0.28281628353587512, 0.20321131619574898, 0.2031993686267953, 0.13748398253100727, 0.13748004230220626, 0.088739949602833337, 0.088739949569571847, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.00048185509923250356, 0.00036146317985545742, 0.00012208597049850114, 4.9656676411952087e-09, 0], "design_min_pivot_ratio": -3.1871632754762049e-14, "design_min_pivot_column": 8, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.084845965527646491, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.20261555724970445, "nrmse_omega": 0.44427054500744495, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.2094245280755711, "nrmse_omega": 0.45957384020604236, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.11275711362119771, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.24540970591917818, "nrmse_omega": 0.48467306371343988, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.25460120302443673, "nrmse_omega": 0.50366793096569729, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.12110175711311548, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.095145994722034402, "nrmse_omega": 0.5306698980292166, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.09828480635245225, "nrmse_omega": 0.55275124169490342, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.10987273261837525, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.18148727438457207, "nrmse_omega": 0.60246693498758164, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.19557634394626272, "nrmse_omega": 0.63540827557145518, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.065472347681373111, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.22537006473461652, "nrmse_omega": 0.62071755238249637, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.24524557186480686, "nrmse_omega": 0.65091005909839439, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.041725744247601552, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.2439653985447367, "nrmse_omega": 0.64486132067003721, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.26521026152733379, "nrmse_omega": 0.6660196646252774, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.069868249721240297, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.31952374474680378, "nrmse_omega": 0.64161014441869479, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.34833599298599766, "nrmse_omega": 0.6906271050794609, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.066452291904202418, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.40564177070692542, "nrmse_omega": 0.65471659030697049, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.46454356173580913, "nrmse_omega": 0.72790893337788842, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.086202916907868674, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.43962884930717694, "nrmse_omega": 0.69874579179209939, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.44256020018194447, "nrmse_omega": 0.73476950955129439, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-lorenz-13": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 13, + "negative_control": false, + "topology": {"edges": 21, "ground_1based": 8, "inputs_1based": [1, 2, 13]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "50a0aab926aea0a1c7d6e18737272c76b2d8e7c0c52668967414c85eae92c75c", "input_digest": "56ceab99932cf31553c5381f02b176e49d9f9117692df992a3fcdf628702ae1b", "final_state_digest": "f73eb7813ef2935c808f0e180c8ebd9e94c9f9e8e7e1186426bd662fb0d06af9", "steps": 4000000, "run_id": "90ae196ec0881b93e01a0d5ad8b02e489dec3d3c920e4a867be860a26c23550e", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0970164388, "max_node_abs_v": 0.230999216}}, {"split": "test", "status": "OK", "config_id": "50a0aab926aea0a1c7d6e18737272c76b2d8e7c0c52668967414c85eae92c75c", "input_digest": "e9664d749d060949b6497344dee741b0a62abf1ca2170f6c4b5a4c40456d77c3", "final_state_digest": "3e2b2295deafa3daedebe2afcdfe12b81b3c0d9b6dc9853731ba8b0ce53da4a7", "steps": 4000000, "run_id": "7a7f323cbe929b3949199ab3bcdb33a0ae8681512c17e37c8388190a317c8ea9", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0970202535, "max_node_abs_v": 0.231000483}}], + "samples": [41799, 41434], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 1.0290338464308093, "refusals": 0, "seconds": 3.7}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.6779309256045213e-06, "nrmse_omega": 0.13185194128456668, "nrmse_reference": 0.13185188493046004, "nrmse_recomputed_from_archived_predictions": 0.13185188493045941, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 4.2563349548968077e-06, "nrmse_omega": 0.24421182079648276, "nrmse_reference": 0.24421216352562414, "nrmse_recomputed_from_archived_predictions": 0.24421216352562475, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.5528228282458204e-06, "nrmse_omega": 0.21755626207884349, "nrmse_reference": 0.21755696193907598, "nrmse_recomputed_from_archived_predictions": 0.2175569619390742, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.2282301031963498e-06, "nrmse_omega": 0.12451546821376215, "nrmse_reference": 0.12451570849444508, "nrmse_recomputed_from_archived_predictions": 0.12451570849444567, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 3.6529499212198346e-06, "nrmse_omega": 0.24351984109964653, "nrmse_reference": 0.2435199240683032, "nrmse_recomputed_from_archived_predictions": 0.24351992406830161, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 5.701730130867187e-06, "nrmse_omega": 0.22234237321907535, "nrmse_reference": 0.22234320116133482, "nrmse_recomputed_from_archived_predictions": 0.22234320116133552, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-25": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 25, + "negative_control": false, + "topology": {"edges": 51, "ground_1based": 14, "inputs_1based": [1, 2, 25]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "4d3bb731d1119ec85c56a4e22934878a1c9747346a5b7b77d0adb21066a3b2c7", "input_digest": "0626a8e2353fb5c85f591c8701ea501e06a9675bed6093cfe83935a4f82d91b3", "final_state_digest": "cf654b45f225ec48d03a8bc64fad07d7ecd849c4454d1fe93c9deb91057315f8", "steps": 4000000, "run_id": "0c08188a36a283519e942fbe37ed7b6c178cd331661f6934127b20bdd408da32", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0970164388, "max_node_abs_v": 0.306310296}}, {"split": "test", "status": "OK", "config_id": "4d3bb731d1119ec85c56a4e22934878a1c9747346a5b7b77d0adb21066a3b2c7", "input_digest": "feac7c9a4ec4f7a1681b71f3cbfee5f228c755cf0a2f2bfc0409eb77fd984036", "final_state_digest": "a168fdf58fc73da320d06d34b3328538d6107d0db4ed6136367c291c7e76e932", "steps": 4000000, "run_id": "277a97bb690697f248e245b4e2c038e308102a04b64530c08400ea1e449073fc", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0970202684, "max_node_abs_v": 0.306301206}}], + "samples": [41429, 43731], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 0.95152074743029957, "refusals": 0, "seconds": 12.1}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 9.0074195953873765e-06, "nrmse_omega": 0.085635033274452349, "nrmse_reference": 0.085635683608415267, "nrmse_recomputed_from_archived_predictions": 0.085635683608415017, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 9.4589079201945077e-06, "nrmse_omega": 0.15043380279448682, "nrmse_reference": 0.15043304740276905, "nrmse_recomputed_from_archived_predictions": 0.15043304740277, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 1.9804336161404809e-05, "nrmse_omega": 0.15168698197286534, "nrmse_reference": 0.15168866751085383, "nrmse_recomputed_from_archived_predictions": 0.15168866751085305, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.3507964841728149e-05, "nrmse_omega": 0.10987833389798819, "nrmse_reference": 0.10988946925009918, "nrmse_recomputed_from_archived_predictions": 0.10988946925009958, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 2.6761405747597162e-05, "nrmse_omega": 0.15555292799502499, "nrmse_reference": 0.15556076931299914, "nrmse_recomputed_from_archived_predictions": 0.15556076931299923, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.4520544070537604e-05, "nrmse_omega": 0.21719916026970959, "nrmse_reference": 0.21722040738225198, "nrmse_recomputed_from_archived_predictions": 0.21722040738225179, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-43": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 43, + "negative_control": false, + "topology": {"edges": 99, "ground_1based": 21, "inputs_1based": [1, 28, 42]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "input_digest": "4c80c2b37b490da376d2494126297fc23ff6bdb23b9d44182812914f06996943", "final_state_digest": "b05015e7385531e2ac11ae6b446018cd3716b5cf6e58cf4717b1fe16901f8fcd", "steps": 4000000, "run_id": "ed8f4eb904c5fc215bca267178dffb5f91fc058786a061815f977e523fbdd8d7", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0921558887, "max_node_abs_v": 0.349272788}}, {"split": "test", "status": "OK", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "input_digest": "fd817fb566f9950714119654dca44041775baef3010a2924cd791e8624cc4120", "final_state_digest": "2201740a09b61ece757b275d01ef1c92c0732a908c7551ac29ce433c72f23e5b", "steps": 4000000, "run_id": "cee910a0a0f3e9d4106cc94a77f41ff0a254fe83295662d21007036afd0adc19", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0921575278, "max_node_abs_v": 0.347412318}}], + "samples": [55134, 55425], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.033000000000000002, "chosen_index": 0, "score": 0.76982002885655965, "refusals": 0, "seconds": 46.2}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 4.2906126913349232e-06, "nrmse_omega": 0.060711015436529334, "nrmse_reference": 0.060711004947326001, "nrmse_recomputed_from_archived_predictions": 0.060711004947326348, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 6.5843153532022146e-06, "nrmse_omega": 0.16688965541390674, "nrmse_reference": 0.16689036807691424, "nrmse_recomputed_from_archived_predictions": 0.16689036807691518, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.626529506618745e-06, "nrmse_omega": 0.1326272643692232, "nrmse_reference": 0.13262828337949442, "nrmse_recomputed_from_archived_predictions": 0.1326282833794947, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.8084805637807107e-05, "nrmse_omega": 0.070689752903937267, "nrmse_reference": 0.070683443536471213, "nrmse_recomputed_from_archived_predictions": 0.070683443536470714, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 8.3088264898468952e-05, "nrmse_omega": 0.18255285554463949, "nrmse_reference": 0.18251104749892025, "nrmse_recomputed_from_archived_predictions": 0.18251104749891892, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.00010444957468807544, "nrmse_omega": 0.17374919900989022, "nrmse_reference": 0.17371107404319705, "nrmse_recomputed_from_archived_predictions": 0.17371107404319949, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-13-NC-L": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 13, + "negative_control": "NC-L: NARMA permittivity 8.85e-12", + "topology": {"edges": 21, "ground_1based": 8, "inputs_1based": [1, 2, 13]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "27001aa2cec29231420d1ec45abd82db58a114d6e4e3da4cfedf06fe2295d694", "input_digest": "56ceab99932cf31553c5381f02b176e49d9f9117692df992a3fcdf628702ae1b", "final_state_digest": "014907ab01bacccba6cfa458fa1b967aaed46d5ab78c49ca18fd69982dafe808", "steps": 4000000, "run_id": "ef3fd751894599192663591906d01f9cb4d4492ced5e0abeaf106f76a97fbd56", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.09704265, "max_node_abs_v": 0.231112733}}, {"split": "test", "status": "OK", "config_id": "27001aa2cec29231420d1ec45abd82db58a114d6e4e3da4cfedf06fe2295d694", "input_digest": "e9664d749d060949b6497344dee741b0a62abf1ca2170f6c4b5a4c40456d77c3", "final_state_digest": "2e4d7f9acdfd65c88616d74cd550a5ef48d3546bd8957edfdea0df7f190e7c0b", "steps": 4000000, "run_id": "be0ac4c7f984b866eb4ccd94a8c5dfb75d6e931115907517753b24f79d088bef", "membranes": {"states_observed": 4000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0970466435, "max_node_abs_v": 0.23111704}}], + "samples": [41799, 41434], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 0.96820228660346452, "refusals": 0, "seconds": 3.5}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 0.12334698699418173, "nrmse_omega": 0.18105136362146079, "nrmse_reference": 0.13185188493046004, "nrmse_recomputed_from_archived_predictions": 0.13185188493045941, "b": false, "c": false, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 0.18891360251047917, "nrmse_omega": 0.24438168281512779, "nrmse_reference": 0.24421216352562414, "nrmse_recomputed_from_archived_predictions": 0.24421216352562475, "b": false, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.14232176254261994, "nrmse_omega": 0.24041001761529973, "nrmse_reference": 0.21755696193907598, "nrmse_recomputed_from_archived_predictions": 0.2175569619390742, "b": false, "c": false, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 0.12173830815045711, "nrmse_omega": 0.16663976581646051, "nrmse_reference": 0.12451570849444508, "nrmse_recomputed_from_archived_predictions": 0.12451570849444567, "b": false, "c": false, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 0.19346650673670593, "nrmse_omega": 0.23764160623801833, "nrmse_reference": 0.2435199240683032, "nrmse_recomputed_from_archived_predictions": 0.24351992406830161, "b": false, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.13767034003122394, "nrmse_omega": 0.24403675855931492, "nrmse_reference": 0.22234320116133482, "nrmse_recomputed_from_archived_predictions": 0.22234320116133552, "b": false, "c": false, "metric_control": true}]} + ], + "verdict": "FAIL" +}, + "bench-narma": { + "schema": "omega-reservoir-bench-narma/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "seeds": [1, 2, 3, 4, 5], + "setup": {"train_inputs": 2000, "test_inputs": 1000, "washout": 100, "subpulses": 3, "subpulse_s": 1e-3, "current_hi_a": 1e-10, "delay_line": 12, "lambda_grid": [1e-6, 1e2, 9], "folds": 5, + "networks": [{"name": "Length50 chain (declared)", "driven_nodes": 49, "nodes_connected": 50, "nodes_disconnected": 58}, {"name": "Length5 chain (post hoc, section 10.1)", "driven_nodes": 4, "nodes_connected": 5, "nodes_disconnected": 7}], + "rc_squared_states": "NOT_RUN (50-node chain: 295 features > readout bound 256)"}, + "wall_s": 13.4, + "per_seed": [ + {"seed": 1, "runs": [{"run": "chain50 connected/train", "status": "ERR_STIFF", "stopped_at_step": 1454, "membranes": {"states_observed": 1454, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.22021541, "max_node_abs_v": 2.91035628}}, {"run": "chain50 connected/test", "status": "ERR_STIFF", "stopped_at_step": 1441, "membranes": {"states_observed": 1441, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220221505, "max_node_abs_v": 2.90495324}}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "e393dbac1be596bcf64fa64359d9c1ba8687419169b3f674cc7c134912894d5f", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0832455084, "max_node_abs_v": 0.0832455084}}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "a2aa8b2063770fbdffff759807c21d8124525084ed2003ee4022bdaeb3fd36c4", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831941962, "max_node_abs_v": 0.0831941962}}, {"run": "chain5 connected/train", "status": "OK", "run_id": "7cd3b9391e52da195b11645b9ee2a198bc5158a7e1c0091215a00514adb94d34", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0923164338, "max_node_abs_v": 0.286793649}}, {"run": "chain5 connected/test", "status": "OK", "run_id": "a5b27c4f2f3b6fedd73f9dddb4a472a699470fd77b2bbda8e6a0cf480bd6433a", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0926313102, "max_node_abs_v": 0.286792487}}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "216176f04681c54d02f3d4559edfbc770e29acb63abd66cf8d7a6c1f281006ae", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0832455084, "max_node_abs_v": 0.0832455084}}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "f066b7e3478beb599d2782cd020a0d0600a262e54781e325f55242212abdf6ff", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831941962, "max_node_abs_v": 0.0831941962}}], + "mask_starts": [3, 1, 1, 2, 3, 2, 1, 0, 2, 2, 3, 1, 1, 3, 0, 3, 1, 0, 3, 1, 0, 0, 0, 0, 0, 0, 1, 3, 3, 1, 3, 1, 1, 0, 1, 0, 1, 1, 3, 1, 3, 1, 0, 1, 0, 1, 0, 3, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.09277361939, "test_nrmse": [0.08786107364], "train_nrmse": [0.08799828805]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4710253888, "test_nrmse": [0.469133367], "train_nrmse": [0.4578337851]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5396438795, "test_nrmse": [0.5037944144], "train_nrmse": [0.5105190586]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3419059217, "test_nrmse": [0.3308543887], "train_nrmse": [0.3374722795]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3754704188, "test_nrmse": [0.3632729947], "train_nrmse": [0.3669233695]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.485845992, "test_nrmse": [0.482380122], "train_nrmse": [0.4855894221]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.007585350791, "test_nrmse": [0.006900438801], "train_nrmse": [0.006826461776]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.01950367964, "test_nrmse": [0.02096349451], "train_nrmse": [0.01776206999]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3621309005, "test_nrmse": [0.3627751451], "train_nrmse": [0.3610099142]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-05, "cv_score": 0.2620656917, "test_nrmse": [0.2603101122], "train_nrmse": [0.2584801904]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4933038241, "test_nrmse": [0.4805719641], "train_nrmse": [0.4843477514]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6399829255, "test_nrmse": [0.6183255536], "train_nrmse": [0.6289241012]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.227571874, "test_nrmse": [0.2216061226], "train_nrmse": [0.223971945]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4982236262, "test_nrmse": [0.4896305425], "train_nrmse": [0.4902044397]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-05, "cv_score": 0.55956109, "test_nrmse": [0.5248249923], "train_nrmse": [0.5383773994]}]}, + {"seed": 2, "runs": [{"run": "chain50 connected/train", "status": "ERR_STIFF", "stopped_at_step": 1433, "membranes": {"states_observed": 1433, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220264912, "max_node_abs_v": 2.87232113}}, {"run": "chain50 connected/test", "status": "ERR_STIFF", "stopped_at_step": 1439, "membranes": {"states_observed": 1439, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220262378, "max_node_abs_v": 2.85178423}}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "8cee36d2b70e926a6941dc75321e03c1d7bf24356da33823e68d6a3c0713f716", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831101909, "max_node_abs_v": 0.0831101909}}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "a83087130614ddfc97159bae20b6586b1453c86c53f0de6692d7ce2ff5aa4b26", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831408501, "max_node_abs_v": 0.0831408501}}, {"run": "chain5 connected/train", "status": "OK", "run_id": "3f7bf197ab90bbce45eabb5f311bee15de5befcb52b2a0428e2587dd459f0d5c", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0927087143, "max_node_abs_v": 0.291333973}}, {"run": "chain5 connected/test", "status": "OK", "run_id": "f51a00f28c8ae3e811de769da9009598f29812d6da8c78563b0419fbfc32a658", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0925715342, "max_node_abs_v": 0.291050673}}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "93c69d1425aa4812b9751ddf0450f6e401eccaa9661f887902703a2f76803c7d", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0830980539, "max_node_abs_v": 0.0830980539}}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "7a64cc04f5cd4b94543b25440bb122e9f814a39cb7b78894bd48b25849070326", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831408501, "max_node_abs_v": 0.0831408501}}], + "mask_starts": [3, 0, 3, 2, 3, 1, 0, 3, 3, 2, 0, 1, 1, 0, 2, 0, 1, 1, 3, 2, 1, 2, 2, 1, 3, 0, 0, 1, 2, 0, 0, 2, 3, 2, 1, 1, 3, 3, 0, 0, 1, 3, 2, 1, 3, 1, 1, 3, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.0892277926, "test_nrmse": [0.08378865244], "train_nrmse": [0.08422441817]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4980438453, "test_nrmse": [0.4772924387], "train_nrmse": [0.4812865797]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5531538897, "test_nrmse": [0.5371217049], "train_nrmse": [0.5206612866]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3453865964, "test_nrmse": [0.3369084832], "train_nrmse": [0.3389245463]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3837854171, "test_nrmse": [0.3781031734], "train_nrmse": [0.3741020659]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.4988131829, "test_nrmse": [0.4264527505], "train_nrmse": [0.4794149213]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.00664632411, "test_nrmse": [0.006812708542], "train_nrmse": [0.006147402486]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 1, "cv_score": 0.02245848485, "test_nrmse": [0.01945966509], "train_nrmse": [0.02089767522]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3551178842, "test_nrmse": [0.3016273467], "train_nrmse": [0.3385106553]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.1924648727, "test_nrmse": [0.1842624899], "train_nrmse": [0.1891474998]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4759908842, "test_nrmse": [0.4567492805], "train_nrmse": [0.4650799588]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6382271375, "test_nrmse": [0.575347216], "train_nrmse": [0.6068879611]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2337337221, "test_nrmse": [0.2268281735], "train_nrmse": [0.2287779334]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5434287123, "test_nrmse": [0.5344376521], "train_nrmse": [0.5308700308]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5688446454, "test_nrmse": [0.5529571051], "train_nrmse": [0.5428327615]}]}, + {"seed": 3, "runs": [{"run": "chain50 connected/train", "status": "ERR_STIFF", "stopped_at_step": 1465, "membranes": {"states_observed": 1465, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220242932, "max_node_abs_v": 2.85934138}}, {"run": "chain50 connected/test", "status": "ERR_STIFF", "stopped_at_step": 1312, "membranes": {"states_observed": 1312, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220223159, "max_node_abs_v": 2.95837569}}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "92c7348b9b419a6941859d2754bc02eb2c84d62985515db393948f35e720f31c", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0833035111, "max_node_abs_v": 0.0833035111}}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "9f2ea47aa40b36a80ed61630f523b6a96023661139b6e41b2b68775c34ba819e", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.083060652, "max_node_abs_v": 0.083060652}}, {"run": "chain5 connected/train", "status": "OK", "run_id": "c6008338ea4aac50f57a1505bd08b7156b11f15e9b15d30839a5559367a131dc", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0929754302, "max_node_abs_v": 0.294858932}}, {"run": "chain5 connected/test", "status": "OK", "run_id": "9423e6049ef950151b60c3c0fb4dfefb442948ac691e52cd13ae2950a5bb94d7", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0929018259, "max_node_abs_v": 0.294383824}}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "a25049a63ca11e9365bc65196e7dfc301b130ce1aba011ba37b108d9cd610da1", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0832146034, "max_node_abs_v": 0.0832146034}}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "6452305818ccb82cf00bd4885e75fbaebeed1173eb848cf076887413fc98bbab", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0829241946, "max_node_abs_v": 0.0829241946}}], + "mask_starts": [0, 0, 0, 0, 0, 1, 3, 0, 1, 0, 2, 0, 0, 1, 2, 0, 2, 1, 3, 3, 2, 0, 0, 0, 0, 1, 0, 3, 2, 2, 2, 0, 0, 1, 3, 2, 3, 0, 2, 0, 1, 0, 1, 3, 0, 3, 3, 2, 1], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.09936655559, "test_nrmse": [0.09692048451], "train_nrmse": [0.09240259534]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4844420712, "test_nrmse": [0.520256801], "train_nrmse": [0.4734097692]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-05, "cv_score": 0.5852221985, "test_nrmse": [0.5356537811], "train_nrmse": [0.5597601725]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3372350139, "test_nrmse": [0.3414940773], "train_nrmse": [0.3322909289]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3606396033, "test_nrmse": [0.4020133303], "train_nrmse": [0.3568767877]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.4907835312, "test_nrmse": [0.4363563291], "train_nrmse": [0.4767261307]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.007316679612, "test_nrmse": [0.006672889301], "train_nrmse": [0.006814461844]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.0187869666, "test_nrmse": [0.01808261188], "train_nrmse": [0.01721309243]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3224716052, "test_nrmse": [0.2739311505], "train_nrmse": [0.3052334979]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 0.0001, "cv_score": 0.1892294488, "test_nrmse": [0.1910781812], "train_nrmse": [0.1852750268]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4644493719, "test_nrmse": [0.4918292655], "train_nrmse": [0.4594082399]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6468139787, "test_nrmse": [0.5835348555], "train_nrmse": [0.6216632851]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.236841755, "test_nrmse": [0.2356812013], "train_nrmse": [0.2309353761]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5320920293, "test_nrmse": [0.5686496242], "train_nrmse": [0.5255399415]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6106700875, "test_nrmse": [0.5652678105], "train_nrmse": [0.5898350173]}]}, + {"seed": 4, "runs": [{"run": "chain50 connected/train", "status": "ERR_STIFF", "stopped_at_step": 1387, "membranes": {"states_observed": 1387, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220311686, "max_node_abs_v": 2.89857864}}, {"run": "chain50 connected/test", "status": "ERR_STIFF", "stopped_at_step": 1444, "membranes": {"states_observed": 1444, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220219046, "max_node_abs_v": 2.87911224}}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "174fc939248602395af5bfee927e47d0cb0298a32a1b21095cc9d7aad9929cf3", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0832114443, "max_node_abs_v": 0.0832114443}}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "927f6f764bd7c24cb460736cf357894c30323838f06377d040d5c69be017050b", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0830870867, "max_node_abs_v": 0.0830870867}}, {"run": "chain5 connected/train", "status": "OK", "run_id": "c4493113483e065162be32601fa6ca5d2db0f1563e4c7ea555c0711c0163334e", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0929490775, "max_node_abs_v": 0.29211852}}, {"run": "chain5 connected/test", "status": "OK", "run_id": "f49ffabd50b0974c02785bab0cdc68fa1eb1a04b17c4964f054e28db5d03a529", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0937205926, "max_node_abs_v": 0.291957438}}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "e82a1c4056b382a1cf808cb6f669e8cd617ca151b927d3694d84feeba07aab5d", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0830907896, "max_node_abs_v": 0.0830907896}}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "d95d769e0e6b8d4838317af2b52fe10486647420f4900b6a319d70ee9852c94e", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0830870867, "max_node_abs_v": 0.0830870867}}], + "mask_starts": [1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 3, 2, 2, 1, 2, 0, 1, 3, 0, 1, 1, 1, 1, 1, 2, 0, 1, 0, 3, 0, 3, 1, 1, 2, 3, 0, 1, 2, 2, 0, 2, 0, 2, 0, 3, 0, 0, 3, 0], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.08745686002, "test_nrmse": [0.08604368951], "train_nrmse": [0.08282354434]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4882992819, "test_nrmse": [0.4895965926], "train_nrmse": [0.4758403263]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5697082122, "test_nrmse": [0.5393070622], "train_nrmse": [0.5517413487]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3297981301, "test_nrmse": [0.3321421529], "train_nrmse": [0.324981227]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3693658749, "test_nrmse": [0.3807900357], "train_nrmse": [0.365227314]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.4766971955, "test_nrmse": [0.4317717154], "train_nrmse": [0.4692023352]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.006934466436, "test_nrmse": [0.006665074895], "train_nrmse": [0.006399829523]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.01715176422, "test_nrmse": [0.01667323179], "train_nrmse": [0.01612486502]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.2966962358, "test_nrmse": [0.276430195], "train_nrmse": [0.2816354521]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2388202484, "test_nrmse": [0.2390963224], "train_nrmse": [0.2342126145]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4991837071, "test_nrmse": [0.5031310798], "train_nrmse": [0.4916590275]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5901224481, "test_nrmse": [0.5514399242], "train_nrmse": [0.576200865]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.1907171358, "test_nrmse": [0.1905480529], "train_nrmse": [0.1865195662]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.518530796, "test_nrmse": [0.5232308691], "train_nrmse": [0.5104706468]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6120434652, "test_nrmse": [0.5753290635], "train_nrmse": [0.600399365]}]}, + {"seed": 5, "runs": [{"run": "chain50 connected/train", "status": "ERR_STIFF", "stopped_at_step": 1421, "membranes": {"states_observed": 1421, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220239148, "max_node_abs_v": 2.86822343}}, {"run": "chain50 connected/test", "status": "ERR_STIFF", "stopped_at_step": 1418, "membranes": {"states_observed": 1418, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.220186159, "max_node_abs_v": 2.87488317}}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "50ab20f2e4061423d91729dc93b99005bfd70466d11df42458ddaa625520b7e6", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831486359, "max_node_abs_v": 0.0831486359}}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "437a1c70b66b3e78a3c9546b2d6ba19a6bb0329433ddaba2f0179309041aee87", "config_id": "cedb8318a8f4e3b5a1d26db26f596b62f937409f1efd20b006224579b346f328", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831548646, "max_node_abs_v": 0.0831548646}}, {"run": "chain5 connected/train", "status": "OK", "run_id": "1fa0dfc1a35c23954cf7cbbadae93b1c8a3d8ab50119a797c2684c5a9a9e34d9", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0934083685, "max_node_abs_v": 0.288283437}}, {"run": "chain5 connected/test", "status": "OK", "run_id": "28a9cd5d3fdba94f5c5afd9f69bd7952fd792befd6b47aeb598ce8c1522ad6ee", "config_id": "cb778325f867428cd815041fe262c19c734db220a95e32a2506fc6af673e6224", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0923302099, "max_node_abs_v": 0.288149148}}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "541b41b31dd0a5181cb30f92db2cb930df61f80b69892daa40b1a82a674f272d", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 600000, "membranes": {"states_observed": 600000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0831486359, "max_node_abs_v": 0.0831486359}}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "3b88891e4f862c8fbb80c0a7fd4c6ad57623bb7a1a1cbb3d2979b71c0055a3f7", "config_id": "ab3332f44374ae8904e6e595387d0d9e9dae4863873758a17cf290e7d0c6f8c1", "steps": 300000, "membranes": {"states_observed": 300000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0830372423, "max_node_abs_v": 0.0830372423}}], + "mask_starts": [3, 1, 3, 2, 2, 1, 3, 3, 2, 0, 0, 0, 1, 3, 3, 3, 0, 2, 3, 2, 0, 3, 1, 2, 2, 2, 2, 3, 2, 3, 2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 0, 1, 1, 3, 1, 1, 0, 1, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_STIFF", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.08939652677, "test_nrmse": [0.08347072062], "train_nrmse": [0.08351300589]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4906024556, "test_nrmse": [0.4987558858], "train_nrmse": [0.4788778171]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5739087458, "test_nrmse": [0.6064830129], "train_nrmse": [0.5518554379]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3362966399, "test_nrmse": [0.3292238732], "train_nrmse": [0.3330530735]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3773911824, "test_nrmse": [0.3802789034], "train_nrmse": [0.3708097818]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.4927890287, "test_nrmse": [0.4541392886], "train_nrmse": [0.4836047558]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 1e-06, "cv_score": 0.006738429948, "test_nrmse": [0.007145417979], "train_nrmse": [0.00626322936]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.0203990545, "test_nrmse": [0.01910807781], "train_nrmse": [0.01873415987]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.320981522, "test_nrmse": [0.2777624689], "train_nrmse": [0.3069012649]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2847094106, "test_nrmse": [0.2742085547], "train_nrmse": [0.2817847979]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.484810652, "test_nrmse": [0.4967548449], "train_nrmse": [0.4782832282]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6227429669, "test_nrmse": [0.6227520761], "train_nrmse": [0.6095545713]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2290507623, "test_nrmse": [0.2260737818], "train_nrmse": [0.2256089333]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5297829067, "test_nrmse": [0.5529306479], "train_nrmse": [0.5216730956]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5937959237, "test_nrmse": [0.6178223209], "train_nrmse": [0.5791827822]}]} + ], + "summary": [ + {"task": "NARMA-2", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.08761692414, "sd": 0.005498581173, "min": 0.08347072062, "max": 0.09692048451}, "BL-linear": {"seeds_ok": 5, "mean": 0.3341245951, "sd": 0.005017486977, "min": 0.3292238732, "max": 0.3414940773}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.006839305904, "sd": 0.0001976108446, "min": 0.006665074895, "max": 0.007145417979}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.2297911321, "sd": 0.04050448114, "min": 0.1842624899, "max": 0.2742085547}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.2201474664, "sd": 0.01731547676, "min": 0.1905480529, "max": 0.2356812013}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.00964366564, "sd": 0.04875488445, "min": -0.04460302015, "max": 0.04854826949}, "first_wins": 2, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.2229518262, "sd": 0.04037207882, "min": 0.1774497814, "max": 0.2670631368}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "NARMA-5", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.491007017, "sd": 0.01990056751, "min": 0.469133367, "max": 0.520256801}, "BL-linear": {"seeds_ok": 5, "mean": 0.3808916875, "sd": 0.01382663898, "min": 0.3632729947, "max": 0.4020133303}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.01885741621, "sd": 0.001599381453, "min": 0.01667323179, "max": 0.02096349451}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.485807287, "sd": 0.01822089045, "min": 0.4567492805, "max": 0.5031310798}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5337758672, "sd": 0.03018082663, "min": 0.4896305425, "max": 0.5686496242}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": -0.0479685802, "sd": 0.03191280064, "min": -0.07768837164, "max": -0.009058578404}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.4669498707, "sd": 0.01920161416, "min": 0.4372896154, "max": 0.486457848}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "NARMA-10", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.5444719951, "sd": 0.03761148792, "min": 0.5037944144, "max": 0.6064830129}, "BL-linear": {"seeds_ok": 5, "mean": 0.4462200411, "sd": 0.02273245827, "min": 0.4264527505, "max": 0.482380122}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.2985052612, "sd": 0.0376225474, "min": 0.2739311505, "max": 0.3627751451}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5902799251, "sd": 0.03007501165, "min": 0.5514399242, "max": 0.6227520761}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5672402585, "sd": 0.03402545971, "min": 0.5248249923, "max": 0.6178223209}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.02303966662, "sd": 0.04335383271, "min": -0.02388913931, "max": 0.09350056134}, "first_wins": 1, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.2917746638, "sd": 0.03559824509, "min": 0.2555504085, "max": 0.3449896072}, "first_wins": 0, "seeds_compared": 5}]} + ], + "significance": "none claimed (five seeds)" +}, + "bench-lorenz": { + "schema": "omega-reservoir-bench-lorenz/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "seeds": [1, 2, 3, 4, 5], + "setup": {"dt": 1e-4, "discard_s": 20, "record_s": 20, "sample_s": 0.01, "rows": [200, 1975], "horizons_samples": [0, 1, 25], "lags": 5, "lambda_grid": [1e-6, 1e2, 9], "folds": 5, "nodes_connected": 43, "nodes_disconnected": 5}, + "wall_s": 64.6, + "per_seed": [ + {"seed": 1, "initial_state": {"train": [-2.274896506, 1.791977994, 12.45691834], "test": [-3.657091816, -5.870045965, 30.52625222]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "21bfb7ade53c3e12baed18431788f4e024544e37c919feb253b2d4ce9cbf4ca8", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0917072892, "max_node_abs_v": 0.34878841}}, {"run": "connected/test", "status": "OK", "run_id": "00517ee14699c2c445384939423b1add93c92acbba7e5a891f2ce54db6772a91", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0915195942, "max_node_abs_v": 0.347771049}}, {"run": "disconnected/train", "status": "OK", "run_id": "72ccfca70dcbdff4490b77d89ee40b5995fba77a623e76623b331b61382b94eb", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0917072892, "max_node_abs_v": 0.0917072892}}, {"run": "disconnected/test", "status": "OK", "run_id": "1ed32e1032d4d43d19a0b9bf89a672fd3f7a8aa9c6de39e11540a85fece42ccb", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0915195718, "max_node_abs_v": 0.0915195718}}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.08945688751, "test_nrmse": [0.07359263531, 0.1983642405, 0.1441234229], "train_nrmse": [0.0171971677, 0.07285850471, 0.03642802097]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1007865811, "test_nrmse": [0.07269320845, 0.2654762348, 0.2324839187], "train_nrmse": [0.01732705298, 0.0782672966, 0.03814322131]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.857233252, "test_nrmse": [0.9133079319, 1.169408141, 0.8185145677], "train_nrmse": [0.6471173725, 0.822524602, 0.7722065285]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.01, "cv_score": 0.03626501438, "test_nrmse": [0.09362676228, 0.07075625905, 0.1238637511], "train_nrmse": [0.009062576725, 0.03212041513, 0.0140065768]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.01, "cv_score": 0.03801515551, "test_nrmse": [0.07409267841, 0.142812387, 0.09949889996], "train_nrmse": [0.008109847993, 0.03529237225, 0.0115469022]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.838337594, "test_nrmse": [1.033211697, 1.342038481, 0.8049694186], "train_nrmse": [0.6114714645, 0.7899053588, 0.7518024109]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 0.1, "cv_score": 0.5198559718, "test_nrmse": [0.5167007854, 0.7494103261, 0.2001947806], "train_nrmse": [0.5027757367, 0.7379862461, 0.2182594191]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.5440883707, "test_nrmse": [0.5451641401, 0.7850182292, 0.2029601042], "train_nrmse": [0.5297234444, 0.7696590167, 0.2239529408]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 100, "cv_score": 1.053174836, "test_nrmse": [1.018289721, 1.020504799, 0.8668311902], "train_nrmse": [0.973857817, 0.9966116129, 0.9086613244]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2786978126, "test_nrmse": [0.2645769779, 0.4671599595, 0.02934660464], "train_nrmse": [0.2633883111, 0.4656871868, 0.03420669285]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.311058963, "test_nrmse": [0.286655703, 0.493323045, 0.07662387758], "train_nrmse": [0.2845253148, 0.4857769351, 0.08371477415]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 0.978589519, "test_nrmse": [0.8813626175, 0.9733025984, 0.8388046344], "train_nrmse": [0.8282649135, 0.9421007528, 0.9000130726]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.287694116e-06, "test_nrmse": [5.500491867e-07, 1.228272513e-06, 1.134915499e-06], "train_nrmse": [5.529302614e-07, 1.240330485e-06, 1.180000537e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001521820671, "test_nrmse": [6.902794787e-06, 0.000181460546, 0.0001733835788], "train_nrmse": [6.9312679e-06, 0.0001829131962, 0.000180275434]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.7314239604, "test_nrmse": [0.494862637, 0.8074402796, 0.6993911383], "train_nrmse": [0.4775352856, 0.7865242038, 0.7170891947]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.42094615e-07, "test_nrmse": [1.617648858e-08, 1.038925105e-07, 6.309218425e-08], "train_nrmse": [1.603389825e-08, 1.11885002e-07, 6.448354555e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.107021847e-06, "test_nrmse": [2.902077541e-08, 1.063653507e-06, 8.90795779e-07], "train_nrmse": [3.097865877e-08, 1.130300854e-06, 9.790725323e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-05, "cv_score": 0.5735909823, "test_nrmse": [0.3001015031, 0.5413445573, 0.5095307488], "train_nrmse": [0.2940668079, 0.5339888969, 0.5354444901]}]}, + {"seed": 2, "initial_state": {"train": [-5.21362969, -9.581500709, 25.52929201], "test": [5.575480197, -6.987252888, 16.73490529]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "67061f74fd0bda40f2e732ed47817e9924ec8cd8e5174090cdd41e11e6a50340", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0913724005, "max_node_abs_v": 0.346994311}}, {"run": "connected/test", "status": "OK", "run_id": "5aabfa9cddb90424903fd6abdec121ee9e46eaa15c938ca0d38ce24aafd4ea36", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0915843844, "max_node_abs_v": 0.348120689}}, {"run": "disconnected/train", "status": "OK", "run_id": "20217c5c30c4da725ce388b96e755dfbcd3048f8a0c708bb81192a4ff0e65679", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0913723707, "max_node_abs_v": 0.0913723707}}, {"run": "disconnected/test", "status": "OK", "run_id": "6ce56626ed6dac6f61a4009af7c9e2db2aad6a8c4f356e568eeabfe21ab573dd", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0915843695, "max_node_abs_v": 0.0915843695}}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.07680670978, "test_nrmse": [0.05772514425, 0.1273563867, 0.09686939643], "train_nrmse": [0.01472909783, 0.06706113086, 0.03122822903]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.001, "cv_score": 0.07899358739, "test_nrmse": [0.07727411936, 0.1184139, 0.08478459115], "train_nrmse": [0.0168685386, 0.07866090751, 0.03304096213]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 0.1, "cv_score": 0.7748419221, "test_nrmse": [0.8160465787, 1.101550132, 0.7343101283], "train_nrmse": [0.5053214362, 0.6610905643, 0.5841220886]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.001, "cv_score": 0.02376517023, "test_nrmse": [0.04863997909, 0.065975122, 0.03884938332], "train_nrmse": [0.00467053383, 0.01570898767, 0.00767423352]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.02403207571, "test_nrmse": [0.021607756, 0.1058716297, 0.02437387643], "train_nrmse": [0.001919857891, 0.008008239554, 0.002855388776]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 1, "cv_score": 0.7797767328, "test_nrmse": [0.7831376872, 1.086324618, 0.7470959705], "train_nrmse": [0.5132670856, 0.6844915443, 0.619236667]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.4854317803, "test_nrmse": [0.4757472544, 0.7179087567, 0.1992030163], "train_nrmse": [0.4589962457, 0.7190230241, 0.1854764768]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.511201618, "test_nrmse": [0.5034959517, 0.7519353682, 0.20388882], "train_nrmse": [0.4890264417, 0.7530908169, 0.1929903973]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.9950680926, "test_nrmse": [0.9738086601, 0.9996030152, 0.8687433998], "train_nrmse": [0.9739200987, 0.9989821681, 0.8565583765]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2680455615, "test_nrmse": [0.2546261523, 0.4518261874, 0.02949398568], "train_nrmse": [0.2544494956, 0.4539391741, 0.02354852401]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.3026161877, "test_nrmse": [0.2755327064, 0.4727171583, 0.08026288168], "train_nrmse": [0.2772426675, 0.4713038587, 0.08164427095]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 0.1, "cv_score": 0.9312970495, "test_nrmse": [0.8366756266, 0.9520350586, 0.8638866933], "train_nrmse": [0.8383446754, 0.9562984397, 0.8377553584]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.270102419e-06, "test_nrmse": [5.739036666e-07, 1.285455032e-06, 1.272316432e-06], "train_nrmse": [5.66732821e-07, 1.273860544e-06, 1.230553331e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001448831556, "test_nrmse": [7.073313176e-06, 0.0001856633479, 0.0001858374767], "train_nrmse": [6.95907268e-06, 0.000182873482, 0.0001798654911]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6794026731, "test_nrmse": [0.4771586796, 0.7895502343, 0.6861188556], "train_nrmse": [0.4796834366, 0.7922698791, 0.6651102101]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.012740831e-07, "test_nrmse": [1.597662221e-08, 1.425023347e-07, 1.054638494e-07], "train_nrmse": [1.436608888e-08, 1.073603132e-07, 7.669152068e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 8.251145e-07, "test_nrmse": [3.1002981e-08, 1.116190177e-06, 1.188881053e-06], "train_nrmse": [2.712598802e-08, 9.888031403e-07, 9.529414624e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4411669548, "test_nrmse": [0.2884545447, 0.54476164, 0.509106802], "train_nrmse": [0.2707128156, 0.5014010167, 0.4359376562]}]}, + {"seed": 3, "initial_state": {"train": [3.014648179, -5.700400198, 36.9119272], "test": [0.7714623529, 5.671596567, 21.29210994]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "a0fe9c641a06a2d29e04bdcf6372d552a6cdb95dbcd467d2f71b82497c3695b8", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.091123879, "max_node_abs_v": 0.34569934}}, {"run": "connected/test", "status": "OK", "run_id": "9d8a7df8fefd488b1c7888970b50ab793c868593a67921fe07fd7ea48e9f62d1", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0917189121, "max_node_abs_v": 0.347301602}}, {"run": "disconnected/train", "status": "OK", "run_id": "2781c9fe0408b60d6d66cef05de3d1a4f280336daf3e9ecd12eb9dd34c134049", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.091123879, "max_node_abs_v": 0.091123879}}, {"run": "disconnected/test", "status": "OK", "run_id": "7b9559bf6c2f9fc6e906346d2cf7ad279dbb2346f3526bc4bff410d3c0c2ed01", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0917189047, "max_node_abs_v": 0.0917189047}}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.1, "cv_score": 0.09404949534, "test_nrmse": [0.1366440451, 0.2422930174, 0.1270309014], "train_nrmse": [0.04184638908, 0.08981544613, 0.06612163052]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.01, "cv_score": 0.07913564735, "test_nrmse": [0.101850413, 0.3264761648, 0.09396358118], "train_nrmse": [0.02224345305, 0.08143586639, 0.0327211989]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.7859890648, "test_nrmse": [0.9199843296, 1.337887349, 1.152243487], "train_nrmse": [0.6867335366, 0.8452254123, 0.5896210249]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.02523202958, "test_nrmse": [0.03158206912, 0.3623999012, 0.06838874881], "train_nrmse": [0.001762899654, 0.005337482331, 0.003666770693]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.01976593533, "test_nrmse": [0.0441707764, 0.3698824892, 0.07675793317], "train_nrmse": [0.001476564218, 0.00550377042, 0.002383209663]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.7608579341, "test_nrmse": [0.9345321347, 1.454761106, 1.192153905], "train_nrmse": [0.6336539469, 0.8112551566, 0.5735331995]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4355590377, "test_nrmse": [0.4640150578, 0.6975836352, 0.1976229954], "train_nrmse": [0.4096330977, 0.6943096453, 0.1741478085]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4620714184, "test_nrmse": [0.489210316, 0.7309448331, 0.2004709488], "train_nrmse": [0.4419416693, 0.7301800752, 0.1815532118]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.9705758239, "test_nrmse": [0.9508252968, 0.9960469219, 0.9107899024], "train_nrmse": [0.9601173273, 0.9918811716, 0.8567966041]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2459722526, "test_nrmse": [0.2502514, 0.474642006, 0.0276590426], "train_nrmse": [0.2501732348, 0.4139615663, 0.02710485888]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2744672691, "test_nrmse": [0.2710043928, 0.5006379975, 0.07837921027], "train_nrmse": [0.2699687489, 0.4213687584, 0.08284302878]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 0.1, "cv_score": 0.8965613424, "test_nrmse": [0.7610923907, 0.9078495133, 0.9371371499], "train_nrmse": [0.7936788792, 0.9319365862, 0.8287018032]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.253178472e-06, "test_nrmse": [4.985384439e-07, 1.144794352e-06, 1.249885271e-06], "train_nrmse": [5.724011002e-07, 1.269936463e-06, 1.253737813e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.000142752299, "test_nrmse": [6.107153963e-06, 0.0001632134512, 0.0001792599711], "train_nrmse": [6.96243656e-06, 0.0001804959958, 0.0001794752156]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6531303044, "test_nrmse": [0.4583248445, 0.7895752255, 0.7021136727], "train_nrmse": [0.4737309707, 0.7720154547, 0.6304051018]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.549692002e-07, "test_nrmse": [2.858793217e-08, 2.323635702e-07, 2.734393308e-07], "train_nrmse": [1.420328371e-08, 1.080318799e-07, 8.68788409e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.074159517e-06, "test_nrmse": [3.552850035e-08, 9.889872172e-07, 2.163559163e-06], "train_nrmse": [2.634395614e-08, 9.235509825e-07, 9.29421665e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4719063943, "test_nrmse": [0.2876027526, 0.5704511495, 0.520890744], "train_nrmse": [0.2438155017, 0.4482267998, 0.4041866649]}]}, + {"seed": 4, "initial_state": {"train": [-9.721361349, -9.125792155, 12.80936991], "test": [-7.515167081, -0.6883587043, 30.78824714]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "2052adacc0863bf389c464c4b34349b6bb3013e1ff0133ff0ca76e115db671be", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0943368077, "max_node_abs_v": 0.347283274}}, {"run": "connected/test", "status": "OK", "run_id": "3035ae9b4565f1f27b5a151c29dc98c9e017b80bc8ad607dc2baeef2f01780f0", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0916750133, "max_node_abs_v": 0.348608315}}, {"run": "disconnected/train", "status": "OK", "run_id": "e8ba4c8abd52eacb718e931ebe41749646bb4f50cc282fd204edddf67575560e", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0943368003, "max_node_abs_v": 0.0943368003}}, {"run": "disconnected/test", "status": "OK", "run_id": "27dc577235832ddf5333e032e110138aadf2b92fe8aaa0dfc960a65982847a32", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.091674991, "max_node_abs_v": 0.091674991}}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.1817077765, "test_nrmse": [0.1097222774, 0.2110941411, 0.178070745], "train_nrmse": [0.08621883743, 0.1911042356, 0.1260187899]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.01, "cv_score": 0.1575445856, "test_nrmse": [0.05972174709, 0.1511620584, 0.08149925676], "train_nrmse": [0.02522846871, 0.1001623207, 0.04194049071]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.8452440104, "test_nrmse": [0.6835803359, 0.8774698253, 0.8716210979], "train_nrmse": [0.6691577601, 0.855675326, 0.6552818377]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.1, "cv_score": 0.08371878602, "test_nrmse": [0.04667368462, 0.06515989329, 0.02859417405], "train_nrmse": [0.01629599772, 0.04798198639, 0.01981125938]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.1, "cv_score": 0.0782492134, "test_nrmse": [0.03968715699, 0.0758597303, 0.0282092065], "train_nrmse": [0.01361293323, 0.04981986561, 0.01785201719]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.8454653709, "test_nrmse": [0.6628190363, 0.8672414168, 0.8551044081], "train_nrmse": [0.6417408806, 0.8327230849, 0.6333522978]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4988106434, "test_nrmse": [0.5056029128, 0.727889805, 0.2379932435], "train_nrmse": [0.4789060056, 0.7221662932, 0.1817769106]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.5231123511, "test_nrmse": [0.5307226306, 0.7607966947, 0.2402125319], "train_nrmse": [0.5079674517, 0.7573857484, 0.1856714204]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 1.014781244, "test_nrmse": [0.982543699, 1.011282882, 0.9298642363], "train_nrmse": [0.9857089895, 0.9969299385, 0.8199662267]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2598474621, "test_nrmse": [0.2647440626, 0.4657857301, 0.04383110894], "train_nrmse": [0.2472135769, 0.4407829298, 0.02296345863]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2940206388, "test_nrmse": [0.2843084483, 0.4913145523, 0.08289652973], "train_nrmse": [0.2688072328, 0.462605535, 0.07610458636]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 0.9459350458, "test_nrmse": [0.8416826895, 0.9554409704, 0.9259752393], "train_nrmse": [0.8544535936, 0.9579789971, 0.8006720274]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.302337506e-06, "test_nrmse": [5.831785192e-07, 1.325681288e-06, 1.395568338e-06], "train_nrmse": [5.716421569e-07, 1.278774003e-06, 1.246482931e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001476202735, "test_nrmse": [7.174929308e-06, 0.0001910123373, 0.0002004411275], "train_nrmse": [6.982305532e-06, 0.0001829571661, 0.0001795630022]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6958077856, "test_nrmse": [0.4686529726, 0.7841124977, 0.7570823688], "train_nrmse": [0.4792184219, 0.7893328997, 0.6488079083]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.319817854e-07, "test_nrmse": [2.085878035e-08, 2.252177955e-07, 1.80951355e-07], "train_nrmse": [1.453828489e-08, 1.09598108e-07, 7.987737014e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.000551244e-06, "test_nrmse": [4.25734473e-08, 1.400425378e-06, 1.804685193e-06], "train_nrmse": [2.687992603e-08, 9.637303226e-07, 9.446970435e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4690173279, "test_nrmse": [0.3117171975, 0.587001827, 0.6644504137], "train_nrmse": [0.2682431351, 0.4994062524, 0.4233355928]}]}, + {"seed": 5, "initial_state": {"train": [-9.19086946, 7.271385617, 34.0927083], "test": [-9.200330572, 4.944556205, 22.01109943]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "3b5d0ab7e6a18853ae6898314d000cd48ced172a947dc0085429a37cc71115b4", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0918791145, "max_node_abs_v": 0.34696883}}, {"run": "connected/test", "status": "OK", "run_id": "8935a93b27e38ef21f865ef28a5cf9e62fe53c8c514786266b32a1e712c0c0cf", "config_id": "e49ddd013c6a911c21c1b97cd3f02c86a4cb261953741e1ade2f323d18606021", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0916888565, "max_node_abs_v": 0.346657097}}, {"run": "disconnected/train", "status": "OK", "run_id": "2fdc1d39159b45f38375c5d93bcce5b8b94d65895dbee0f7070d0070ff7d791c", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0918791071, "max_node_abs_v": 0.0918791071}}, {"run": "disconnected/test", "status": "OK", "run_id": "044bd8b4b5eefe9e84ec9968cdf494924c0d36f8edf82907df7c9da23c02ce2c", "config_id": "3445a5d47e32468caddb293afec97a49470f86ed9cae4ab855be9af8b6282070", "steps": 2000000, "membranes": {"states_observed": 2000000, "states_implausible": 0, "membranes_implausible": 0, "max_membrane_abs_v": 0.0916888565, "max_node_abs_v": 0.0916888565}}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1113403295, "test_nrmse": [0.2062952682, 0.6411022955, 0.5435365863], "train_nrmse": [0.01540612103, 0.06536693388, 0.03188137453]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1094211356, "test_nrmse": [0.2127427135, 0.5937933336, 0.2474540593], "train_nrmse": [0.01529472419, 0.06944737275, 0.0285421704]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 100, "cv_score": 0.9637430162, "test_nrmse": [0.8626526061, 1.042883685, 0.9933261887], "train_nrmse": [0.7123396372, 0.8604825798, 0.7191932766]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.0001, "cv_score": 0.05780768721, "test_nrmse": [0.4826596893, 1.209597618, 0.1897570963], "train_nrmse": [0.003865899946, 0.01399332518, 0.005439316413]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.0001, "cv_score": 0.05444902144, "test_nrmse": [0.312091413, 1.13883705, 0.04936695374], "train_nrmse": [0.002902089796, 0.01434734702, 0.003572821864]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 100, "cv_score": 0.9517142638, "test_nrmse": [0.8336462848, 1.035480136, 1.025302172], "train_nrmse": [0.6855665064, 0.8478755232, 0.6924007193]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.6800427674, "test_nrmse": [0.5172976198, 0.7794596151, 0.1988256188], "train_nrmse": [0.5234531216, 0.7415733691, 0.1834882478]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.7030798888, "test_nrmse": [0.5480157238, 0.8182823439, 0.203221649], "train_nrmse": [0.5496415308, 0.774254941, 0.1871116013]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 1.205331839, "test_nrmse": [1.126321026, 1.157832462, 0.9088796031], "train_nrmse": [0.9875643002, 0.9958890009, 0.8324095706]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.3362323696, "test_nrmse": [0.3061484606, 0.5189892613, 0.0306171839], "train_nrmse": [0.2571108479, 0.4523083181, 0.0214107261]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.0001, "cv_score": 0.3748201325, "test_nrmse": [0.3307110798, 0.5442705611, 0.08259682974], "train_nrmse": [0.277373397, 0.4773590217, 0.07537099268]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 1.077788872, "test_nrmse": [0.9712867129, 1.092122924, 0.9235445352], "train_nrmse": [0.8413292979, 0.9387010016, 0.8131141025]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.3085029e-06, "test_nrmse": [6.785711545e-07, 1.508096811e-06, 1.407269125e-06], "train_nrmse": [5.793985122e-07, 1.313447178e-06, 1.259204851e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001484020618, "test_nrmse": [8.232286704e-06, 0.0002137608546, 0.0001993424006], "train_nrmse": [6.986771718e-06, 0.0001843098481, 0.0001791467712]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.7580760662, "test_nrmse": [0.5293788686, 0.8746128036, 0.7301540195], "train_nrmse": [0.4589957945, 0.7658818436, 0.6520325022]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.555548338e-07, "test_nrmse": [2.158235237e-08, 1.818236003e-07, 1.330124901e-07], "train_nrmse": [1.472642817e-08, 1.09553499e-07, 7.454226144e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 9.896778795e-07, "test_nrmse": [3.936987415e-08, 1.334532396e-06, 1.444296024e-06], "train_nrmse": [2.622974793e-08, 9.444719433e-07, 9.182452858e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4963134932, "test_nrmse": [0.3231564424, 0.5990393337, 0.5687834611], "train_nrmse": [0.2527090075, 0.4748189108, 0.40990215]}]} + ], + "summary": [ + {"task": "T0", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.2062547002, "sd": 0.1469943188, "min": 0.09398364247, "max": 0.4636447167}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.1951016088, "sd": 0.2454708459, "min": 0.04680925065, "max": 0.6273381346}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.4790303615, "sd": 0.01934907211, "min": 0.4530738962, "max": 0.4985276179}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.2586465416, "sd": 0.0155814158, "min": 0.2453154418, "max": 0.2852516353}, "BL-linear": {"seeds_ok": 5, "mean": 1.055766375e-06, "sd": 9.743392055e-08, "min": 9.644060221e-07, "max": 1.19797903e-06}, "BL-quadratic": {"seeds_ok": 5, "mean": 1.163294131e-07, "sd": 4.575103315e-08, "min": 6.105372777e-08, "max": 1.781302777e-07}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.2727756613, "sd": 0.1368024764, "min": -0.3703027, "max": -0.03488290121}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": -0.06354493279, "sd": 0.2309663759, "min": -0.2113110499, "max": 0.3420864993}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.2062545839, "sd": 0.1469943146, "min": 0.09398355449, "max": 0.4636446045}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1951014924, "sd": 0.2454708445, "min": 0.04680910831, "max": 0.6273380224}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "T1", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.1813192867, "sd": 0.1046196002, "min": 0.09349087017, "max": 0.3513300355}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.1735413291, "sd": 0.1885892057, "min": 0.04791869793, "max": 0.5000984722}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.500956019, "sd": 0.02031164411, "min": 0.4735420327, "max": 0.5231732389}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.2900823316, "sd": 0.01675087309, "min": 0.2761709155, "max": 0.3191928236}, "BL-linear": {"seeds_ok": 5, "mean": 0.0001272577046, "sd": 9.664242004e-06, "min": 0.0001161935254, "max": 0.0001404451807}, "BL-quadratic": {"seeds_ok": 5, "mean": 9.049000977e-07, "sd": 1.823399108e-07, "min": 6.61156687e-07, "max": 1.082561339e-06}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.3196367323, "sd": 0.09534828429, "min": -0.413116265, "max": -0.1718432034}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": -0.1165410025, "sd": 0.1726397968, "min": -0.2382544789, "max": 0.1809056486}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1813183818, "sd": 0.1046196032, "min": 0.09349009148, "max": 0.3513290961}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1735404242, "sd": 0.1885891798, "min": 0.04791761537, "max": 0.5000975328}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "T25", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.952985759, "sd": 0.1215346469, "min": 0.8108904197, "max": 1.136705056}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.9771878981, "sd": 0.1566433824, "min": 0.7950549537, "max": 1.193815715}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.9814777876, "sd": 0.04764690986, "min": 0.947385025, "max": 1.064344364}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.9108132902, "sd": 0.049644661, "min": 0.868693018, "max": 0.9956513905}, "BL-linear": {"seeds_ok": 5, "mean": 0.6699019399, "sd": 0.02491527139, "min": 0.6500045809, "max": 0.7113818972}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.4750928745, "sd": 0.03243783891, "min": 0.4474409956, "max": 0.5210564794}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.02849202866, "sd": 0.1325522773, "min": -0.163673186, "max": 0.1841510151}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": 0.06637460787, "sd": 0.1759163278, "min": -0.1126446793, "max": 0.3251226973}, "first_wins": 3, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.4778928845, "sd": 0.1399351759, "min": 0.2898339403, "max": 0.6770568402}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.5020950236, "sd": 0.1765168392, "min": 0.2739984743, "max": 0.7341675}, "first_wins": 0, "seeds_compared": 5}]} + ], + "significance": "none claimed (five seeds)" +}, + "perf": { + "schema": "omega-reservoir-perf/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "host": {"sysname": "Linux", "release": "7.0.0-1019-nvidia", "machine": "aarch64", "cpu": 5, "cpu_part": "0xd85", "pinned": true, "sched_getcpu": 5}, + "compiler": "13.3.0", + "flags": "-std=gnu11 -Wall -Wextra -Werror -O2 -Isrc -Isrc/reservoir -Itests/reservoir -ffp-contract=off -fno-fast-math -fno-math-errno -DOMEGA_NUMERIC_CPU_ONLY -Itools/reservoir -pthread", + "timer": {"clock": "CLOCK_MONOTONIC", "mean_call_ns": 22.1, "included_in_latency": true}, + "struct_bytes": {"OmegaResConfig": 19948, "OmegaResState": 3632, "OmegaResWorkspace": 13360, "OmegaResTopology": 904, "OmegaResReadout": 8240, "OmegaResReadoutWorkspace": 538672}, + "warmup_steps": 10000, "timed_steps": 40000, "repetitions": 5, + "networks": [ + {"network": "chain5 NARMA (G2-N1)", "nodes": 5, "membranes": 4, "status": "OK", "per_repetition": [{"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 7120, "steps_per_s": 1294013.9}, {"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 17536, "steps_per_s": 1293952.2}, {"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 7088, "steps_per_s": 1301022.8}, {"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 5600, "steps_per_s": 1303028.6}, {"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 7648, "steps_per_s": 1297045.7}], "pooled": {"p50_ns": 768, "p95_ns": 800, "p99_ns": 816, "max_ns": 17536}, "steps_per_s": 1297800.9, "simulated_s_per_wall_s": 12.978, "cpu_over_wall": 0.9999}, + {"network": "chain50 NARMA", "nodes": 50, "membranes": 49, "status": "OK", "per_repetition": [{"p50_ns": 10592, "p95_ns": 10720, "p99_ns": 11520, "max_ns": 38112, "steps_per_s": 94172.1}, {"p50_ns": 10592, "p95_ns": 10720, "p99_ns": 11552, "max_ns": 45473, "steps_per_s": 94213.0}, {"p50_ns": 10560, "p95_ns": 10672, "p99_ns": 11504, "max_ns": 33408, "steps_per_s": 94517.6}, {"p50_ns": 10560, "p95_ns": 10672, "p99_ns": 11536, "max_ns": 46432, "steps_per_s": 94504.0}, {"p50_ns": 10576, "p95_ns": 10688, "p99_ns": 11456, "max_ns": 23216, "steps_per_s": 94405.9}], "pooled": {"p50_ns": 10576, "p95_ns": 10704, "p99_ns": 11505, "max_ns": 46432}, "steps_per_s": 94362.3, "simulated_s_per_wall_s": 0.943623, "cpu_over_wall": 0.9999}, + {"network": "hex43 Lorenz", "nodes": 43, "membranes": 99, "status": "OK", "per_repetition": [{"p50_ns": 14816, "p95_ns": 14960, "p99_ns": 16832, "max_ns": 28896, "steps_per_s": 67343.7}, {"p50_ns": 14720, "p95_ns": 14864, "p99_ns": 16497, "max_ns": 34304, "steps_per_s": 67766.1}, {"p50_ns": 14752, "p95_ns": 14944, "p99_ns": 16256, "max_ns": 55137, "steps_per_s": 67624.0}, {"p50_ns": 14752, "p95_ns": 14912, "p99_ns": 16416, "max_ns": 37872, "steps_per_s": 67636.9}, {"p50_ns": 14768, "p95_ns": 14928, "p99_ns": 16320, "max_ns": 41584, "steps_per_s": 67579.8}], "pooled": {"p50_ns": 14753, "p95_ns": 14928, "p99_ns": 16464, "max_ns": 55137}, "steps_per_s": 67589.8, "simulated_s_per_wall_s": 0.675898, "cpu_over_wall": 0.9999} + ], + "peak_rss_kib": 8528, + "energy": "NOT_RUN (not instrumented; no efficiency claim)" +} + } +} diff --git a/evidence/RESERVOIR/6d1c5abbb524ca557989a1dc9a9eae53469892d096ab9ae4ed712e9d1eacedcb.json b/evidence/RESERVOIR/6d1c5abbb524ca557989a1dc9a9eae53469892d096ab9ae4ed712e9d1eacedcb.json new file mode 100644 index 000000000..1e5d5e894 --- /dev/null +++ b/evidence/RESERVOIR/6d1c5abbb524ca557989a1dc9a9eae53469892d096ab9ae4ed712e9d1eacedcb.json @@ -0,0 +1,519 @@ +{ + "schema": "omega-reservoir-qualification/1", + "issue": "aien-spark/omega#440, Gate 2", + "doc": "docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1, 8, 10, 10.1", + "config": "docs/reservoir/gate2_config.json (test-reservoir checks the tool still emits it)", + "started_utc": "2026-10-14T15:55:25Z", + "finished_utc": "2026-10-14T16:00:06Z", + "candidate_commit": "ac35a16615c2ebe0e6916b23a8234172f6362849", + "candidate_tree": "f0f68308b61c2d68ac6ad9425fd7f5d0d6f99341", + "tree_dirty": false, + "tree_stable_during_run": true, + "host": {"uname": "Linux 7.0.0-1019-nvidia aarch64", "nproc": 20, "product_name": "NVIDIA_DGX_Spark"}, + "compiler": "cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0", + "unit_tests": "test_reservoir: 656 checks, 0 failed;test_reservoir: 656 checks, 0 failed;test_res_mat: 67 checks, 0 failed;test_res_mat: 52 checks, 0 failed;", + "unit_tests_log_sha256": "a86250c4227abb4d71560e4dc659a5e4f52747604a3bf57f029a7f5a8924b7b8", + "archive": {"record": "10.5281/zenodo.17296788", "license": "CC-BY-4.0", "pins": "results.pins", "v2_results_file_given": true}, + "quiet_flag": "quiet flag: CLEAR; forge: not running queue: 0 job(s)", + "timing": {"state": "RUN", "note": "load average before: 5.32 3.83 3.67"}, + "hardware_scope": "CPU only; no GPU opened, no silicon, no energy or power measurement", + "summary": {"pins": "PASS", "g2-narma-N1a": "FAIL", "g2-narma-N1b": "FAIL", "g2-narma-N1b-v2": "FAIL", "g2-narma-NC-N": "FAIL", "g2-lorenz-13": "PASS", "g2-lorenz-25": "PASS", "g2-lorenz-43": "PASS", "g2-lorenz-13-NC-L": "FAIL", "bench-narma": "RAN", "bench-lorenz": "RAN", "perf": "RAN"}, + "blocked": [ + "63 of the 64 archived NARMA grid cells: their input masks come from MATLAB's rng/randi stream, which is not reimplemented (no MATLAB or Octave here)", + "state-trace comparison against the authors' code: the version 1 archive holds no state trajectories", + "whether the archived outputs came from the archived code (discrepancy 15): needs MATLAB", + "the paper's parallel reservoir (S5): a different, voltage-clamped model, not implemented" + ], + "not_run": [ + "energy and power: not instrumented, no efficiency claim", + "AIEN telemetry workload: no real telemetry with a time-ordered train/validation/test split exists (section 11)", + "RC with squared states on the 50-node NARMA chain: 295 features, above the readout bound of 256" + ], + "proves": [ + "For the cases whose verdict is PASS: numerical agreement, under the tolerances declared before the runs, between Omega's binary32 simulator with its binary64 readout and the outputs the authors archived from their MATLAB code (targets, predictions and NRMSE), on the archived inputs.", + "For the cases whose verdict is FAIL: that Omega does not meet the declared criteria there, with the diagnostics recorded in the case.", + "The benchmark and timing numbers below, for this commit, compiler and host." + ], + "does_not_prove": [ + "physical validity of the droplet model, or anything about real droplets or devices", + "agreement on the BLOCKED cases, or with the authors' code beyond its archived outputs", + "GPU qualification of any kind (CPU only)", + "energy, power or efficiency (NOT_RUN)", + "production readiness" + ], + "status": "RECORDED", + "status_reasons": [], + "results": { + "pins": { + "schema": "omega-reservoir-pins/1", + "record": "10.5281/zenodo.17296788", + "files": [ + {"key": "code.narma_connected", "path": "src/Codes for Zenodo/NARMA Final Code/Connected Reservoir/HyperParameterTuningOptimized.m", "sha256": "620640f002068048ab2c56f5090dc945e7b81595a9bc7f863331659a1850ceb5", "match": true}, + {"key": "code.narma_parallel", "path": "src/Codes for Zenodo/NARMA Final Code/Parallel Reservoir/ParallelReservoirNARMA.m", "sha256": "f120f9150db590e3fcf767cbd1840e0924f513b45d44cf8439be2229be0fb507", "match": true}, + {"key": "code.lorenz43", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression.m", "sha256": "d291460fffe4efc1b2f013060c04e3a561dcd571de813a9c95277557daafdcac", "match": true}, + {"key": "code.lorenz13", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression13Nodes.m", "sha256": "c9e2ad2b64832c50c95f9d61e86161496aef40640cc547d1d5ae3a9323eedbf1", "match": true}, + {"key": "code.lorenz25", "path": "src/Codes for Zenodo/Lorenz Final Code/Lorenz63SolverCustomRegression25Nodes.m", "sha256": "c1b31403cc9a2014c2f3b65056873306ed52174142259b5127b30c803927dece", "match": true}, + {"key": "code.lorenz_gen", "path": "src/Codes for Zenodo/Lorenz Final Code/LorenzDataGenerator.m", "sha256": "7295d55fa3e1209b74b4804f9de18f4952950020f32d0f318695286c5ccdfa1d", "match": true}, + {"key": "narma.length5", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length5.mat", "sha256": "dc6e7914d216a21f664adcd4843e9f705616df47511879ba0bbeceb241b9b50a", "match": true}, + {"key": "narma.length10", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length10.mat", "sha256": "ceca1f6e94f3239b2df072403a488f8929fe00673b5028319cd2094d6eae708e", "match": true}, + {"key": "narma.length20", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length20.mat", "sha256": "aeb87fcec7655ce72386fdc28f2878b1f7b89097db523ab9fe5812fb6c4d1ee6", "match": true}, + {"key": "narma.length50", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/Length50.mat", "sha256": "ff4c9d14abb6f64b1ab9f301072dc67316b7fd59fe61d0b7632ee467a8c2aae3", "match": true}, + {"key": "narma.train_signal", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/trainSignal.mat", "sha256": "48e8e2c775fda4ca85dfc14a3c202319d9c75e2d7db0baf237744ce51a4b02c1", "match": true}, + {"key": "narma.test_signal", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/testSignal.mat", "sha256": "f0e34c5733e2cc20852caf4874b92bcb19fcb95bd4da4ce0eb7f4919cabee8c1", "match": true}, + {"key": "narma.results", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/HyperParameterOptimizationVariablesToPlot.mat", "sha256": "6311b719d47bfa92b76e1c71b3e9fe0e2e30d564d9ee7c7b2f231a03683e66fd", "match": true}, + {"key": "narma.parallel_results", "path": "data/raw/Codes for Zenodo/NARMA Final Code/Parallel Reservoir/ParallelReservoirDataToPlot.mat", "sha256": "ccf13dd5045a50ce5e474915225f4961d6e56b949985ef701bffe3316822f1c6", "match": true}, + {"key": "lorenz.data1", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzData1.mat", "sha256": "6229d996681ef7e64336ef4f04e7bd82c0a8063e6e18e52667c699251091f6c4", "match": true}, + {"key": "lorenz.data2", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzData2.mat", "sha256": "d1c0dcccbee809e8880dd5b0e355dd456ab1605d0470dbfa99e1a54b2b51073a", "match": true}, + {"key": "lorenz.fig43", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data.mat", "sha256": "f6055bc6b79cc686a5c7cca703fdf2e35de50e202e245bfe07f10f91ecad3500", "match": true}, + {"key": "lorenz.fig25", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data25Nodes.mat", "sha256": "0d85b0eaef9c6bb4eed07a3fe8f395802afbde0c3a75403ba216b55220754205", "match": true}, + {"key": "lorenz.fig13", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/Figure5_Data13Nodes.mat", "sha256": "74988e19bd24540b0f623e20295a2813a0206917cdf6072d0dfaf69f8d091ed7", "match": true}, + {"key": "lorenz.nrmse43", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs.mat", "sha256": "514ba3082a21eb541e0af8a9fbb80596742f9ddafee466391a00842a5d4e5616", "match": true}, + {"key": "lorenz.nrmse25", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs25Nodes.mat", "sha256": "881e92a0a5cd6b46fb588b41593e83d66ec2af25d16fb7198444fc82c3aaf14d", "match": true}, + {"key": "lorenz.nrmse13", "path": "data/raw/Codes for Zenodo/Lorenz Final Code/LorenzNormalizedNRMSEs13Nodes.mat", "sha256": "5f2d18b150d5baa9e792aa967d46a541a6031ff2805467ba30b72db745d55733", "match": true} + ], + "verdict": "PASS" +}, + "g2-narma-N1a": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1a", + "negative_control": false, + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v1 code: [V, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "f368e483d05af5eb68ebad942bb21c07d554a8fdf8b1155f50bc9e2450555e50", "steps": 199990, "run_id": "59b71c583cb90ca5982e88e218abc6040fb9567aa5700834bef69b7f7792be2b"}, {"split": "test", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "ba7a43dea472d0ce223a02335acd9eaea3bb98b00316c51fa236580a916ba0c7", "steps": 199990, "run_id": "f637d716732841d47d724a55855f48badd4688d9d5d2f548e241ac7727278e16"}], + "fit": {"rows_1based": [100, 995], "columns": 11, "columns_dropped_zero": [8, 9], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -8.8667496889673835e-16, "design_min_pivot_column": 7, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.030174555999207979, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.071346038631669509, "nrmse_omega": 0.4082975651409958, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.071784948216767799, "nrmse_omega": 0.42492037102690028, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.038525432403273829, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.051827716707148926, "nrmse_omega": 0.41925059946868493, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.049957996811968858, "nrmse_omega": 0.44896335034236551, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.036255734808217963, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.042167597063641031, "nrmse_omega": 0.52179708340611675, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.041124287527688236, "nrmse_omega": 0.54448359858024742, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.05155978646047811, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.024754818289879313, "nrmse_omega": 0.58528169707318778, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.026049478131157912, "nrmse_omega": 0.61335136701843285, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.06682024537974797, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.087043109748080966, "nrmse_omega": 0.58289724560327549, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.090663197305839771, "nrmse_omega": 0.61970852051926328, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.081309422699841927, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.065795068820320893, "nrmse_omega": 0.5924142848736822, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.067974795407398883, "nrmse_omega": 0.62238614296524197, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.10632941842243072, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.10101926996753294, "nrmse_omega": 0.56017304993449479, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.10206369958217575, "nrmse_omega": 0.6089475787987042, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.097865405108893661, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.16807750158058452, "nrmse_omega": 0.5512816316469642, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.18030826923098939, "nrmse_omega": 0.62470372806358299, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.088851880564151511, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.25523167323793849, "nrmse_omega": 0.64169783288868254, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.23703687327531672, "nrmse_omega": 0.66073063881370431, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-N1b": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1b", + "negative_control": false, + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v2 code: [V, V^2, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "f368e483d05af5eb68ebad942bb21c07d554a8fdf8b1155f50bc9e2450555e50", "steps": 199990, "run_id": "59b71c583cb90ca5982e88e218abc6040fb9567aa5700834bef69b7f7792be2b"}, {"split": "test", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "ba7a43dea472d0ce223a02335acd9eaea3bb98b00316c51fa236580a916ba0c7", "steps": 199990, "run_id": "f637d716732841d47d724a55855f48badd4688d9d5d2f548e241ac7727278e16"}], + "fit": {"rows_1based": [100, 995], "columns": 21, "columns_dropped_zero": [8, 9, 18, 19], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.081112764943575652, 0.081091531814583728, 0.041298763507715754, 0.041287270502294228, 0.018902550748144085, 0.018900125044228985, 0.0078747786141906313, 0.0078747785772953077, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -1.0391237175191562e-14, "design_min_pivot_column": 15, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-N1b-v2": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "N1b-v2", + "negative_control": false, + "reference_results": "Zenodo record 20277956 (version 2), sha256 317af7a7...fc92", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v2 code: [V, V^2, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "f368e483d05af5eb68ebad942bb21c07d554a8fdf8b1155f50bc9e2450555e50", "steps": 199990, "run_id": "59b71c583cb90ca5982e88e218abc6040fb9567aa5700834bef69b7f7792be2b"}, {"split": "test", "status": "OK", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "ba7a43dea472d0ce223a02335acd9eaea3bb98b00316c51fa236580a916ba0c7", "steps": 199990, "run_id": "f637d716732841d47d724a55855f48badd4688d9d5d2f548e241ac7727278e16"}], + "fit": {"rows_1based": [100, 995], "columns": 21, "columns_dropped_zero": [8, 9, 18, 19], "column_rms": [0.28479969998048166, 0.28476558647187128, 0.20321835147091502, 0.2031925360918847, 0.13748611953709719, 0.13747769192282422, 0.088739949370002597, 0.088739949162118054, 0.081112764943575652, 0.081091531814583728, 0.041298763507715754, 0.041287270502294228, 0.018902550748144085, 0.018900125044228985, 0.0078747786141906313, 0.0078747785772953077, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.0010312096332095256, 0.00078084139635636667, 0.00026706407689009712, 5.1794072506208846e-09, 0], "design_min_pivot_ratio": -1.0391237175191562e-14, "design_min_pivot_column": 15, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.34212972603646297, "nrmse_recomputed_from_archived_predictions": 0.34212972603646297, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.35672232160044881, "nrmse_recomputed_from_archived_predictions": 0.35672232160044881, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.3757432778088296, "nrmse_recomputed_from_archived_predictions": 0.37574327780882932, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42209287432529125, "nrmse_recomputed_from_archived_predictions": 0.42209287432529158, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.4898052426855502, "nrmse_recomputed_from_archived_predictions": 0.48980524268555009, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52904832026137327, "nrmse_recomputed_from_archived_predictions": 0.52904832026137205, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56521559154562295, "nrmse_recomputed_from_archived_predictions": 0.56521559154562295, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59545570968467709, "nrmse_recomputed_from_archived_predictions": 0.59545570968467743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56440810632257798, "nrmse_recomputed_from_archived_predictions": 0.56440810632257832, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.60784256781680046, "nrmse_recomputed_from_archived_predictions": 0.60784256781679991, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57175555791374966, "nrmse_recomputed_from_archived_predictions": 0.57175555791374977, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.60472348077546945, "nrmse_recomputed_from_archived_predictions": 0.604723480775469, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.53927320240957921, "nrmse_recomputed_from_archived_predictions": 0.53927320240957888, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58301429749824274, "nrmse_recomputed_from_archived_predictions": 0.58301429749824274, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.50599927037023351, "nrmse_recomputed_from_archived_predictions": 0.50599927037023351, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58068897454997703, "nrmse_recomputed_from_archived_predictions": 0.58068897454997714, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": false, "qr_sensitivity_rel_1e-6": -1, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.56507547934173019, "nrmse_recomputed_from_archived_predictions": 0.56507547934172986, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59844584988444183, "nrmse_recomputed_from_archived_predictions": 0.59844584988444205, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-narma-NC-N": { + "schema": "omega-reservoir-g2/1", + "case": "G2-N1", + "variant": "NC-N", + "negative_control": "NC-N: permittivity x 2.1", + "reference_results": "Zenodo record 17296788 (version 1, pinned)", + "grid_cell": {"nodes": 5, "current_hi_a": 1e-10, "mask_length": 2, "spatial_option0": 5, "condition": 7}, + "features": "v1 code: [V, u] (node-major, M per node)", + "topology": {"edges": 4, "ground_1based": 5, "symmetric": true, "inex_all_1": true, "same_config_id_as_omega_chain": true}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849981e-11, + "inputs": {"knots": 20000, "knot_spacing_s": 1e-4, "max_rel_binary32_rounding": 5.7418757096525828e-08, "max_time_grid_deviation_s": 2.2204460492503131e-16, "total_nonground_current_min_a": 1.9999999999999998e-10, "total_nonground_current_max_a": 2.0000000000000003e-10, "mask_bits_train": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_bits_test": [[0, 1], [0, 1], [1, 0], [1, 0], [0, 1]], "mask_inconsistent_slots": [0, 0], "masks_equal_train_test": true}, + "runs": [{"split": "train", "status": "OK", "config_id": "9b4f85e62fe6c654c72cbd16af98906d00325e5291752ed8db1b4f5a66f72f7d", "input_digest": "df893b2fbd4f35f3c88fe2757fc42920142a9111b199d69a251b9fdbc6733726", "final_state_digest": "cdd2fbcb2c2e6a3471b0cec80ff03981e6cfb6878d7b098da1a431a3c70a23b8", "steps": 199990, "run_id": "1b247a3614eb2e25c31650a305ae85d3d721b6f84d4eb95caaf3a68a07b9210a"}, {"split": "test", "status": "OK", "config_id": "9b4f85e62fe6c654c72cbd16af98906d00325e5291752ed8db1b4f5a66f72f7d", "input_digest": "ce65ed4dc3ff24f8d5e4a4fd780dacb25fbc064ef473ece385ae11e0aa1188e0", "final_state_digest": "826de3ef40a5f5864aefa7a6a36343a18cc81709894f238240b7a46291fcc6c7", "steps": 199990, "run_id": "017e9ef83f6a9e7c8b19d54183c80fa8dd99d9e39d72551cb414d320500c1e34"}], + "fit": {"rows_1based": [100, 995], "columns": 11, "columns_dropped_zero": [8, 9], "column_rms": [0.28281174055156366, 0.28281628353587512, 0.20321131619574898, 0.2031993686267953, 0.13748398253100727, 0.13748004230220626, 0.088739949602833337, 0.088739949569571847, 0.28361626152037661], "node_last_minus_first_subpulse_rms": [0.00048185509923250356, 0.00036146317985545742, 0.00012208597049850114, 4.9656676411952087e-09, 0], "design_min_pivot_ratio": -3.1871632754762049e-14, "design_min_pivot_column": 8, "readout_refuses_at_or_below": 1e-13, "solver": "omega_res_readout_fit lambda=0"}, + "tolerances": {"target_max_abs": 1e-12, "prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "orders": [ + {"order": 2, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.084845965527646491, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.40212725398016463, "nrmse_recomputed_from_archived_predictions": 0.40212725398016369, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.20261555724970445, "nrmse_omega": 0.44427054500744495, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.42130880903441947, "nrmse_recomputed_from_archived_predictions": 0.42130880903441897, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.2094245280755711, "nrmse_omega": 0.45957384020604236, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 3, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.11275711362119771, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.41650739320858304, "nrmse_recomputed_from_archived_predictions": 0.41650739320858282, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.24540970591917818, "nrmse_omega": 0.48467306371343988, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.44718383830164649, "nrmse_recomputed_from_archived_predictions": 0.4471838383016466, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.25460120302443673, "nrmse_omega": 0.50366793096569729, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 4, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.12110175711311548, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52123747942738163, "nrmse_recomputed_from_archived_predictions": 0.52123747942738119, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.095145994722034402, "nrmse_omega": 0.5306698980292166, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.54612794604297754, "nrmse_recomputed_from_archived_predictions": 0.54612794604297743, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.09828480635245225, "nrmse_omega": 0.55275124169490342, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 5, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.10987273261837525, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58528231183243107, "nrmse_recomputed_from_archived_predictions": 0.5852823118324314, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.18148727438457207, "nrmse_omega": 0.60246693498758164, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61152683444649059, "nrmse_recomputed_from_archived_predictions": 0.61152683444649159, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.19557634394626272, "nrmse_omega": 0.63540827557145518, "b": false, "c": true}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 6, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.065472347681373111, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.57833850623583427, "nrmse_recomputed_from_archived_predictions": 0.57833850623583438, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.22537006473461652, "nrmse_omega": 0.62071755238249637, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61718642305351423, "nrmse_recomputed_from_archived_predictions": 0.61718642305351379, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.24524557186480686, "nrmse_omega": 0.65091005909839439, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 7, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.041725744247601552, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58899543874808513, "nrmse_recomputed_from_archived_predictions": 0.58899543874808524, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.2439653985447367, "nrmse_omega": 0.64486132067003721, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.61837828485669288, "nrmse_recomputed_from_archived_predictions": 0.61837828485669277, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.26521026152733379, "nrmse_omega": 0.6660196646252774, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 8, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.069868249721240297, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.55236280601388699, "nrmse_recomputed_from_archived_predictions": 0.55236280601388676, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.31952374474680378, "nrmse_omega": 0.64161014441869479, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.59792892445398893, "nrmse_recomputed_from_archived_predictions": 0.5979289244539886, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.34833599298599766, "nrmse_omega": 0.6906271050794609, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 9, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.066452291904202418, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.52503674715698823, "nrmse_recomputed_from_archived_predictions": 0.52503674715698823, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.40564177070692542, "nrmse_omega": 0.65471659030697049, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.6043408567465669, "nrmse_recomputed_from_archived_predictions": 0.60434085674656701, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.46454356173580913, "nrmse_omega": 0.72790893337788842, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false}, + {"order": 10, "fit_status": "ERR_SINGULAR", "qr_rank_ok": true, "qr_sensitivity_rel_1e-6": 0.086202916907868674, "train": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.58949918992370198, "nrmse_recomputed_from_archived_predictions": 0.5894991899237022, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.43962884930717694, "nrmse_omega": 0.69874579179209939, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "test": {"target_max_abs_diff": 0, "prediction_rms_diff_over_target_std": null, "nrmse_omega": null, "nrmse_reference": 0.62360119925587854, "nrmse_recomputed_from_archived_predictions": 0.62360119925587842, "qr_minus_ldl_max_abs_over_target_std": null, "qr_diagnostic": {"prediction_rms_diff_over_target_std": 0.44256020018194447, "nrmse_omega": 0.73476950955129439, "b": false, "c": false}, "a": true, "b": false, "c": false, "metric_control": true}, "pass": false} + ], + "fit_refused": true, + "verdict": "FAIL" +}, + "g2-lorenz-13": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 13, + "negative_control": false, + "topology": {"edges": 21, "ground_1based": 8, "inputs_1based": [1, 2, 13]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "df25d3dddb7c29264568c1ff76a17563c070d92679e141c6840870534ddcb261", "input_digest": "56ceab99932cf31553c5381f02b176e49d9f9117692df992a3fcdf628702ae1b", "final_state_digest": "1c161847e1fe5bc2c63439a576052e5629e09001efd26df8e5460e7d08884558", "steps": 4000000, "run_id": "41ef4d6b1b626237d1e06744dc288e19b363ea17e28d00bc85ea5c76b1f25d7a"}, {"split": "test", "status": "OK", "config_id": "df25d3dddb7c29264568c1ff76a17563c070d92679e141c6840870534ddcb261", "input_digest": "e9664d749d060949b6497344dee741b0a62abf1ca2170f6c4b5a4c40456d77c3", "final_state_digest": "646fab9ccafd1bb7493ec4c00b0639c67129819b7670aaba002fb4e5d638c73d", "steps": 4000000, "run_id": "031109588e5828d300a29c6e4b3c2b71fd9cca9ac1ad28920d2b0f7b30cd61ce"}], + "samples": [41799, 41434], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 1.0290338464308093, "refusals": 0, "seconds": 4.0}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.6779309256045213e-06, "nrmse_omega": 0.13185194128456668, "nrmse_reference": 0.13185188493046004, "nrmse_recomputed_from_archived_predictions": 0.13185188493045941, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 4.2563349548968077e-06, "nrmse_omega": 0.24421182079648276, "nrmse_reference": 0.24421216352562414, "nrmse_recomputed_from_archived_predictions": 0.24421216352562475, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.5528228282458204e-06, "nrmse_omega": 0.21755626207884349, "nrmse_reference": 0.21755696193907598, "nrmse_recomputed_from_archived_predictions": 0.2175569619390742, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.2282301031963498e-06, "nrmse_omega": 0.12451546821376215, "nrmse_reference": 0.12451570849444508, "nrmse_recomputed_from_archived_predictions": 0.12451570849444567, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 3.6529499212198346e-06, "nrmse_omega": 0.24351984109964653, "nrmse_reference": 0.2435199240683032, "nrmse_recomputed_from_archived_predictions": 0.24351992406830161, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 5.701730130867187e-06, "nrmse_omega": 0.22234237321907535, "nrmse_reference": 0.22234320116133482, "nrmse_recomputed_from_archived_predictions": 0.22234320116133552, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-25": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 25, + "negative_control": false, + "topology": {"edges": 51, "ground_1based": 14, "inputs_1based": [1, 2, 25]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "2a514ee079d134de8aca64e4ca233b5c78f3a9b8a0304903c1039d7b7ac3bb13", "input_digest": "0626a8e2353fb5c85f591c8701ea501e06a9675bed6093cfe83935a4f82d91b3", "final_state_digest": "0b5cda7f6935fd9f136107ad0a20b1651ff960de8df159ce85af8520bc5b9fde", "steps": 4000000, "run_id": "7db2026669d56e22c21aca5b455ef3149f2f2430003f53431305ee6e220ada7e"}, {"split": "test", "status": "OK", "config_id": "2a514ee079d134de8aca64e4ca233b5c78f3a9b8a0304903c1039d7b7ac3bb13", "input_digest": "feac7c9a4ec4f7a1681b71f3cbfee5f228c755cf0a2f2bfc0409eb77fd984036", "final_state_digest": "1faa7a988bef68793b54768ce5c22131c6d9898bb1494dde8b6144bf6739a074", "steps": 4000000, "run_id": "0c157ed75351ffe012e9e6c6ab65bbe8f659a3615f4d111dd1c2270145099fdc"}], + "samples": [41429, 43731], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 0.95152074743029957, "refusals": 0, "seconds": 12.3}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 9.0074195953873765e-06, "nrmse_omega": 0.085635033274452349, "nrmse_reference": 0.085635683608415267, "nrmse_recomputed_from_archived_predictions": 0.085635683608415017, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 9.4589079201945077e-06, "nrmse_omega": 0.15043380279448682, "nrmse_reference": 0.15043304740276905, "nrmse_recomputed_from_archived_predictions": 0.15043304740277, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 1.9804336161404809e-05, "nrmse_omega": 0.15168698197286534, "nrmse_reference": 0.15168866751085383, "nrmse_recomputed_from_archived_predictions": 0.15168866751085305, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.3507964841728149e-05, "nrmse_omega": 0.10987833389798819, "nrmse_reference": 0.10988946925009918, "nrmse_recomputed_from_archived_predictions": 0.10988946925009958, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 2.6761405747597162e-05, "nrmse_omega": 0.15555292799502499, "nrmse_reference": 0.15556076931299914, "nrmse_recomputed_from_archived_predictions": 0.15556076931299923, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.4520544070537604e-05, "nrmse_omega": 0.21719916026970959, "nrmse_reference": 0.21722040738225198, "nrmse_recomputed_from_archived_predictions": 0.21722040738225179, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-43": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 43, + "negative_control": false, + "topology": {"edges": 99, "ground_1based": 21, "inputs_1based": [1, 28, 42]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 1.85849999e-11, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "input_digest": "4c80c2b37b490da376d2494126297fc23ff6bdb23b9d44182812914f06996943", "final_state_digest": "f565163ca5d99043a06b8e850a033fb5dfed68df60214c229430c0a3fc0a1319", "steps": 4000000, "run_id": "5e3337e22791b4c5db8ce47e65cac307f977fb9eba8f380ed5f3e17b688902f0"}, {"split": "test", "status": "OK", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "input_digest": "fd817fb566f9950714119654dca44041775baef3010a2924cd791e8624cc4120", "final_state_digest": "deff9e9195718b66f5aa2f0e265ce69b8f8db8809e337c569889e22893aa9c11", "steps": 4000000, "run_id": "06480903b1da1b9024a121463f4f9f50ec533e821ce4b3ef138b910bcbc1edcb"}], + "samples": [55134, 55425], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.033000000000000002, "chosen_index": 0, "score": 0.76982002885655965, "refusals": 0, "seconds": 45.8}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 4.2906126913349232e-06, "nrmse_omega": 0.060711015436529334, "nrmse_reference": 0.060711004947326001, "nrmse_recomputed_from_archived_predictions": 0.060711004947326348, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 6.5843153532022146e-06, "nrmse_omega": 0.16688965541390674, "nrmse_reference": 0.16689036807691424, "nrmse_recomputed_from_archived_predictions": 0.16689036807691518, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 6.626529506618745e-06, "nrmse_omega": 0.1326272643692232, "nrmse_reference": 0.13262828337949442, "nrmse_recomputed_from_archived_predictions": 0.1326282833794947, "b": true, "c": true, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 3.8084805637807107e-05, "nrmse_omega": 0.070689752903937267, "nrmse_reference": 0.070683443536471213, "nrmse_recomputed_from_archived_predictions": 0.070683443536470714, "b": true, "c": true, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 8.3088264898468952e-05, "nrmse_omega": 0.18255285554463949, "nrmse_reference": 0.18251104749892025, "nrmse_recomputed_from_archived_predictions": 0.18251104749891892, "b": true, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.00010444957468807544, "nrmse_omega": 0.17374919900989022, "nrmse_reference": 0.17371107404319705, "nrmse_recomputed_from_archived_predictions": 0.17371107404319949, "b": true, "c": true, "metric_control": true}]} + ], + "verdict": "PASS" +}, + "g2-lorenz-13-NC-L": { + "schema": "omega-reservoir-g2/1", + "case": "G2-L1", + "nodes": 13, + "negative_control": "NC-L: NARMA permittivity 8.85e-12", + "topology": {"edges": 21, "ground_1based": 8, "inputs_1based": [1, 2, 13]}, + "step_s": 9.99999975e-06, "steps_per_knot": 10, "permittivity_f_per_m": 8.84999973e-12, + "archive_checks": {"t_from_0_to_40": true, "Ytrain_equals_LorenzData1_X": true, "Ytest_equals_LorenzData2_X": true, "figure_nrmse_equals_nrmse_file": true}, + "inputs": {"knots": 400001, "knot_spacing_s": 1e-4, "resampling_and_rounding_max_abs_a": [9.4307252804161519e-15, 2.2758187103930696e-14, 4.7397672217817037e-14], "relative_to_max_abs_current": [3.0867725601831943e-05, 5.9039068293755798e-05, 4.8289642555671456e-05]}, + "runs": [{"split": "train", "status": "OK", "config_id": "cd223bfd7c646b968897c3f9cbe9883a1918e75b94fb7fd036383bd11063befa", "input_digest": "56ceab99932cf31553c5381f02b176e49d9f9117692df992a3fcdf628702ae1b", "final_state_digest": "b087e7d3825255ecf0af5c5651477bbda0bfde2ee930de4a2b8d036e3ad5fcda", "steps": 4000000, "run_id": "727a19466743876f776eaa6f20cf694d979ceffdbf26fd23e0c2e22896c68539"}, {"split": "test", "status": "OK", "config_id": "cd223bfd7c646b968897c3f9cbe9883a1918e75b94fb7fd036383bd11063befa", "input_digest": "e9664d749d060949b6497344dee741b0a62abf1ca2170f6c4b5a4c40456d77c3", "final_state_digest": "6dee871396778c63014f115b282ca6e62dcee26fb70d7e4229654fa9e9dc2f77", "steps": 4000000, "run_id": "e72303f53be4f87472eabbcc64149f0ca3ef1f345098f07ff9c1df1c231b4213"}], + "samples": [41799, 41434], + "cv": {"grid": "linspace(0.033, 0.035, 101)", "folds": 5, "chosen_lambda": 0.035000000000000003, "chosen_index": 100, "score": 0.96820228660346452, "refusals": 0, "seconds": 4.0}, + "final_fit_status": "OK", + "tolerances": {"prediction_rms_over_target_std": 0.01, "nrmse_abs": 0.005, "nrmse_rel": 0.05, "metric_recompute_rel": 1e-09}, + "splits": [ + {"split": "train", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 0.12334698699418173, "nrmse_omega": 0.18105136362146079, "nrmse_reference": 0.13185188493046004, "nrmse_recomputed_from_archived_predictions": 0.13185188493045941, "b": false, "c": false, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 0.18891360251047917, "nrmse_omega": 0.24438168281512779, "nrmse_reference": 0.24421216352562414, "nrmse_recomputed_from_archived_predictions": 0.24421216352562475, "b": false, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.14232176254261994, "nrmse_omega": 0.24041001761529973, "nrmse_reference": 0.21755696193907598, "nrmse_recomputed_from_archived_predictions": 0.2175569619390742, "b": false, "c": false, "metric_control": true}]}, + {"split": "test", "variables": [{"var": "x", "prediction_rms_diff_over_target_std": 0.12173830815045711, "nrmse_omega": 0.16663976581646051, "nrmse_reference": 0.12451570849444508, "nrmse_recomputed_from_archived_predictions": 0.12451570849444567, "b": false, "c": false, "metric_control": true}, {"var": "y", "prediction_rms_diff_over_target_std": 0.19346650673670593, "nrmse_omega": 0.23764160623801833, "nrmse_reference": 0.2435199240683032, "nrmse_recomputed_from_archived_predictions": 0.24351992406830161, "b": false, "c": true, "metric_control": true}, {"var": "z", "prediction_rms_diff_over_target_std": 0.13767034003122394, "nrmse_omega": 0.24403675855931492, "nrmse_reference": 0.22234320116133482, "nrmse_recomputed_from_archived_predictions": 0.22234320116133552, "b": false, "c": false, "metric_control": true}]} + ], + "verdict": "FAIL" +}, + "bench-narma": { + "schema": "omega-reservoir-bench-narma/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "seeds": [1, 2, 3, 4, 5], + "setup": {"train_inputs": 2000, "test_inputs": 1000, "washout": 100, "subpulses": 3, "subpulse_s": 1e-3, "current_hi_a": 1e-10, "delay_line": 12, "lambda_grid": [1e-6, 1e2, 9], "folds": 5, + "networks": [{"name": "Length50 chain (declared)", "driven_nodes": 49, "nodes_connected": 50, "nodes_disconnected": 58}, {"name": "Length5 chain (post hoc, section 10.1)", "driven_nodes": 4, "nodes_connected": 5, "nodes_disconnected": 7}], + "rc_squared_states": "NOT_RUN (50-node chain: 295 features > readout bound 256)"}, + "wall_s": 13.6, + "per_seed": [ + {"seed": 1, "runs": [{"run": "chain50 connected/train", "status": "ERR_RANGE", "stopped_at_step": 347}, {"run": "chain50 connected/test", "status": "ERR_RANGE", "stopped_at_step": 353}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "6c9e5695f21ae00e1c436ec981d0a3f06f25c59b224a67745b1e93e518496ecb", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 600000}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "7fd0c1223c50dfdb0a09b015990c6a1bfe1e77ea479c1ec83440a348f73ab425", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 300000}, {"run": "chain5 connected/train", "status": "OK", "run_id": "858ba0fb5cd5b2763086e74d1d03ea9d7d1689ed785514ecfe384185c3ab3879", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 600000}, {"run": "chain5 connected/test", "status": "OK", "run_id": "b4efbf4ecfbdbe1f4bc0fc3a6a3739d1f70d21daf0f9e801dbcd654ce7374c28", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 300000}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "b2fcfe1bba417d99211b1b83a7acca66e32045cfe1b7f67aa9703558424d9c54", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 600000}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "fe134046e434cd191e8127cbf15a319b29e9bcd5970fef66bc9c7dd472082c5d", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 300000}], + "mask_starts": [3, 1, 1, 2, 3, 2, 1, 0, 2, 2, 3, 1, 1, 3, 0, 3, 1, 0, 3, 1, 0, 0, 0, 0, 0, 0, 1, 3, 3, 1, 3, 1, 1, 0, 1, 0, 1, 1, 3, 1, 3, 1, 0, 1, 0, 1, 0, 3, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.09277361939, "test_nrmse": [0.08786107364], "train_nrmse": [0.08799828805]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4710253888, "test_nrmse": [0.469133367], "train_nrmse": [0.4578337851]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5396438795, "test_nrmse": [0.5037944144], "train_nrmse": [0.5105190586]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3419059217, "test_nrmse": [0.3308543887], "train_nrmse": [0.3374722795]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3754704188, "test_nrmse": [0.3632729947], "train_nrmse": [0.3669233695]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.485845992, "test_nrmse": [0.482380122], "train_nrmse": [0.4855894221]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.007585350791, "test_nrmse": [0.006900438801], "train_nrmse": [0.006826461776]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.01950367964, "test_nrmse": [0.02096349451], "train_nrmse": [0.01776206999]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3621309005, "test_nrmse": [0.3627751451], "train_nrmse": [0.3610099142]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-05, "cv_score": 0.2620656917, "test_nrmse": [0.2603101122], "train_nrmse": [0.2584801904]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4933038241, "test_nrmse": [0.4805719641], "train_nrmse": [0.4843477514]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6399829255, "test_nrmse": [0.6183255536], "train_nrmse": [0.6289241012]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.227571874, "test_nrmse": [0.2216061226], "train_nrmse": [0.223971945]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4982236262, "test_nrmse": [0.4896305425], "train_nrmse": [0.4902044397]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-05, "cv_score": 0.55956109, "test_nrmse": [0.5248249923], "train_nrmse": [0.5383773994]}]}, + {"seed": 2, "runs": [{"run": "chain50 connected/train", "status": "ERR_RANGE", "stopped_at_step": 359}, {"run": "chain50 connected/test", "status": "ERR_RANGE", "stopped_at_step": 352}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "9566ea4dfc40cfbf606f13ca466b5448eed709ae26f15f98095c2320496335b1", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 600000}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "86a720ff3ee63df77c0e69d9fea8a4a47d053b2c332e4eec6f81478e2a9a0f4d", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 300000}, {"run": "chain5 connected/train", "status": "OK", "run_id": "68eb9132bfd4fe643cb2fe955acc574d5dfd43fa05f3b73151a2c444f36f2f8f", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 600000}, {"run": "chain5 connected/test", "status": "OK", "run_id": "b0425c032b1fdbe413f676c79962557d8815511a680a135ad6c3acbdd9a221ea", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 300000}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "feba7bccdd9c3a42fd73e32abf25536445f91c3acc9e8bb005b426aa82d92c37", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 600000}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "841b3db2ecda0f8b8c342b6a05e3f2e8079eb259c37cdb6174f1aa60765744c9", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 300000}], + "mask_starts": [3, 0, 3, 2, 3, 1, 0, 3, 3, 2, 0, 1, 1, 0, 2, 0, 1, 1, 3, 2, 1, 2, 2, 1, 3, 0, 0, 1, 2, 0, 0, 2, 3, 2, 1, 1, 3, 3, 0, 0, 1, 3, 2, 1, 3, 1, 1, 3, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.0892277926, "test_nrmse": [0.08378865244], "train_nrmse": [0.08422441817]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4980438453, "test_nrmse": [0.4772924387], "train_nrmse": [0.4812865797]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5531538897, "test_nrmse": [0.5371217049], "train_nrmse": [0.5206612866]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3453865964, "test_nrmse": [0.3369084832], "train_nrmse": [0.3389245463]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3837854171, "test_nrmse": [0.3781031734], "train_nrmse": [0.3741020659]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.4988131829, "test_nrmse": [0.4264527505], "train_nrmse": [0.4794149213]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.00664632411, "test_nrmse": [0.006812708542], "train_nrmse": [0.006147402486]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 1, "cv_score": 0.02245848485, "test_nrmse": [0.01945966509], "train_nrmse": [0.02089767522]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3551178842, "test_nrmse": [0.3016273467], "train_nrmse": [0.3385106553]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.1924648727, "test_nrmse": [0.1842624899], "train_nrmse": [0.1891474998]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4759908842, "test_nrmse": [0.4567492805], "train_nrmse": [0.4650799588]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6382271375, "test_nrmse": [0.575347216], "train_nrmse": [0.6068879611]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2337337221, "test_nrmse": [0.2268281735], "train_nrmse": [0.2287779334]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5434287123, "test_nrmse": [0.5344376521], "train_nrmse": [0.5308700308]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5688446454, "test_nrmse": [0.5529571051], "train_nrmse": [0.5428327615]}]}, + {"seed": 3, "runs": [{"run": "chain50 connected/train", "status": "ERR_RANGE", "stopped_at_step": 334}, {"run": "chain50 connected/test", "status": "ERR_RANGE", "stopped_at_step": 316}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "2bc4cd72039c197e3792b2c26e0c1e5dd4ab1448a40d10938d7cab9ee6ae3176", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 600000}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "94d02efcac6fa33ebcc9c0b1cd423d55c992a483001fe7a835cf36ca787e8e9f", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 300000}, {"run": "chain5 connected/train", "status": "OK", "run_id": "d93d8e3cd9730691d2c46e64c017d906995a533791de5d7941ab668deeb25669", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 600000}, {"run": "chain5 connected/test", "status": "OK", "run_id": "186a0cd0defb9d6113fb4db0fd7d95694acd53a777b1c0b130c80e41e3ba427b", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 300000}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "3ec6502210dfe0eed43c83585f2f0e235743ee7e02aa189b12878983bbc9173c", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 600000}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "8a1b18b7eb04986f61f85c40642e9fa033fcd2e5aa284f10157032deafbb5c41", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 300000}], + "mask_starts": [0, 0, 0, 0, 0, 1, 3, 0, 1, 0, 2, 0, 0, 1, 2, 0, 2, 1, 3, 3, 2, 0, 0, 0, 0, 1, 0, 3, 2, 2, 2, 0, 0, 1, 3, 2, 3, 0, 2, 0, 1, 0, 1, 3, 0, 3, 3, 2, 1], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.09936655559, "test_nrmse": [0.09692048451], "train_nrmse": [0.09240259534]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4844420712, "test_nrmse": [0.520256801], "train_nrmse": [0.4734097692]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-05, "cv_score": 0.5852221985, "test_nrmse": [0.5356537811], "train_nrmse": [0.5597601725]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.3372350139, "test_nrmse": [0.3414940773], "train_nrmse": [0.3322909289]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3606396033, "test_nrmse": [0.4020133303], "train_nrmse": [0.3568767877]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 10, "cv_score": 0.4907835312, "test_nrmse": [0.4363563291], "train_nrmse": [0.4767261307]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.007316679612, "test_nrmse": [0.006672889301], "train_nrmse": [0.006814461844]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.0187869666, "test_nrmse": [0.01808261188], "train_nrmse": [0.01721309243]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.3224716052, "test_nrmse": [0.2739311505], "train_nrmse": [0.3052334979]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 0.0001, "cv_score": 0.1892294488, "test_nrmse": [0.1910781812], "train_nrmse": [0.1852750268]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4644493719, "test_nrmse": [0.4918292655], "train_nrmse": [0.4594082399]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6468139787, "test_nrmse": [0.5835348555], "train_nrmse": [0.6216632851]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.236841755, "test_nrmse": [0.2356812013], "train_nrmse": [0.2309353761]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5320920293, "test_nrmse": [0.5686496242], "train_nrmse": [0.5255399415]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6106700875, "test_nrmse": [0.5652678105], "train_nrmse": [0.5898350173]}]}, + {"seed": 4, "runs": [{"run": "chain50 connected/train", "status": "ERR_RANGE", "stopped_at_step": 377}, {"run": "chain50 connected/test", "status": "ERR_RANGE", "stopped_at_step": 342}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "685175410554383b88ffbd34ac113e378e7fcd8f7f001e64844c3b09b887e37b", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 600000}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "549e7f11c009d663f3b2c10dc18cad725c94de90477dbdf785f12b2bcf93e931", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 300000}, {"run": "chain5 connected/train", "status": "OK", "run_id": "d248778235056759f524304a72eb91f3a79bf00fcebc64a460c2b9f2394b9b80", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 600000}, {"run": "chain5 connected/test", "status": "OK", "run_id": "e7d9ff7984df642b02185592238b0ab365ba7b4d9aa49dc9202d0db795847d68", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 300000}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "e49d3f020fbe8b52a425e7509a459ff7b8c20e57d71ff272863473e5844f771c", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 600000}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "2bde157258c9844c8f550ecc5d41236b1c06ac4300b03689ffd18fc206e000a0", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 300000}], + "mask_starts": [1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 3, 2, 2, 1, 2, 0, 1, 3, 0, 1, 1, 1, 1, 1, 2, 0, 1, 0, 3, 0, 3, 1, 1, 2, 3, 0, 1, 2, 2, 0, 2, 0, 2, 0, 3, 0, 0, 3, 0], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.08745686002, "test_nrmse": [0.08604368951], "train_nrmse": [0.08282354434]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4882992819, "test_nrmse": [0.4895965926], "train_nrmse": [0.4758403263]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5697082122, "test_nrmse": [0.5393070622], "train_nrmse": [0.5517413487]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3297981301, "test_nrmse": [0.3321421529], "train_nrmse": [0.324981227]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3693658749, "test_nrmse": [0.3807900357], "train_nrmse": [0.365227314]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.4766971955, "test_nrmse": [0.4317717154], "train_nrmse": [0.4692023352]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.006934466436, "test_nrmse": [0.006665074895], "train_nrmse": [0.006399829523]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.01, "cv_score": 0.01715176422, "test_nrmse": [0.01667323179], "train_nrmse": [0.01612486502]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.2966962358, "test_nrmse": [0.276430195], "train_nrmse": [0.2816354521]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2388202484, "test_nrmse": [0.2390963224], "train_nrmse": [0.2342126145]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.4991837071, "test_nrmse": [0.5031310798], "train_nrmse": [0.4916590275]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5901224481, "test_nrmse": [0.5514399242], "train_nrmse": [0.576200865]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.1907171358, "test_nrmse": [0.1905480529], "train_nrmse": [0.1865195662]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.518530796, "test_nrmse": [0.5232308691], "train_nrmse": [0.5104706468]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6120434652, "test_nrmse": [0.5753290635], "train_nrmse": [0.600399365]}]}, + {"seed": 5, "runs": [{"run": "chain50 connected/train", "status": "ERR_RANGE", "stopped_at_step": 360}, {"run": "chain50 connected/test", "status": "ERR_RANGE", "stopped_at_step": 346}, {"run": "chain50 disconnected/train", "status": "OK", "run_id": "6539e95dd41f248e18647e49fd3d34fd21f062e3a2e1e1000d2ef5ee80d63c5c", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 600000}, {"run": "chain50 disconnected/test", "status": "OK", "run_id": "251914fa779f220e9e0def2b46afe1f166f4f1ce8d72bf1dc1b739a6aa0066c5", "config_id": "bd7501974840ff5e5eac97d4a0287ba321cdceaedf48a9d1df194d67a6493b42", "steps": 300000}, {"run": "chain5 connected/train", "status": "OK", "run_id": "72d1acaf4a6735f4404a1f2781f54e7fadd2909f86a2dcff533912c7ea831f24", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 600000}, {"run": "chain5 connected/test", "status": "OK", "run_id": "493d25fbf94033b979c8c3531e974ced8c226395c6a307d58a47cac752d15b69", "config_id": "e6bda8c37bb9df4d2a5ca34d18ee093e5af65e56ae6d5bf31168c1fc09f8406d", "steps": 300000}, {"run": "chain5 disconnected/train", "status": "OK", "run_id": "b3f7f194a415f3efb30d6a6bbba28f0bf6a1085679748b217bfac13568e5ba5a", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 600000}, {"run": "chain5 disconnected/test", "status": "OK", "run_id": "773e07e517bed42c49256ffca94911f8ba32ff4764af7f5e710900aa14cfd2d0", "config_id": "054e09a76a6985a448562edfe485674b7f522fa4b70425e0119cbde576161734", "steps": 300000}], + "mask_starts": [3, 1, 3, 2, 2, 1, 3, 3, 2, 0, 0, 0, 1, 3, 3, 3, 0, 2, 3, 2, 0, 3, 1, 2, 2, 2, 2, 3, 2, 3, 2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 0, 1, 1, 3, 1, 1, 0, 1, 2], + "fits": [{"model": "RC-connected", "task": "NARMA-2", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-5", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-connected", "task": "NARMA-10", "features": 148, "status": "ERR_RANGE", "lambda": null, "cv_score": null, "test_nrmse": [null], "train_nrmse": [null]}, + {"model": "RC-disconnected", "task": "NARMA-2", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.08939652677, "test_nrmse": [0.08347072062], "train_nrmse": [0.08351300589]}, + {"model": "RC-disconnected", "task": "NARMA-5", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.4906024556, "test_nrmse": [0.4987558858], "train_nrmse": [0.4788778171]}, + {"model": "RC-disconnected", "task": "NARMA-10", "features": 148, "status": "OK", "lambda": 1e-06, "cv_score": 0.5739087458, "test_nrmse": [0.6064830129], "train_nrmse": [0.5518554379]}, + {"model": "BL-linear", "task": "NARMA-2", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3362966399, "test_nrmse": [0.3292238732], "train_nrmse": [0.3330530735]}, + {"model": "BL-linear", "task": "NARMA-5", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.3773911824, "test_nrmse": [0.3802789034], "train_nrmse": [0.3708097818]}, + {"model": "BL-linear", "task": "NARMA-10", "features": 12, "status": "OK", "lambda": 1, "cv_score": 0.4927890287, "test_nrmse": [0.4541392886], "train_nrmse": [0.4836047558]}, + {"model": "BL-quadratic", "task": "NARMA-2", "features": 90, "status": "OK", "lambda": 1e-06, "cv_score": 0.006738429948, "test_nrmse": [0.007145417979], "train_nrmse": [0.00626322936]}, + {"model": "BL-quadratic", "task": "NARMA-5", "features": 90, "status": "OK", "lambda": 0.1, "cv_score": 0.0203990545, "test_nrmse": [0.01910807781], "train_nrmse": [0.01873415987]}, + {"model": "BL-quadratic", "task": "NARMA-10", "features": 90, "status": "OK", "lambda": 10, "cv_score": 0.320981522, "test_nrmse": [0.2777624689], "train_nrmse": [0.3069012649]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2847094106, "test_nrmse": [0.2742085547], "train_nrmse": [0.2817847979]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.484810652, "test_nrmse": [0.4967548449], "train_nrmse": [0.4782832282]}, + {"model": "RC-connected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.6227429669, "test_nrmse": [0.6227520761], "train_nrmse": [0.6095545713]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-2", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.2290507623, "test_nrmse": [0.2260737818], "train_nrmse": [0.2256089333]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-5", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5297829067, "test_nrmse": [0.5529306479], "train_nrmse": [0.5216730956]}, + {"model": "RC-disconnected-5 (post hoc)", "task": "NARMA-10", "features": 13, "status": "OK", "lambda": 1e-06, "cv_score": 0.5937959237, "test_nrmse": [0.6178223209], "train_nrmse": [0.5791827822]}]} + ], + "summary": [ + {"task": "NARMA-2", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.08761692414, "sd": 0.005498581173, "min": 0.08347072062, "max": 0.09692048451}, "BL-linear": {"seeds_ok": 5, "mean": 0.3341245951, "sd": 0.005017486977, "min": 0.3292238732, "max": 0.3414940773}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.006839305904, "sd": 0.0001976108446, "min": 0.006665074895, "max": 0.007145417979}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.2297911321, "sd": 0.04050448114, "min": 0.1842624899, "max": 0.2742085547}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.2201474664, "sd": 0.01731547676, "min": 0.1905480529, "max": 0.2356812013}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.00964366564, "sd": 0.04875488445, "min": -0.04460302015, "max": 0.04854826949}, "first_wins": 2, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.2229518262, "sd": 0.04037207882, "min": 0.1774497814, "max": 0.2670631368}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "NARMA-5", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.491007017, "sd": 0.01990056751, "min": 0.469133367, "max": 0.520256801}, "BL-linear": {"seeds_ok": 5, "mean": 0.3808916875, "sd": 0.01382663898, "min": 0.3632729947, "max": 0.4020133303}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.01885741621, "sd": 0.001599381453, "min": 0.01667323179, "max": 0.02096349451}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.485807287, "sd": 0.01822089045, "min": 0.4567492805, "max": 0.5031310798}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5337758672, "sd": 0.03018082663, "min": 0.4896305425, "max": 0.5686496242}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": -0.0479685802, "sd": 0.03191280064, "min": -0.07768837164, "max": -0.009058578404}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.4669498707, "sd": 0.01920161416, "min": 0.4372896154, "max": 0.486457848}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "NARMA-10", "test_nrmse": {"RC-connected": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "RC-disconnected": {"seeds_ok": 5, "mean": 0.5444719951, "sd": 0.03761148792, "min": 0.5037944144, "max": 0.6064830129}, "BL-linear": {"seeds_ok": 5, "mean": 0.4462200411, "sd": 0.02273245827, "min": 0.4264527505, "max": 0.482380122}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.2985052612, "sd": 0.0376225474, "min": 0.2739311505, "max": 0.3627751451}, "RC-connected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5902799251, "sd": 0.03007501165, "min": 0.5514399242, "max": 0.6227520761}, "RC-disconnected-5 (post hoc)": {"seeds_ok": 5, "mean": 0.5672402585, "sd": 0.03402545971, "min": 0.5248249923, "max": 0.6178223209}}, + "paired": [{"comparison": "RC-connected - RC-disconnected", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected - best baseline (by CV score)", "difference": {"seeds_ok": 0, "mean": null, "sd": null, "min": null, "max": null}, "first_wins": 0, "seeds_compared": 0}, {"comparison": "RC-connected-5 - RC-disconnected-5 (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.02303966662, "sd": 0.04335383271, "min": -0.02388913931, "max": 0.09350056134}, "first_wins": 1, "seeds_compared": 5}, {"comparison": "RC-connected-5 - best baseline (by CV score) (post hoc)", "difference": {"seeds_ok": 5, "mean": 0.2917746638, "sd": 0.03559824509, "min": 0.2555504085, "max": 0.3449896072}, "first_wins": 0, "seeds_compared": 5}]} + ], + "significance": "none claimed (five seeds)" +}, + "bench-lorenz": { + "schema": "omega-reservoir-bench-lorenz/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "seeds": [1, 2, 3, 4, 5], + "setup": {"dt": 1e-4, "discard_s": 20, "record_s": 20, "sample_s": 0.01, "rows": [200, 1975], "horizons_samples": [0, 1, 25], "lags": 5, "lambda_grid": [1e-6, 1e2, 9], "folds": 5, "nodes_connected": 43, "nodes_disconnected": 5}, + "wall_s": 64.7, + "per_seed": [ + {"seed": 1, "initial_state": {"train": [-2.274896506, 1.791977994, 12.45691834], "test": [-3.657091816, -5.870045965, 30.52625222]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "1e7c822596d4f75fbb0aa42ccf340308dc38e1bbe70d6284c69341ef164a676f", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "connected/test", "status": "OK", "run_id": "cff580c7b65ef33025a64f2bbc46a34754faed472f958963108f240ec11ec6d5", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "disconnected/train", "status": "OK", "run_id": "b76ff0412b7a7c4ddc58fc55231a52333236c853df5aff9806b2d2b87c000f5a", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}, {"run": "disconnected/test", "status": "OK", "run_id": "1e798a8cdceeae28d97e8705df487330d9eccd78d23a7665c28db58a0a581fa5", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.08945688751, "test_nrmse": [0.07359263531, 0.1983642405, 0.1441234229], "train_nrmse": [0.0171971677, 0.07285850471, 0.03642802097]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1007865811, "test_nrmse": [0.07269320845, 0.2654762348, 0.2324839187], "train_nrmse": [0.01732705298, 0.0782672966, 0.03814322131]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.857233252, "test_nrmse": [0.9133079319, 1.169408141, 0.8185145677], "train_nrmse": [0.6471173725, 0.822524602, 0.7722065285]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.01, "cv_score": 0.03626501438, "test_nrmse": [0.09362676228, 0.07075625905, 0.1238637511], "train_nrmse": [0.009062576725, 0.03212041513, 0.0140065768]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.01, "cv_score": 0.03801515551, "test_nrmse": [0.07409267841, 0.142812387, 0.09949889996], "train_nrmse": [0.008109847993, 0.03529237225, 0.0115469022]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.838337594, "test_nrmse": [1.033211697, 1.342038481, 0.8049694186], "train_nrmse": [0.6114714645, 0.7899053588, 0.7518024109]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 0.1, "cv_score": 0.5198559718, "test_nrmse": [0.5167007854, 0.7494103261, 0.2001947806], "train_nrmse": [0.5027757367, 0.7379862461, 0.2182594191]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.5440883707, "test_nrmse": [0.5451641401, 0.7850182292, 0.2029601042], "train_nrmse": [0.5297234444, 0.7696590167, 0.2239529408]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 100, "cv_score": 1.053174836, "test_nrmse": [1.018289721, 1.020504799, 0.8668311902], "train_nrmse": [0.973857817, 0.9966116129, 0.9086613244]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2786978126, "test_nrmse": [0.2645769779, 0.4671599595, 0.02934660464], "train_nrmse": [0.2633883111, 0.4656871868, 0.03420669285]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.311058963, "test_nrmse": [0.286655703, 0.493323045, 0.07662387758], "train_nrmse": [0.2845253148, 0.4857769351, 0.08371477415]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 0.978589519, "test_nrmse": [0.8813626175, 0.9733025984, 0.8388046344], "train_nrmse": [0.8282649135, 0.9421007528, 0.9000130726]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.287694116e-06, "test_nrmse": [5.500491867e-07, 1.228272513e-06, 1.134915499e-06], "train_nrmse": [5.529302614e-07, 1.240330485e-06, 1.180000537e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001521820671, "test_nrmse": [6.902794787e-06, 0.000181460546, 0.0001733835788], "train_nrmse": [6.9312679e-06, 0.0001829131962, 0.000180275434]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.7314239604, "test_nrmse": [0.494862637, 0.8074402796, 0.6993911383], "train_nrmse": [0.4775352856, 0.7865242038, 0.7170891947]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.42094615e-07, "test_nrmse": [1.617648858e-08, 1.038925105e-07, 6.309218425e-08], "train_nrmse": [1.603389825e-08, 1.11885002e-07, 6.448354555e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.107021847e-06, "test_nrmse": [2.902077541e-08, 1.063653507e-06, 8.90795779e-07], "train_nrmse": [3.097865877e-08, 1.130300854e-06, 9.790725323e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-05, "cv_score": 0.5735909823, "test_nrmse": [0.3001015031, 0.5413445573, 0.5095307488], "train_nrmse": [0.2940668079, 0.5339888969, 0.5354444901]}]}, + {"seed": 2, "initial_state": {"train": [-5.21362969, -9.581500709, 25.52929201], "test": [5.575480197, -6.987252888, 16.73490529]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "99fb5015222273bdb00f9412aaadfef6664fd203e538faef045815ec3d41c3bd", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "connected/test", "status": "OK", "run_id": "e14a0376769dd5286f681edb180fbb17fbd92b3bdf6887a2001e106b2a31e65d", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "disconnected/train", "status": "OK", "run_id": "d56b49b729ba5df4036860c2a33e227df4333641b3c18fdde947da493de9b63f", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}, {"run": "disconnected/test", "status": "OK", "run_id": "7549e6a40a0563b69d990ea5d1d94df2b5b3a587cdc898286a74e36cb1b26458", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.07680670978, "test_nrmse": [0.05772514425, 0.1273563867, 0.09686939643], "train_nrmse": [0.01472909783, 0.06706113086, 0.03122822903]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.001, "cv_score": 0.07899358739, "test_nrmse": [0.07727411936, 0.1184139, 0.08478459115], "train_nrmse": [0.0168685386, 0.07866090751, 0.03304096213]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 0.1, "cv_score": 0.7748419221, "test_nrmse": [0.8160465787, 1.101550132, 0.7343101283], "train_nrmse": [0.5053214362, 0.6610905643, 0.5841220886]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.001, "cv_score": 0.02376517023, "test_nrmse": [0.04863997909, 0.065975122, 0.03884938332], "train_nrmse": [0.00467053383, 0.01570898767, 0.00767423352]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.02403207571, "test_nrmse": [0.021607756, 0.1058716297, 0.02437387643], "train_nrmse": [0.001919857891, 0.008008239554, 0.002855388776]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 1, "cv_score": 0.7797767328, "test_nrmse": [0.7831376872, 1.086324618, 0.7470959705], "train_nrmse": [0.5132670856, 0.6844915443, 0.619236667]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.4854317803, "test_nrmse": [0.4757472544, 0.7179087567, 0.1992030163], "train_nrmse": [0.4589962457, 0.7190230241, 0.1854764768]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1, "cv_score": 0.511201618, "test_nrmse": [0.5034959517, 0.7519353682, 0.20388882], "train_nrmse": [0.4890264417, 0.7530908169, 0.1929903973]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.9950680926, "test_nrmse": [0.9738086601, 0.9996030152, 0.8687433998], "train_nrmse": [0.9739200987, 0.9989821681, 0.8565583765]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2680455615, "test_nrmse": [0.2546261523, 0.4518261874, 0.02949398568], "train_nrmse": [0.2544494956, 0.4539391741, 0.02354852401]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.3026161877, "test_nrmse": [0.2755327064, 0.4727171583, 0.08026288168], "train_nrmse": [0.2772426675, 0.4713038587, 0.08164427095]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 0.1, "cv_score": 0.9312970495, "test_nrmse": [0.8366756266, 0.9520350586, 0.8638866933], "train_nrmse": [0.8383446754, 0.9562984397, 0.8377553584]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.270102419e-06, "test_nrmse": [5.739036666e-07, 1.285455032e-06, 1.272316432e-06], "train_nrmse": [5.66732821e-07, 1.273860544e-06, 1.230553331e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001448831556, "test_nrmse": [7.073313176e-06, 0.0001856633479, 0.0001858374767], "train_nrmse": [6.95907268e-06, 0.000182873482, 0.0001798654911]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6794026731, "test_nrmse": [0.4771586796, 0.7895502343, 0.6861188556], "train_nrmse": [0.4796834366, 0.7922698791, 0.6651102101]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.012740831e-07, "test_nrmse": [1.597662221e-08, 1.425023347e-07, 1.054638494e-07], "train_nrmse": [1.436608888e-08, 1.073603132e-07, 7.669152068e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 8.251145e-07, "test_nrmse": [3.1002981e-08, 1.116190177e-06, 1.188881053e-06], "train_nrmse": [2.712598802e-08, 9.888031403e-07, 9.529414624e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4411669548, "test_nrmse": [0.2884545447, 0.54476164, 0.509106802], "train_nrmse": [0.2707128156, 0.5014010167, 0.4359376562]}]}, + {"seed": 3, "initial_state": {"train": [3.014648179, -5.700400198, 36.9119272], "test": [0.7714623529, 5.671596567, 21.29210994]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "73b3dcf8d7793ff5bb5170cdbba4346536899c34ce7f6c0803218741ac9e4cb4", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "connected/test", "status": "OK", "run_id": "34de8b6e10bec78252a12a927ff40438f2bd764ab170768705b2271851a53413", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "disconnected/train", "status": "OK", "run_id": "182c1a3295f6a95fef185da1bcc235ca44787d5ca1203552710b080242b81001", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}, {"run": "disconnected/test", "status": "OK", "run_id": "f2de23f68d5679de8ae792c340f6130e41d4db8fe73c25c023b9706e1d898e17", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.1, "cv_score": 0.09404949534, "test_nrmse": [0.1366440451, 0.2422930174, 0.1270309014], "train_nrmse": [0.04184638908, 0.08981544613, 0.06612163052]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.01, "cv_score": 0.07913564735, "test_nrmse": [0.101850413, 0.3264761648, 0.09396358118], "train_nrmse": [0.02224345305, 0.08143586639, 0.0327211989]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.7859890648, "test_nrmse": [0.9199843296, 1.337887349, 1.152243487], "train_nrmse": [0.6867335366, 0.8452254123, 0.5896210249]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.02523202958, "test_nrmse": [0.03158206912, 0.3623999012, 0.06838874881], "train_nrmse": [0.001762899654, 0.005337482331, 0.003666770693]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 1e-05, "cv_score": 0.01976593533, "test_nrmse": [0.0441707764, 0.3698824892, 0.07675793317], "train_nrmse": [0.001476564218, 0.00550377042, 0.002383209663]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.7608579341, "test_nrmse": [0.9345321347, 1.454761106, 1.192153905], "train_nrmse": [0.6336539469, 0.8112551566, 0.5735331995]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4355590377, "test_nrmse": [0.4640150578, 0.6975836352, 0.1976229954], "train_nrmse": [0.4096330977, 0.6943096453, 0.1741478085]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4620714184, "test_nrmse": [0.489210316, 0.7309448331, 0.2004709488], "train_nrmse": [0.4419416693, 0.7301800752, 0.1815532118]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.9705758239, "test_nrmse": [0.9508252968, 0.9960469219, 0.9107899024], "train_nrmse": [0.9601173273, 0.9918811716, 0.8567966041]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2459722526, "test_nrmse": [0.2502514, 0.474642006, 0.0276590426], "train_nrmse": [0.2501732348, 0.4139615663, 0.02710485888]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.01, "cv_score": 0.2744672691, "test_nrmse": [0.2710043928, 0.5006379975, 0.07837921027], "train_nrmse": [0.2699687489, 0.4213687584, 0.08284302878]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 0.1, "cv_score": 0.8965613424, "test_nrmse": [0.7610923907, 0.9078495133, 0.9371371499], "train_nrmse": [0.7936788792, 0.9319365862, 0.8287018032]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.253178472e-06, "test_nrmse": [4.985384439e-07, 1.144794352e-06, 1.249885271e-06], "train_nrmse": [5.724011002e-07, 1.269936463e-06, 1.253737813e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.000142752299, "test_nrmse": [6.107153963e-06, 0.0001632134512, 0.0001792599711], "train_nrmse": [6.96243656e-06, 0.0001804959958, 0.0001794752156]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6531303044, "test_nrmse": [0.4583248445, 0.7895752255, 0.7021136727], "train_nrmse": [0.4737309707, 0.7720154547, 0.6304051018]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.549692002e-07, "test_nrmse": [2.858793217e-08, 2.323635702e-07, 2.734393308e-07], "train_nrmse": [1.420328371e-08, 1.080318799e-07, 8.68788409e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.074159517e-06, "test_nrmse": [3.552850035e-08, 9.889872172e-07, 2.163559163e-06], "train_nrmse": [2.634395614e-08, 9.235509825e-07, 9.29421665e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4719063943, "test_nrmse": [0.2876027526, 0.5704511495, 0.520890744], "train_nrmse": [0.2438155017, 0.4482267998, 0.4041866649]}]}, + {"seed": 4, "initial_state": {"train": [-9.721361349, -9.125792155, 12.80936991], "test": [-7.515167081, -0.6883587043, 30.78824714]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "ed0b151b2cb7c868c8e12847c2b8e6d59d5f50ba689544f431019580b39d994a", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "connected/test", "status": "OK", "run_id": "21ad94e7ec6cde8932cb173b9f7769115eb4dd8157bd563077cf38af49295812", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "disconnected/train", "status": "OK", "run_id": "9dd3b12c71db57babbc6c8fbbc2dcb5a09f1fe90f48d666adbc2ee055310a4ff", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}, {"run": "disconnected/test", "status": "OK", "run_id": "d1ff3745b7f72c750811c346eec0ceb1ec9deaa00e32b5bbc2e7f34ca042868d", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.1817077765, "test_nrmse": [0.1097222774, 0.2110941411, 0.178070745], "train_nrmse": [0.08621883743, 0.1911042356, 0.1260187899]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.01, "cv_score": 0.1575445856, "test_nrmse": [0.05972174709, 0.1511620584, 0.08149925676], "train_nrmse": [0.02522846871, 0.1001623207, 0.04194049071]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 10, "cv_score": 0.8452440104, "test_nrmse": [0.6835803359, 0.8774698253, 0.8716210979], "train_nrmse": [0.6691577601, 0.855675326, 0.6552818377]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.1, "cv_score": 0.08371878602, "test_nrmse": [0.04667368462, 0.06515989329, 0.02859417405], "train_nrmse": [0.01629599772, 0.04798198639, 0.01981125938]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.1, "cv_score": 0.0782492134, "test_nrmse": [0.03968715699, 0.0758597303, 0.0282092065], "train_nrmse": [0.01361293323, 0.04981986561, 0.01785201719]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 10, "cv_score": 0.8454653709, "test_nrmse": [0.6628190363, 0.8672414168, 0.8551044081], "train_nrmse": [0.6417408806, 0.8327230849, 0.6333522978]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.4988106434, "test_nrmse": [0.5056029128, 0.727889805, 0.2379932435], "train_nrmse": [0.4789060056, 0.7221662932, 0.1817769106]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 1e-06, "cv_score": 0.5231123511, "test_nrmse": [0.5307226306, 0.7607966947, 0.2402125319], "train_nrmse": [0.5079674517, 0.7573857484, 0.1856714204]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 1.014781244, "test_nrmse": [0.982543699, 1.011282882, 0.9298642363], "train_nrmse": [0.9857089895, 0.9969299385, 0.8199662267]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2598474621, "test_nrmse": [0.2647440626, 0.4657857301, 0.04383110894], "train_nrmse": [0.2472135769, 0.4407829298, 0.02296345863]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.2940206388, "test_nrmse": [0.2843084483, 0.4913145523, 0.08289652973], "train_nrmse": [0.2688072328, 0.462605535, 0.07610458636]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 0.9459350458, "test_nrmse": [0.8416826895, 0.9554409704, 0.9259752393], "train_nrmse": [0.8544535936, 0.9579789971, 0.8006720274]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.302337506e-06, "test_nrmse": [5.831785192e-07, 1.325681288e-06, 1.395568338e-06], "train_nrmse": [5.716421569e-07, 1.278774003e-06, 1.246482931e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001476202735, "test_nrmse": [7.174929308e-06, 0.0001910123373, 0.0002004411275], "train_nrmse": [6.982305532e-06, 0.0001829571661, 0.0001795630022]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.6958077856, "test_nrmse": [0.4686529726, 0.7841124977, 0.7570823688], "train_nrmse": [0.4792184219, 0.7893328997, 0.6488079083]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.319817854e-07, "test_nrmse": [2.085878035e-08, 2.252177955e-07, 1.80951355e-07], "train_nrmse": [1.453828489e-08, 1.09598108e-07, 7.987737014e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.000551244e-06, "test_nrmse": [4.25734473e-08, 1.400425378e-06, 1.804685193e-06], "train_nrmse": [2.687992603e-08, 9.637303226e-07, 9.446970435e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4690173279, "test_nrmse": [0.3117171975, 0.587001827, 0.6644504137], "train_nrmse": [0.2682431351, 0.4994062524, 0.4233355928]}]}, + {"seed": 5, "initial_state": {"train": [-9.19086946, 7.271385617, 34.0927083], "test": [-9.200330572, 4.944556205, 22.01109943]}, "runs": [{"run": "connected/train", "status": "OK", "run_id": "75fa698a462a8794a1829167d024154b8d7d3bf9ed38c8fe49dc9ca0bcc6f1b7", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "connected/test", "status": "OK", "run_id": "05835fa85dbd001d418f1ced12cb310b4f9e3b4a1c3fcbff30f572c3cc1724bb", "config_id": "28589183a93078bdfad2eb7f6d884466c6be77d897a2049b1e1f309815f15bad", "steps": 2000000}, {"run": "disconnected/train", "status": "OK", "run_id": "d6e3db32d9de48c60ebe7d75be05cbb48d297115ade32fd5dfd7da00edee91e6", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}, {"run": "disconnected/test", "status": "OK", "run_id": "a48c4df9ad25fe0ac3b3bb0f70d7deb04ebb87819dfe82b163253cfb8e267a79", "config_id": "b28b8e7b158cefbc34cf6360139af07edc5592f9b05cc5eda1d4b85a4a0d2d22", "steps": 2000000}], + "fits": [{"model": "RC-connected-lin", "task": "T0", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1113403295, "test_nrmse": [0.2062952682, 0.6411022955, 0.5435365863], "train_nrmse": [0.01540612103, 0.06536693388, 0.03188137453]}, + {"model": "RC-connected-lin", "task": "T1", "features": 42, "status": "OK", "lambda": 0.0001, "cv_score": 0.1094211356, "test_nrmse": [0.2127427135, 0.5937933336, 0.2474540593], "train_nrmse": [0.01529472419, 0.06944737275, 0.0285421704]}, + {"model": "RC-connected-lin", "task": "T25", "features": 42, "status": "OK", "lambda": 100, "cv_score": 0.9637430162, "test_nrmse": [0.8626526061, 1.042883685, 0.9933261887], "train_nrmse": [0.7123396372, 0.8604825798, 0.7191932766]}, + {"model": "RC-connected-sq", "task": "T0", "features": 84, "status": "OK", "lambda": 0.0001, "cv_score": 0.05780768721, "test_nrmse": [0.4826596893, 1.209597618, 0.1897570963], "train_nrmse": [0.003865899946, 0.01399332518, 0.005439316413]}, + {"model": "RC-connected-sq", "task": "T1", "features": 84, "status": "OK", "lambda": 0.0001, "cv_score": 0.05444902144, "test_nrmse": [0.312091413, 1.13883705, 0.04936695374], "train_nrmse": [0.002902089796, 0.01434734702, 0.003572821864]}, + {"model": "RC-connected-sq", "task": "T25", "features": 84, "status": "OK", "lambda": 100, "cv_score": 0.9517142638, "test_nrmse": [0.8336462848, 1.035480136, 1.025302172], "train_nrmse": [0.6855665064, 0.8478755232, 0.6924007193]}, + {"model": "RC-disconnected-lin", "task": "T0", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.6800427674, "test_nrmse": [0.5172976198, 0.7794596151, 0.1988256188], "train_nrmse": [0.5234531216, 0.7415733691, 0.1834882478]}, + {"model": "RC-disconnected-lin", "task": "T1", "features": 3, "status": "OK", "lambda": 10, "cv_score": 0.7030798888, "test_nrmse": [0.5480157238, 0.8182823439, 0.203221649], "train_nrmse": [0.5496415308, 0.774254941, 0.1871116013]}, + {"model": "RC-disconnected-lin", "task": "T25", "features": 3, "status": "OK", "lambda": 10, "cv_score": 1.205331839, "test_nrmse": [1.126321026, 1.157832462, 0.9088796031], "train_nrmse": [0.9875643002, 0.9958890009, 0.8324095706]}, + {"model": "RC-disconnected-sq", "task": "T0", "features": 6, "status": "OK", "lambda": 0.001, "cv_score": 0.3362323696, "test_nrmse": [0.3061484606, 0.5189892613, 0.0306171839], "train_nrmse": [0.2571108479, 0.4523083181, 0.0214107261]}, + {"model": "RC-disconnected-sq", "task": "T1", "features": 6, "status": "OK", "lambda": 0.0001, "cv_score": 0.3748201325, "test_nrmse": [0.3307110798, 0.5442705611, 0.08259682974], "train_nrmse": [0.277373397, 0.4773590217, 0.07537099268]}, + {"model": "RC-disconnected-sq", "task": "T25", "features": 6, "status": "OK", "lambda": 1, "cv_score": 1.077788872, "test_nrmse": [0.9712867129, 1.092122924, 0.9235445352], "train_nrmse": [0.8413292979, 0.9387010016, 0.8131141025]}, + {"model": "BL-linear", "task": "T0", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 1.3085029e-06, "test_nrmse": [6.785711545e-07, 1.508096811e-06, 1.407269125e-06], "train_nrmse": [5.793985122e-07, 1.313447178e-06, 1.259204851e-06]}, + {"model": "BL-linear", "task": "T1", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.0001484020618, "test_nrmse": [8.232286704e-06, 0.0002137608546, 0.0001993424006], "train_nrmse": [6.986771718e-06, 0.0001843098481, 0.0001791467712]}, + {"model": "BL-linear", "task": "T25", "features": 15, "status": "OK", "lambda": 1e-06, "cv_score": 0.7580760662, "test_nrmse": [0.5293788686, 0.8746128036, 0.7301540195], "train_nrmse": [0.4589957945, 0.7658818436, 0.6520325022]}, + {"model": "BL-quadratic", "task": "T0", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 1.555548338e-07, "test_nrmse": [2.158235237e-08, 1.818236003e-07, 1.330124901e-07], "train_nrmse": [1.472642817e-08, 1.09553499e-07, 7.454226144e-08]}, + {"model": "BL-quadratic", "task": "T1", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 9.896778795e-07, "test_nrmse": [3.936987415e-08, 1.334532396e-06, 1.444296024e-06], "train_nrmse": [2.622974793e-08, 9.444719433e-07, 9.182452858e-07]}, + {"model": "BL-quadratic", "task": "T25", "features": 135, "status": "OK", "lambda": 1e-06, "cv_score": 0.4963134932, "test_nrmse": [0.3231564424, 0.5990393337, 0.5687834611], "train_nrmse": [0.2527090075, 0.4748189108, 0.40990215]}]} + ], + "summary": [ + {"task": "T0", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.2062547002, "sd": 0.1469943188, "min": 0.09398364247, "max": 0.4636447167}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.1951016088, "sd": 0.2454708459, "min": 0.04680925065, "max": 0.6273381346}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.4790303615, "sd": 0.01934907211, "min": 0.4530738962, "max": 0.4985276179}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.2586465416, "sd": 0.0155814158, "min": 0.2453154418, "max": 0.2852516353}, "BL-linear": {"seeds_ok": 5, "mean": 1.055766375e-06, "sd": 9.743392055e-08, "min": 9.644060221e-07, "max": 1.19797903e-06}, "BL-quadratic": {"seeds_ok": 5, "mean": 1.163294131e-07, "sd": 4.575103315e-08, "min": 6.105372777e-08, "max": 1.781302777e-07}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.2727756613, "sd": 0.1368024764, "min": -0.3703027, "max": -0.03488290121}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": -0.06354493279, "sd": 0.2309663759, "min": -0.2113110499, "max": 0.3420864993}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.2062545839, "sd": 0.1469943146, "min": 0.09398355449, "max": 0.4636446045}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1951014924, "sd": 0.2454708445, "min": 0.04680910831, "max": 0.6273380224}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "T1", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.1813192867, "sd": 0.1046196002, "min": 0.09349087017, "max": 0.3513300355}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.1735413291, "sd": 0.1885892057, "min": 0.04791869793, "max": 0.5000984722}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.500956019, "sd": 0.02031164411, "min": 0.4735420327, "max": 0.5231732389}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.2900823316, "sd": 0.01675087309, "min": 0.2761709155, "max": 0.3191928236}, "BL-linear": {"seeds_ok": 5, "mean": 0.0001272577046, "sd": 9.664242004e-06, "min": 0.0001161935254, "max": 0.0001404451807}, "BL-quadratic": {"seeds_ok": 5, "mean": 9.049000977e-07, "sd": 1.823399108e-07, "min": 6.61156687e-07, "max": 1.082561339e-06}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.3196367323, "sd": 0.09534828429, "min": -0.413116265, "max": -0.1718432034}, "first_wins": 5, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": -0.1165410025, "sd": 0.1726397968, "min": -0.2382544789, "max": 0.1809056486}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1813183818, "sd": 0.1046196032, "min": 0.09349009148, "max": 0.3513290961}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.1735404242, "sd": 0.1885891798, "min": 0.04791761537, "max": 0.5000975328}, "first_wins": 0, "seeds_compared": 5}]}, + {"task": "T25", "test_nrmse_mean_over_xyz": {"RC-connected-lin": {"seeds_ok": 5, "mean": 0.952985759, "sd": 0.1215346469, "min": 0.8108904197, "max": 1.136705056}, "RC-connected-sq": {"seeds_ok": 5, "mean": 0.9771878981, "sd": 0.1566433824, "min": 0.7950549537, "max": 1.193815715}, "RC-disconnected-lin": {"seeds_ok": 5, "mean": 0.9814777876, "sd": 0.04764690986, "min": 0.947385025, "max": 1.064344364}, "RC-disconnected-sq": {"seeds_ok": 5, "mean": 0.9108132902, "sd": 0.049644661, "min": 0.868693018, "max": 0.9956513905}, "BL-linear": {"seeds_ok": 5, "mean": 0.6699019399, "sd": 0.02491527139, "min": 0.6500045809, "max": 0.7113818972}, "BL-quadratic": {"seeds_ok": 5, "mean": 0.4750928745, "sd": 0.03243783891, "min": 0.4474409956, "max": 0.5210564794}}, + "paired": [{"comparison": "RC-connected-lin - RC-disconnected-lin", "difference": {"seeds_ok": 5, "mean": -0.02849202866, "sd": 0.1325522773, "min": -0.163673186, "max": 0.1841510151}, "first_wins": 4, "seeds_compared": 5}, {"comparison": "RC-connected-sq - RC-disconnected-sq", "difference": {"seeds_ok": 5, "mean": 0.06637460787, "sd": 0.1759163278, "min": -0.1126446793, "max": 0.3251226973}, "first_wins": 3, "seeds_compared": 5}, {"comparison": "RC-connected-lin - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.4778928845, "sd": 0.1399351759, "min": 0.2898339403, "max": 0.6770568402}, "first_wins": 0, "seeds_compared": 5}, {"comparison": "RC-connected-sq - best baseline (by CV score)", "difference": {"seeds_ok": 5, "mean": 0.5020950236, "sd": 0.1765168392, "min": 0.2739984743, "max": 0.7341675}, "first_wins": 0, "seeds_compared": 5}]} + ], + "significance": "none claimed (five seeds)" +}, + "perf": { + "schema": "omega-reservoir-perf/1", + "protocol": "RESERVOIR_REFERENCE.md section 10", + "host": {"sysname": "Linux", "release": "7.0.0-1019-nvidia", "machine": "aarch64", "cpu": 5, "cpu_part": "0xd85", "pinned": true, "sched_getcpu": 5}, + "compiler": "13.3.0", + "flags": "-std=gnu11 -Wall -Wextra -Werror -O2 -Isrc -Isrc/reservoir -Itests/reservoir -ffp-contract=off -fno-fast-math -fno-math-errno -DOMEGA_NUMERIC_CPU_ONLY -Itools/reservoir -pthread", + "timer": {"clock": "CLOCK_MONOTONIC", "mean_call_ns": 22.0, "included_in_latency": true}, + "struct_bytes": {"OmegaResConfig": 19948, "OmegaResState": 3632, "OmegaResWorkspace": 13360, "OmegaResTopology": 904, "OmegaResReadout": 8240, "OmegaResReadoutWorkspace": 538672}, + "warmup_steps": 10000, "timed_steps": 40000, "repetitions": 5, + "networks": [ + {"network": "chain5 NARMA (G2-N1)", "nodes": 5, "membranes": 4, "status": "OK", "per_repetition": [{"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 12208, "steps_per_s": 1311069.0}, {"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 104177, "steps_per_s": 1307853.6}, {"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 5120, "steps_per_s": 1313783.7}, {"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 23104, "steps_per_s": 1310656.0}, {"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 7760, "steps_per_s": 1312048.2}], "pooled": {"p50_ns": 752, "p95_ns": 784, "p99_ns": 800, "max_ns": 104177}, "steps_per_s": 1311078.3, "simulated_s_per_wall_s": 13.1108, "cpu_over_wall": 0.9997}, + {"network": "chain50 NARMA", "nodes": 50, "membranes": 49, "status": "OK", "per_repetition": [{"p50_ns": 10928, "p95_ns": 11041, "p99_ns": 12272, "max_ns": 31504, "steps_per_s": 91329.5}, {"p50_ns": 10928, "p95_ns": 11040, "p99_ns": 12176, "max_ns": 39681, "steps_per_s": 91309.6}, {"p50_ns": 10896, "p95_ns": 11008, "p99_ns": 11856, "max_ns": 73089, "steps_per_s": 91581.2}, {"p50_ns": 10896, "p95_ns": 11008, "p99_ns": 11937, "max_ns": 25953, "steps_per_s": 91580.5}, {"p50_ns": 10912, "p95_ns": 11024, "p99_ns": 12624, "max_ns": 30768, "steps_per_s": 91449.7}], "pooled": {"p50_ns": 10912, "p95_ns": 11024, "p99_ns": 12096, "max_ns": 73089}, "steps_per_s": 91449.9, "simulated_s_per_wall_s": 0.914499, "cpu_over_wall": 0.9999}, + {"network": "hex43 Lorenz", "nodes": 43, "membranes": 99, "status": "OK", "per_repetition": [{"p50_ns": 14944, "p95_ns": 15089, "p99_ns": 16800, "max_ns": 28240, "steps_per_s": 66776.7}, {"p50_ns": 14864, "p95_ns": 15008, "p99_ns": 16817, "max_ns": 58769, "steps_per_s": 67097.6}, {"p50_ns": 14881, "p95_ns": 15041, "p99_ns": 16992, "max_ns": 27072, "steps_per_s": 67002.5}, {"p50_ns": 14896, "p95_ns": 15041, "p99_ns": 16928, "max_ns": 24160, "steps_per_s": 66974.8}, {"p50_ns": 14912, "p95_ns": 15057, "p99_ns": 16864, "max_ns": 47793, "steps_per_s": 66926.7}], "pooled": {"p50_ns": 14896, "p95_ns": 15056, "p99_ns": 16880, "max_ns": 58769}, "steps_per_s": 66955.5, "simulated_s_per_wall_s": 0.669555, "cpu_over_wall": 0.9999} + ], + "peak_rss_kib": 8536, + "energy": "NOT_RUN (not instrumented; no efficiency claim)" +} + } +} diff --git a/mk/.crumb b/mk/.crumb index 579e1f0be..9235e11d7 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-13T04:37:52Z", + "compiled_at": "2026-10-14T16:14:21Z", "compiler": "crumb-compile/1", - "digest": "sha256:f6d1a9bb8d18f58cddfbea2f9ecce90f27f5b5f75b584b3a0f1ce1cea509044c", + "digest": "sha256:62dcb70a0d4fc4f1685b4067757119514c70ec97fbb31a2ef44b3a6f3ec7b3e6", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 67, - "generated_at_commit": "cc3f8584d83571c4d53336742af0ebdda254a0ab", - "source_tree": "sha256:702fc6a621e0ca7a96ac452f23cd9102d8ca7c8ff636d8b816d3f60b82138f7a" + "files": 68, + "generated_at_commit": "1978e2b4aa4c1e3639e11c6950ba7e509fad9924", + "source_tree": "sha256:cfa801cc00fa8eb4d4c56127589e883f91f42957bc796790d7c3c4134a9c070f" }, "owner_lane": "", "provenance": { diff --git a/mk/reservoir.mk b/mk/reservoir.mk new file mode 100644 index 000000000..a7cbc8d27 --- /dev/null +++ b/mk/reservoir.mk @@ -0,0 +1,83 @@ +# omega#440 ionic-droplet reservoir, Gate 1 (docs/reservoir/RESERVOIR_REFERENCE.md): +# CPU simulator of the droplet-network model of Armendarez et al. (Sci. Adv. +# 2026) plus a binary64 ridge readout. Files only under src/reservoir/ and +# tests/reservoir/. Picked up by `-include mk/*.mk`; not part of `all` or +# `test`. CPU only: opens no device, no CUDA, never touches the GB10. +# +# test-reservoir purity check, then the tests plain and with ASan/UBSan +# (the ASan build runs shorter oracle scenarios, -DRES_QUICK) +# reservoir-purity the reservoir objects reference no allocator, no libm, no +# file or process operation (all math goes through +# omega_math_*; the readout's square root is the inline +# instruction __builtin_sqrt with -fno-math-errno) +# +# Gate 2 (tools/reservoir/, outside the purity check: tools allocate and do I/O): +# test-reservoir also builds res_qualify, runs the archive-reader tests on the +# two committed CC-BY fixtures (plain and ASan/UBSan) and checks +# that the declared configuration has not drifted from +# docs/reservoir/gate2_config.json +# qualify-reservoir RES_ARCHIVE= +# [RES_V2_RESULTS=]: the Gate 2 comparison, +# benchmarks and timing on a clean tree; writes a content- +# addressed receipt under evidence/RESERVOIR/ (never overwrites) +ifndef RESERVOIR_MK +RESERVOIR_MK := 1 +.PHONY: test-reservoir reservoir-purity qualify-reservoir +RES_CFLAGS = -std=gnu11 -Wall -Wextra -Werror -O2 -Isrc -Isrc/reservoir -Itests/reservoir \ + -ffp-contract=off -fno-fast-math -fno-math-errno -DOMEGA_NUMERIC_CPU_ONLY +RES_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all -DRES_QUICK +RES_SRCS = src/reservoir/omega_reservoir.c src/reservoir/omega_reservoir_readout.c +RES_HDRS = src/reservoir/omega_reservoir.h src/reservoir/omega_reservoir_readout.h src/omega_numeric.h src/sha256.h +# omega_numeric.c pulls in the provenance and encoder objects at link time. +RES_DEPS = src/omega_numeric.c src/omega_numeric_provenance.c src/omega_blackwell_encoder.c \ + src/omega_blackwell_codegen.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c src/sha256.c +RES_TEST_SRCS = tests/reservoir/test_reservoir.c tests/reservoir/res_oracle64.c +RES_TEST_HDRS = tests/reservoir/res_fixtures.h tests/reservoir/res_oracle64.h +RES_DIR = $(OUT_DIR)/tests-reservoir +RES_FORBIDDEN = ' U (malloc|calloc|realloc|free|aligned_alloc|posix_memalign|exp|expf|log|logf|pow|powf|sqrt|sqrtf|fma|fmaf|fopen|fwrite|fprintf|printf|mmap|open|fork|exec.*|dlopen|system|socket|cu[A-Z].*)$$' +RES_TOOL_SRCS = tools/reservoir/res_qualify.c tools/reservoir/res_bench.c tools/reservoir/res_common.c \ + tools/reservoir/res_mat.c tools/reservoir/res_inflate.c +RES_TOOL_HDRS = tools/reservoir/res_common.h tools/reservoir/res_mat.h tools/reservoir/res_inflate.h +RES_TOOL_CFLAGS = $(RES_CFLAGS) -Itools/reservoir -pthread +RES_MAT_SRCS = tools/reservoir/res_mat.c tools/reservoir/res_inflate.c src/sha256.c +RES_MAT_TEST = tests/reservoir/test_res_mat.c + +$(RES_DIR)/%.o: src/reservoir/%.c $(RES_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_CFLAGS) -pedantic -c -o $@ $< + +reservoir-purity: $(RES_DIR)/omega_reservoir.o $(RES_DIR)/omega_reservoir_readout.o + @if nm -u $^ | grep -E $(RES_FORBIDDEN) ; then \ + echo "reservoir object references an allocator, libm or an I/O or process operation"; exit 1; fi + @echo "reservoir-purity: omega_reservoir.o and omega_reservoir_readout.o reference no forbidden symbol" + +$(RES_DIR)/test_reservoir: $(RES_TEST_SRCS) $(RES_SRCS) $(RES_DEPS) $(RES_HDRS) $(RES_TEST_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_CFLAGS) -o $@ $(RES_TEST_SRCS) $(RES_SRCS) $(RES_DEPS) -lm +$(RES_DIR)/test_reservoir_asan: $(RES_TEST_SRCS) $(RES_SRCS) $(RES_DEPS) $(RES_HDRS) $(RES_TEST_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_CFLAGS) $(RES_ASAN) -o $@ $(RES_TEST_SRCS) $(RES_SRCS) $(RES_DEPS) -lm + +$(RES_DIR)/res_qualify: $(RES_TOOL_SRCS) $(RES_TOOL_HDRS) $(RES_SRCS) $(RES_DEPS) $(RES_HDRS) $(RES_TEST_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_TOOL_CFLAGS) -DRES_BUILD_FLAGS='"$(strip $(RES_TOOL_CFLAGS))"' -o $@ $(RES_TOOL_SRCS) $(RES_SRCS) $(RES_DEPS) -lm +$(RES_DIR)/test_res_mat: $(RES_MAT_TEST) $(RES_MAT_SRCS) $(RES_TOOL_HDRS) $(RES_TEST_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_TOOL_CFLAGS) -o $@ $(RES_MAT_TEST) $(RES_MAT_SRCS) +$(RES_DIR)/test_res_mat_asan: $(RES_MAT_TEST) $(RES_MAT_SRCS) $(RES_TOOL_HDRS) $(RES_TEST_HDRS) + @mkdir -p $(RES_DIR) + $(CC) $(RES_TOOL_CFLAGS) $(RES_ASAN) -o $@ $(RES_MAT_TEST) $(RES_MAT_SRCS) + +test-reservoir: reservoir-purity $(RES_DIR)/test_reservoir $(RES_DIR)/test_reservoir_asan $(RES_DIR)/test_res_mat \ + $(RES_DIR)/test_res_mat_asan $(RES_DIR)/res_qualify + ./$(RES_DIR)/test_reservoir + ./$(RES_DIR)/test_reservoir_asan + ./$(RES_DIR)/test_res_mat + ./$(RES_DIR)/test_res_mat_asan + ./$(RES_DIR)/res_qualify config | cmp - docs/reservoir/gate2_config.json + @echo "test-reservoir: reservoir checks pass in plain and ASan/UBSan builds; Gate 2 config unchanged" + +qualify-reservoir: + @test -n "$(RES_ARCHIVE)" || { echo "qualify-reservoir: set RES_ARCHIVE="; exit 2; } + RES_ARCHIVE="$(RES_ARCHIVE)" RES_V2_RESULTS="$(RES_V2_RESULTS)" tools/reservoir/qualify_reservoir.sh +endif diff --git a/src/.crumb b/src/.crumb index be6a81501..29ce16c7d 100644 --- a/src/.crumb +++ b/src/.crumb @@ -138,15 +138,21 @@ "name": "polyglot", "purpose": "Directory src/polyglot. Purpose not yet described by a human." }, + { + "digest": "4785d8df268c31047589c5dff4ebc1f9a12a0fa4d5c94ce6dee156a841cf9502", + "last_commit": "2ec9e45f", + "name": "reservoir", + "purpose": "Ionic-droplet reservoir simulator (omega#440): binary32 fixed-step RK4 of the authors' droplet m" + }, { "digest": "9e27882accc1db2881793e3f389519f5dd37f83cd37c4d1a6e19f2aa2e84d217", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, { "digest": "d7bb5fb627dfe92066f94fa556e86be5d025c0ff5e81d823ba177a56ea099d31", - "last_commit": "e0abd0b5", + "last_commit": "5901baa5", "name": "searchtrace", "purpose": "Directory src/searchtrace. Purpose not yet described by a human." }, @@ -175,15 +181,15 @@ "purpose": "Directory src/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:ca0aa9172b90a62bf95822a7fd9b264c5450204b82c13db7a473ed242e9c2257", - "compiled_at": "2026-10-14T01:16:48Z", + "children_root": "sha256:87462381f6c71959138a51d0a795c5b5510ec9cc3753d73caa8662497290c996", + "compiled_at": "2026-10-14T17:30:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:10a7c4a3722e34cc5476cb9feb128616b59dfb58bcf33f6aad7db51c014576ef", + "digest": "sha256:dbcd8678fc48b25073ce3a9c773de759d0782a3f9ee1aa051a09acddbf8da4a0", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 459, - "generated_at_commit": "e0abd0b524f5bf8e3ba6960b53868980bdd41b4e", - "source_tree": "sha256:795ed92eff7a070b7c6e4a4262945e9245cae22c971e84f3a4496958fd126ee9" + "files": 463, + "generated_at_commit": "2ec9e45fbc14d6838cceffe5c164f2af43b61a31", + "source_tree": "sha256:a5af764ff217fc67d32ab9189c4f0b5af07735b840490b865c51b8a10f50e376" }, "owner_lane": "", "provenance": { diff --git a/src/reservoir/.crumb b/src/reservoir/.crumb new file mode 100644 index 000000000..47dd17fe6 --- /dev/null +++ b/src/reservoir/.crumb @@ -0,0 +1,20 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-14T17:30:45Z", + "compiler": "crumb-compile/1", + "digest": "sha256:4785d8df268c31047589c5dff4ebc1f9a12a0fa4d5c94ce6dee156a841cf9502", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 4, + "generated_at_commit": "2ec9e45fbc14d6838cceffe5c164f2af43b61a31", + "source_tree": "sha256:f8483e2c88bc40d51bada535d3c3b6bc9cb19823e0100723b6ed03e59b36fe75" + } + }, + "layer": "src/reservoir", + "name": "src/reservoir", + "purpose": "Ionic-droplet reservoir simulator (omega#440): binary32 fixed-step RK4 of the authors' droplet model, refusals instead of silent repair, run receipts, binary64 ridge readout. CPU only; the reference and contract are docs/reservoir/RESERVOIR_REFERENCE.md.", + "schema_version": "1.0.0" +} diff --git a/src/reservoir/omega_reservoir.c b/src/reservoir/omega_reservoir.c new file mode 100644 index 000000000..ff7153a88 --- /dev/null +++ b/src/reservoir/omega_reservoir.c @@ -0,0 +1,640 @@ +/* Omega ionic-droplet reservoir, CPU reference. The contract (model, + * precision, update order, refusals) is in omega_reservoir.h; this file + * follows it line for line. Build with -ffp-contract=off -fno-fast-math. */ +#include "omega_reservoir.h" + +#include "omega_numeric.h" +#include "sha256.h" + +#include + +/* ------------------------------------------------------------- helpers */ + +static int fin(float x) { return x == x && x - x == 0.0f; } /* not NaN, not inf */ +static float fabs32(float x) { return x < 0.0f ? -x : x; } + +/* TwoSum (Knuth): s = fl(x + y) and *err = (x + y) - s exactly, for any + * magnitudes, in round-to-nearest without contraction. */ +static float two_sum(float x, float y, float *err) +{ + const float s = x + y; + const float bp = s - x; + const float ap = s - bp; + *err = (x - ap) + (y - bp); + return s; +} + +/* |carry| <= half an ulp of the value it belongs to: 2^-24 |value|. */ +static int carry_ok(float value, float carry) { return fabs32(carry) <= fabs32(value) * 0x1p-24f; } +static uint32_t f32_bits(float x) +{ + uint32_t u; + memcpy(&u, &x, 4); + return u == 0x80000000u ? 0u : u; /* -0.0 encodes as +0.0 */ +} + +/* 1 - e^w, see the header for the declared sequence. */ +static float one_minus_exp(float w) +{ + static const float inv_k[11] = {0.0f, 0.0f, 1.0f / 2.0f, 1.0f / 3.0f, 1.0f / 4.0f, 1.0f / 5.0f, + 1.0f / 6.0f, 1.0f / 7.0f, 1.0f / 8.0f, 1.0f / 9.0f, 1.0f / 10.0f}; + if (fabs32(w) <= 0.5f) { + float p = 1.0f; + for (int k = 10; k >= 2; k--) p = 1.0f + (w * inv_k[k]) * p; + return -(w * p); + } + return 1.0f - omega_math_exp(w); +} + +/* ------------------------------------------------------------- topology */ + +static int edge_less(OmegaResEdge x, OmegaResEdge y) { return x.a < y.a || (x.a == y.a && x.b < y.b); } + +OmegaResStatus omega_res_topology_build(uint32_t node_count, const OmegaResEdge *edges, uint32_t edge_count, + const uint32_t *grounds, uint32_t ground_count, OmegaResTopology *out) +{ + if (!edges || !grounds || !out) return OMEGA_RES_ERR_NULL; + OmegaResTopology t; + memset(&t, 0, sizeof t); + if (node_count < 2u || node_count > OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_TOPOLOGY; + if (edge_count < 1u || edge_count > OMEGA_RES_MAX_EDGES) return OMEGA_RES_ERR_TOPOLOGY; + if (ground_count < 1u || ground_count >= node_count) return OMEGA_RES_ERR_TOPOLOGY; + t.node_count = node_count; + t.edge_count = edge_count; + for (uint32_t e = 0; e < edge_count; e++) { + uint32_t a = edges[e].a, b = edges[e].b; + if (a >= node_count || b >= node_count || a == b) return OMEGA_RES_ERR_TOPOLOGY; + OmegaResEdge c = {(uint16_t)(a < b ? a : b), (uint16_t)(a < b ? b : a)}; + uint32_t i = e; /* insertion sort: bounded by OMEGA_RES_MAX_EDGES */ + while (i > 0 && edge_less(c, t.edge[i - 1])) { t.edge[i] = t.edge[i - 1]; i--; } + t.edge[i] = c; + } + for (uint32_t e = 0; e < edge_count; e++) { + if (e > 0 && t.edge[e].a == t.edge[e - 1].a && t.edge[e].b == t.edge[e - 1].b) return OMEGA_RES_ERR_TOPOLOGY; + if (++t.degree[t.edge[e].a] > OMEGA_RES_MAX_DEGREE) return OMEGA_RES_ERR_TOPOLOGY; + if (++t.degree[t.edge[e].b] > OMEGA_RES_MAX_DEGREE) return OMEGA_RES_ERR_TOPOLOGY; + } + for (uint32_t i = 0; i < node_count; i++) + if (t.degree[i] == 0) return OMEGA_RES_ERR_TOPOLOGY; /* isolated: no capacitance */ + for (uint32_t g = 0; g < ground_count; g++) { + if (grounds[g] >= node_count || t.is_ground[grounds[g]]) return OMEGA_RES_ERR_TOPOLOGY; + t.is_ground[grounds[g]] = 1; + } + /* Every connected component needs a ground, else M is singular. Label + * components by repeated relaxation (bounded: node_count passes). */ + uint8_t comp[OMEGA_RES_MAX_NODES]; + for (uint32_t i = 0; i < node_count; i++) comp[i] = (uint8_t)i; + for (uint32_t pass = 0; pass < node_count; pass++) { + int changed = 0; + for (uint32_t e = 0; e < edge_count; e++) { + uint8_t *ca = &comp[t.edge[e].a], *cb = &comp[t.edge[e].b]; + if (*ca < *cb) { *cb = *ca; changed = 1; } + else if (*cb < *ca) { *ca = *cb; changed = 1; } + } + if (!changed) break; + } + for (uint32_t i = 0; i < node_count; i++) { + int grounded = 0; + for (uint32_t j = 0; j < node_count && !grounded; j++) grounded = comp[j] == comp[i] && t.is_ground[j]; + if (!grounded) return OMEGA_RES_ERR_TOPOLOGY; + } + *out = t; + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_topology_chain(uint32_t node_count, uint32_t ground, OmegaResTopology *out) +{ + if (!out) return OMEGA_RES_ERR_NULL; + if (node_count < 2u || node_count > OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_TOPOLOGY; + OmegaResEdge e[OMEGA_RES_MAX_NODES]; + for (uint32_t i = 0; i + 1 < node_count; i++) { e[i].a = (uint16_t)i; e[i].b = (uint16_t)(i + 1); } + return omega_res_topology_build(node_count, e, node_count - 1, &ground, 1, out); +} + +/* ----------------------------------------------------------- parameters */ + +OmegaResStatus omega_res_params_reference(OmegaResReference which, uint32_t node_count, OmegaResParams *out) +{ + if (!out) return OMEGA_RES_ERR_NULL; + if (node_count < 1u || node_count > OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_PARAM; + if (which != OMEGA_RES_REF_NARMA && which != OMEGA_RES_REF_LORENZ) return OMEGA_RES_ERR_PARAM; + OmegaResParams p; + memset(&p, 0, sizeof p); + p.node_count = node_count; + p.eps_f_per_m = which == OMEGA_RES_REF_NARMA ? 8.85e-12f : (float)(2.1 * 8.85e-12); + p.h_m = 4e-9f; + p.area_m2 = 5e-8f; + p.g_u_s = 5e-8f; + p.z = 0.00015f; + p.rate_scale = 1e4f; + p.n0_scale = 0.002f; + p.n0_rate = 3.7919f; + for (uint32_t i = 0; i < node_count; i++) { + p.conc_um[i] = (float)(1u + i % 3u); + p.tau0_s[i] = 0.001f; + p.v_tau_v[i] = which == OMEGA_RES_REF_NARMA ? 0.045f : 0.0454f; + p.v_e_v[i] = 0.0055f; + } + *out = p; + return OMEGA_RES_OK; +} + +static int pos(float x) { return fin(x) && x > 0.0f; } + +static OmegaResStatus params_check(const OmegaResParams *p, uint32_t node_count) +{ + if (p->node_count != node_count) return OMEGA_RES_ERR_PARAM; + if (!pos(p->eps_f_per_m) || !pos(p->h_m) || !pos(p->area_m2) || !pos(p->g_u_s)) return OMEGA_RES_ERR_PARAM; + if (!pos(p->z) || p->z > 1.0f || !pos(p->rate_scale) || !pos(p->n0_scale) || !fin(p->n0_rate)) + return OMEGA_RES_ERR_PARAM; + for (uint32_t i = 0; i < node_count; i++) { + if (!fin(p->conc_um[i]) || p->conc_um[i] < 0.0f) return OMEGA_RES_ERR_PARAM; + if (!pos(p->tau0_s[i]) || !pos(p->v_tau_v[i]) || !pos(p->v_e_v[i])) return OMEGA_RES_ERR_PARAM; + } + return OMEGA_RES_OK; +} + +/* -------------------------------------------------------- configuration */ + +static void h_u32(sha256_ctx *c, uint32_t v) +{ + uint8_t b[4] = {(uint8_t)v, (uint8_t)(v >> 8), (uint8_t)(v >> 16), (uint8_t)(v >> 24)}; + sha256_update(c, b, 4); +} +static void h_u64(sha256_ctx *c, uint64_t v) +{ + h_u32(c, (uint32_t)v); + h_u32(c, (uint32_t)(v >> 32)); +} +static void h_u16(sha256_ctx *c, uint16_t v) +{ + uint8_t b[2] = {(uint8_t)v, (uint8_t)(v >> 8)}; + sha256_update(c, b, 2); +} +static void h_f32(sha256_ctx *c, float v) { h_u32(c, f32_bits(v)); } +static void h_domain(sha256_ctx *c, const char *domain) +{ + const uint8_t zero = 0; + sha256_init(c); + sha256_update(c, (const uint8_t *)domain, strlen(domain)); + sha256_update(c, &zero, 1); +} + +static void config_digest(const OmegaResConfig *cfg, uint8_t out[OMEGA_RES_DIGEST_SIZE]) +{ + sha256_ctx c; + const OmegaResTopology *t = &cfg->topo; + const OmegaResParams *p = &cfg->par; + h_domain(&c, OMEGA_RES_DOMAIN_CONFIG); + h_u32(&c, t->node_count); + h_u32(&c, t->edge_count); + for (uint32_t e = 0; e < t->edge_count; e++) { h_u16(&c, t->edge[e].a); h_u16(&c, t->edge[e].b); } + sha256_update(&c, t->is_ground, t->node_count); + h_f32(&c, p->eps_f_per_m); h_f32(&c, p->h_m); h_f32(&c, p->area_m2); h_f32(&c, p->g_u_s); + h_f32(&c, p->z); h_f32(&c, p->rate_scale); h_f32(&c, p->n0_scale); h_f32(&c, p->n0_rate); + for (uint32_t i = 0; i < t->node_count; i++) { + h_f32(&c, p->conc_um[i]); h_f32(&c, p->tau0_s[i]); h_f32(&c, p->v_tau_v[i]); h_f32(&c, p->v_e_v[i]); + } + h_f32(&c, cfg->integ.step_s); + h_u32(&c, cfg->integ.steps_per_knot); + sha256_update(&c, (const uint8_t *)OMEGA_RES_NUMERIC_POLICY, strlen(OMEGA_RES_NUMERIC_POLICY)); + sha256_final(&c, out); +} + +OmegaResStatus omega_res_config_build(const OmegaResTopology *topo, const OmegaResParams *par, + const OmegaResIntegrator *integ, OmegaResConfig *out) +{ + if (!topo || !par || !integ || !out) return OMEGA_RES_ERR_NULL; + if (!omega_numeric_fpenv_ok()) return OMEGA_RES_ERR_FPENV; + /* Re-derive the topology from its own edges and grounds: only a + * canonical, valid topology is accepted, whoever filled the struct. */ + uint32_t grounds[OMEGA_RES_MAX_NODES], ng = 0; + if (topo->node_count < 2u || topo->node_count > OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_TOPOLOGY; + for (uint32_t i = 0; i < topo->node_count; i++) + if (topo->is_ground[i]) grounds[ng++] = i; + OmegaResTopology canon; + OmegaResStatus st = omega_res_topology_build(topo->node_count, topo->edge, topo->edge_count, grounds, ng, &canon); + if (st != OMEGA_RES_OK) return st; + if (memcmp(&canon, topo, sizeof canon) != 0) return OMEGA_RES_ERR_TOPOLOGY; + st = params_check(par, topo->node_count); + if (st != OMEGA_RES_OK) return st; + if (!pos(integ->step_s) || integ->step_s > OMEGA_RES_MAX_STEP_S) return OMEGA_RES_ERR_PARAM; + if (integ->steps_per_knot < 1u || integ->steps_per_knot > (1u << 20)) return OMEGA_RES_ERR_PARAM; + + OmegaResConfig c; + memset(&c, 0, sizeof c); + c.topo = canon; + c.par = *par; + c.integ = *integ; + const uint32_t n = canon.node_count; + float cap = omega_math_div(par->eps_f_per_m * par->area_m2, par->h_m); + c.inv_cap = omega_math_div(1.0f, cap); + c.g_unit = par->g_u_s * par->area_m2; + c.lambda_unit = omega_math_div(par->g_u_s * par->h_m, par->eps_f_per_m); + c.half_step = integ->step_s * 0.5f; + c.sixth_step = omega_math_div(integ->step_s, 6.0f); + if (!pos(cap) || !pos(c.inv_cap) || !pos(c.g_unit) || !pos(c.lambda_unit) || !pos(c.sixth_step)) + return OMEGA_RES_ERR_PARAM; + const float ln_n0_scale = omega_math_log(par->n0_scale); + for (uint32_t i = 0; i < n; i++) { + c.ln_n0[i] = ln_n0_scale + par->n0_rate * par->conc_um[i]; + c.ln_alpha0[i] = omega_math_log(omega_math_div(par->rate_scale, par->tau0_s[i])); + c.inv_v_tau[i] = omega_math_div(1.0f, par->v_tau_v[i]); + c.inv_v_e[i] = omega_math_div(1.0f, par->v_e_v[i]); + if (!fin(c.ln_n0[i]) || c.ln_n0[i] < OMEGA_RES_Y_MIN || c.ln_n0[i] > OMEGA_RES_Y_MAX) return OMEGA_RES_ERR_PARAM; + if (!fin(c.ln_alpha0[i]) || !pos(c.inv_v_tau[i]) || !pos(c.inv_v_e[i])) return OMEGA_RES_ERR_PARAM; + } + /* Reduced Laplacian (integer entries) and its Cholesky factor R. */ + uint32_t m = 0; + for (uint32_t i = 0; i < n; i++) { + c.reduced_index[i] = -1; + if (!canon.is_ground[i]) { c.reduced_index[i] = (int16_t)m; c.reduced_node[m] = (uint16_t)i; m++; } + } + c.reduced_count = m; + float *R = c.chol; /* holds the Laplacian, overwritten in place by R */ + for (uint32_t u = 0; u < m; u++) R[u * OMEGA_RES_MAX_NODES + u] = (float)canon.degree[c.reduced_node[u]]; + for (uint32_t e = 0; e < canon.edge_count; e++) { + int ra = c.reduced_index[canon.edge[e].a], rb = c.reduced_index[canon.edge[e].b]; + if (ra < 0 || rb < 0) continue; + int hi = ra > rb ? ra : rb, lo = ra > rb ? rb : ra; + R[(uint32_t)hi * OMEGA_RES_MAX_NODES + (uint32_t)lo] = -1.0f; + } + for (uint32_t i = 0; i < m; i++) { + for (uint32_t j = 0; j <= i; j++) { + float s = R[i * OMEGA_RES_MAX_NODES + j]; + for (uint32_t k = 0; k < j; k++) s = s - R[i * OMEGA_RES_MAX_NODES + k] * R[j * OMEGA_RES_MAX_NODES + k]; + if (i == j) { + if (!(s > 0.0f)) return OMEGA_RES_ERR_SINGULAR; + R[i * OMEGA_RES_MAX_NODES + i] = omega_math_sqrt(s); + c.chol_inv_diag[i] = omega_math_div(1.0f, R[i * OMEGA_RES_MAX_NODES + i]); + } else { + R[i * OMEGA_RES_MAX_NODES + j] = s * c.chol_inv_diag[j]; + } + } + } + config_digest(&c, c.id); + *out = c; + return OMEGA_RES_OK; +} + +const uint8_t *omega_res_config_id(const OmegaResConfig *cfg) { return cfg ? cfg->id : NULL; } + +/* ---------------------------------------------------------------- state */ + +OmegaResStatus omega_res_state_init(const OmegaResConfig *cfg, OmegaResInit kind, float value, OmegaResState *out) +{ + if (!cfg || !out) return OMEGA_RES_ERR_NULL; + OmegaResState s; + memset(&s, 0, sizeof s); + memcpy(s.config_id, cfg->id, OMEGA_RES_DIGEST_SIZE); + s.node_count = cfg->topo.node_count; + s.side_count = 2u * cfg->topo.edge_count; + float y_const = 0.0f; + if (kind == OMEGA_RES_INIT_CONST) { + if (!pos(value)) return OMEGA_RES_ERR_PARAM; + y_const = omega_math_log(value); + if (!fin(y_const) || y_const < OMEGA_RES_Y_MIN || y_const > OMEGA_RES_Y_MAX) return OMEGA_RES_ERR_RANGE; + } else if (kind != OMEGA_RES_INIT_N0) { + return OMEGA_RES_ERR_PARAM; + } + for (uint32_t e = 0; e < cfg->topo.edge_count; e++) { + s.y[2 * e] = kind == OMEGA_RES_INIT_N0 ? cfg->ln_n0[cfg->topo.edge[e].a] : y_const; + s.y[2 * e + 1] = kind == OMEGA_RES_INIT_N0 ? cfg->ln_n0[cfg->topo.edge[e].b] : y_const; + } + *out = s; + return OMEGA_RES_OK; +} + +float omega_res_state_pore(const OmegaResState *s, uint32_t side) +{ + if (!s || side >= s->side_count || side >= OMEGA_RES_MAX_SIDES) { + const uint32_t qnan = OMEGA_QNAN_BITS; + float f; + memcpy(&f, &qnan, 4); + return f; /* no such side: NaN, never a plausible density */ + } + return omega_math_exp(s->y[side]); +} + +/* Every value finite and in its declared bounds; grounds exactly zero. */ +static OmegaResStatus state_check(const OmegaResConfig *cfg, const OmegaResState *s) +{ + if (memcmp(s->config_id, cfg->id, OMEGA_RES_DIGEST_SIZE) != 0) return OMEGA_RES_ERR_MISMATCH; + if (s->node_count != cfg->topo.node_count || s->side_count != 2u * cfg->topo.edge_count) + return OMEGA_RES_ERR_MISMATCH; + for (uint32_t i = 0; i < s->node_count; i++) { + if (!fin(s->v[i]) || !fin(s->vc[i])) return OMEGA_RES_ERR_NONFINITE; + if ((cfg->topo.is_ground[i] && s->v[i] != 0.0f) || !carry_ok(s->v[i], s->vc[i])) return OMEGA_RES_ERR_RANGE; + } + /* The voltage guard is on each membrane; node voltages are finite only. */ + for (uint32_t e = 0; e < cfg->topo.edge_count; e++) { + const float dv = s->v[cfg->topo.edge[e].a] - s->v[cfg->topo.edge[e].b]; + if (!(fabs32(dv) <= OMEGA_RES_VM_LIMIT)) return OMEGA_RES_ERR_RANGE; /* also an overflowed difference */ + } + for (uint32_t k = 0; k < s->side_count; k++) { + if (!fin(s->y[k]) || !fin(s->yc[k])) return OMEGA_RES_ERR_NONFINITE; + if (s->y[k] < OMEGA_RES_Y_MIN || s->y[k] > OMEGA_RES_Y_MAX || !carry_ok(s->y[k], s->yc[k])) + return OMEGA_RES_ERR_RANGE; + } + return OMEGA_RES_OK; +} + +/* ------------------------------------------------------------ dynamics */ + +/* y' of the side owned by node i with dv = V_i - V_other; *lam = alpha Z e^w. */ +static float side_rate(const OmegaResConfig *cfg, uint32_t i, float dv, float y, float *lam) +{ + float alpha = omega_math_exp(cfg->ln_alpha0[i] - dv * cfg->inv_v_tau[i]); + float ln_nss = cfg->ln_n0[i] + dv * cfg->inv_v_e[i]; + float w = cfg->par.z * (y - ln_nss); + float r = one_minus_exp(w); + if (lam) *lam = (alpha * cfg->par.z) * (1.0f - r); + return alpha * r; +} + +/* f(V, y) at injected currents cur (header: "Order inside one derivative + * evaluation"). lam is NULL except at stage 1. */ +static void derivative(const OmegaResConfig *cfg, OmegaResWorkspace *ws, const float *v, const float *y, + const float *cur, float *dv_out, float *dy_out, float *lam) +{ + const OmegaResTopology *t = &cfg->topo; + float *b = ws->b, *r = ws->r; + float lmax = 0.0f; + for (uint32_t i = 0; i < t->node_count; i++) b[i] = cur[i]; + for (uint32_t e = 0; e < t->edge_count; e++) { + const uint32_t na = t->edge[e].a, nb = t->edge[e].b; + const float dv = v[na] - v[nb]; + float la = 0.0f, lb = 0.0f; + dy_out[2 * e] = side_rate(cfg, na, dv, y[2 * e], lam ? &la : NULL); + dy_out[2 * e + 1] = side_rate(cfg, nb, -dv, y[2 * e + 1], lam ? &lb : NULL); + const float pores = omega_math_exp(y[2 * e]) + omega_math_exp(y[2 * e + 1]); + const float q = (cfg->g_unit * pores) * dv; + b[na] = b[na] - q; + b[nb] = b[nb] + q; + if (lam) { + float lv = cfg->lambda_unit * pores; + /* written so that NaN propagates into lmax */ + if (!(la <= lmax)) lmax = la; + if (!(lb <= lmax)) lmax = lb; + if (!(lv <= lmax)) lmax = lv; + } + } + const uint32_t m = cfg->reduced_count; + const float *R = cfg->chol; + for (uint32_t u = 0; u < m; u++) r[u] = b[cfg->reduced_node[u]] * cfg->inv_cap; + for (uint32_t i = 0; i < m; i++) { /* forward: R z = r (z overwrites r) */ + float s = r[i]; + for (uint32_t k = 0; k < i; k++) s = s - R[i * OMEGA_RES_MAX_NODES + k] * r[k]; + r[i] = s * cfg->chol_inv_diag[i]; + } + for (uint32_t ii = m; ii-- > 0;) { /* backward: R^T x = z (x overwrites z) */ + float s = r[ii]; + for (uint32_t k = ii + 1; k < m; k++) s = s - R[k * OMEGA_RES_MAX_NODES + ii] * r[k]; + r[ii] = s * cfg->chol_inv_diag[ii]; + } + for (uint32_t i = 0; i < t->node_count; i++) { + int u = cfg->reduced_index[i]; + dv_out[i] = u < 0 ? 0.0f : r[u]; + } + if (lam) *lam = lmax; +} + +OmegaResStatus omega_res_stiffness(const OmegaResConfig *cfg, const OmegaResState *s, float *lambda) +{ + if (!cfg || !s || !lambda) return OMEGA_RES_ERR_NULL; + OmegaResStatus st = state_check(cfg, s); + if (st != OMEGA_RES_OK) return st; + float lmax = 0.0f; + for (uint32_t e = 0; e < cfg->topo.edge_count; e++) { + const uint32_t na = cfg->topo.edge[e].a, nb = cfg->topo.edge[e].b; + const float dv = s->v[na] - s->v[nb]; + float la, lb; + (void)side_rate(cfg, na, dv, s->y[2 * e], &la); + (void)side_rate(cfg, nb, -dv, s->y[2 * e + 1], &lb); + float lv = cfg->lambda_unit * (omega_math_exp(s->y[2 * e]) + omega_math_exp(s->y[2 * e + 1])); + if (!(la <= lmax)) lmax = la; + if (!(lb <= lmax)) lmax = lb; + if (!(lv <= lmax)) lmax = lv; + } + if (!fin(lmax)) return OMEGA_RES_ERR_NONFINITE; + *lambda = lmax; + return OMEGA_RES_OK; +} + +/* ---------------------------------------------------------------- input */ + +static OmegaResStatus knot_check(const OmegaResInput *in, uint32_t k) +{ + const float *row = in->current_a + (size_t)k * in->node_count; + for (uint32_t i = 0; i < in->node_count; i++) { + if (!fin(row[i])) return OMEGA_RES_ERR_NONFINITE; + if (fabs32(row[i]) > OMEGA_RES_MAX_CURRENT_A) return OMEGA_RES_ERR_INPUT; + } + return OMEGA_RES_OK; +} + +/* Current at stage time t_n + (half_steps / 2) h, half_steps in {0, 1, 2}. */ +static void input_at(const OmegaResInput *in, uint32_t k, uint32_t phase, uint32_t K, uint32_t half_steps, float *cur) +{ + const float f = omega_math_div((float)(2u * phase + half_steps), (float)(2u * K)); + const float *i0 = in->current_a + (size_t)k * in->node_count; + const float *i1 = i0 + in->node_count; + for (uint32_t i = 0; i < in->node_count; i++) cur[i] = i0[i] + f * (i1[i] - i0[i]); +} + +/* ------------------------------------------------------------- stepping */ + +static int overlaps(const void *p, size_t np, const void *q, size_t nq) +{ + const uint8_t *a = p, *b = q; + return a < b + nq && b < a + np; +} + +/* The scratch part of the workspace is everything before `spare`. */ +#define SCRATCH_BYTES offsetof(OmegaResWorkspace, spare) + +/* One step, pointers already checked for NULL and aliasing. */ +static OmegaResStatus step_impl(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + const OmegaResState *cur, OmegaResState *next) +{ + if (!in->current_a) return OMEGA_RES_ERR_NULL; + if (!omega_numeric_fpenv_ok()) return OMEGA_RES_ERR_FPENV; + OmegaResStatus st = state_check(cfg, cur); + if (st != OMEGA_RES_OK) return st; + if (in->node_count != cfg->topo.node_count || in->knot_count < 2u) return OMEGA_RES_ERR_INPUT; + const uint32_t K = cfg->integ.steps_per_knot; + const uint64_t k64 = cur->step / K; + if (k64 + 1u >= in->knot_count) return OMEGA_RES_ERR_INPUT; /* past the last knot */ + const uint32_t k = (uint32_t)k64, phase = (uint32_t)(cur->step % K); + if ((st = knot_check(in, k)) != OMEGA_RES_OK || (st = knot_check(in, k + 1u)) != OMEGA_RES_OK) return st; + + const uint32_t n = cfg->topo.node_count, ns = cur->side_count; + const float h = cfg->integ.step_s, h2 = cfg->half_step, h6 = cfg->sixth_step; + float lam = 0.0f; + input_at(in, k, phase, K, 0u, ws->cur); + derivative(cfg, ws, cur->v, cur->y, ws->cur, ws->kv[0], ws->ky[0], &lam); + if (!(h * lam <= OMEGA_RES_STABILITY_LIMIT)) return fin(lam) ? OMEGA_RES_ERR_STIFF : OMEGA_RES_ERR_NONFINITE; + for (int s = 1; s < 4; s++) { + const float c = s == 3 ? h : h2; + for (uint32_t i = 0; i < n; i++) ws->sv[i] = cur->v[i] + c * ws->kv[s - 1][i]; + for (uint32_t j = 0; j < ns; j++) ws->sy[j] = cur->y[j] + c * ws->ky[s - 1][j]; + input_at(in, k, phase, K, s == 3 ? 2u : 1u, ws->cur); + derivative(cfg, ws, ws->sv, ws->sy, ws->cur, ws->kv[s], ws->ky[s], NULL); + } + OmegaResState out; + memset(&out, 0, sizeof out); + memcpy(out.config_id, cur->config_id, OMEGA_RES_DIGEST_SIZE); + out.step = cur->step + 1u; + out.node_count = n; + out.side_count = ns; + for (uint32_t i = 0; i < n; i++) { + const float d = h6 * (((ws->kv[0][i] + 2.0f * ws->kv[1][i]) + 2.0f * ws->kv[2][i]) + ws->kv[3][i]); + out.v[i] = two_sum(cur->v[i], d + cur->vc[i], &out.vc[i]); + } + for (uint32_t j = 0; j < ns; j++) { + const float d = h6 * (((ws->ky[0][j] + 2.0f * ws->ky[1][j]) + 2.0f * ws->ky[2][j]) + ws->ky[3][j]); + out.y[j] = two_sum(cur->y[j], d + cur->yc[j], &out.yc[j]); + } + st = state_check(cfg, &out); + if (st != OMEGA_RES_OK) return st; + *next = out; + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_step(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + const OmegaResState *cur, OmegaResState *next) +{ + if (!cfg || !in || !ws || !cur || !next) return OMEGA_RES_ERR_NULL; + if (overlaps(cur, sizeof *cur, next, sizeof *next) || overlaps(ws, SCRATCH_BYTES, cur, sizeof *cur) || + overlaps(ws, SCRATCH_BYTES, next, sizeof *next) || overlaps(ws, sizeof *ws, cfg, sizeof *cfg) || + overlaps(next, sizeof *next, cfg, sizeof *cfg) || overlaps(next, sizeof *next, in, sizeof *in)) + return OMEGA_RES_ERR_ALIAS; + return step_impl(cfg, in, ws, cur, next); +} + +void omega_res_membrane_stats_init(OmegaResMembraneStats *st) +{ + if (st) memset(st, 0, sizeof *st); +} + +OmegaResStatus omega_res_membrane_observe(const OmegaResConfig *cfg, const OmegaResState *s, + OmegaResMembraneStats *st) +{ + if (!cfg || !s || !st) return OMEGA_RES_ERR_NULL; + if (memcmp(s->config_id, cfg->id, OMEGA_RES_DIGEST_SIZE) != 0 || s->node_count != cfg->topo.node_count) + return OMEGA_RES_ERR_MISMATCH; + for (uint32_t i = 0; i < s->node_count; i++) { + const float m = fabs32(s->v[i]); + if (m > st->max_node_abs_v) st->max_node_abs_v = m; + } + int any = 0; + for (uint32_t e = 0; e < cfg->topo.edge_count; e++) { + const float dv = fabs32(s->v[cfg->topo.edge[e].a] - s->v[cfg->topo.edge[e].b]); + if (dv > st->max_membrane_abs_v) st->max_membrane_abs_v = dv; + if (dv > OMEGA_RES_VM_PLAUSIBLE) { + any = 1; + if (!st->edge_flag[e]) { + st->edge_flag[e] = 1u; + st->membranes_implausible++; + } + } + } + st->states_observed++; + if (any) st->states_implausible++; + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_advance(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + OmegaResState *s, uint64_t steps) +{ + return omega_res_advance_observed(cfg, in, ws, s, steps, NULL); +} + +OmegaResStatus omega_res_advance_observed(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + OmegaResState *s, uint64_t steps, OmegaResMembraneStats *obs) +{ + if (!cfg || !in || !ws || !s) return OMEGA_RES_ERR_NULL; + if (overlaps(ws, sizeof *ws, s, sizeof *s) || overlaps(ws, sizeof *ws, cfg, sizeof *cfg) || + overlaps(s, sizeof *s, cfg, sizeof *cfg) || overlaps(s, sizeof *s, in, sizeof *in)) + return OMEGA_RES_ERR_ALIAS; + if (obs && (overlaps(obs, sizeof *obs, s, sizeof *s) || overlaps(obs, sizeof *obs, ws, sizeof *ws) || + overlaps(obs, sizeof *obs, cfg, sizeof *cfg))) + return OMEGA_RES_ERR_ALIAS; + /* Double buffering: the two state buffers are *s and ws->spare. */ + OmegaResState *a = s, *b = &ws->spare; + OmegaResStatus st = OMEGA_RES_OK; + for (uint64_t i = 0; i < steps; i++) { + st = step_impl(cfg, in, ws, a, b); + if (st != OMEGA_RES_OK) break; + if (obs) (void)omega_res_membrane_observe(cfg, b, obs); /* b passed state_check: cannot refuse */ + OmegaResState *tmp = a; + a = b; + b = tmp; + } + if (a != s) *s = *a; + return st; +} + +/* ------------------------------------------------------------- receipts */ + +OmegaResStatus omega_res_input_digest(const OmegaResInput *in, uint8_t out[OMEGA_RES_DIGEST_SIZE]) +{ + if (!in || !in->current_a || !out) return OMEGA_RES_ERR_NULL; + sha256_ctx c; + h_domain(&c, OMEGA_RES_DOMAIN_INPUT); + h_u32(&c, in->node_count); + h_u32(&c, in->knot_count); + const size_t total = (size_t)in->node_count * in->knot_count; + uint8_t buf[1024]; + size_t used = 0; + for (size_t i = 0; i < total; i++) { + uint32_t u = f32_bits(in->current_a[i]); + buf[used++] = (uint8_t)u; buf[used++] = (uint8_t)(u >> 8); + buf[used++] = (uint8_t)(u >> 16); buf[used++] = (uint8_t)(u >> 24); + if (used == sizeof buf) { sha256_update(&c, buf, used); used = 0; } + } + if (used) sha256_update(&c, buf, used); + sha256_final(&c, out); + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_state_digest(const OmegaResState *s, uint8_t out[OMEGA_RES_DIGEST_SIZE]) +{ + if (!s || !out) return OMEGA_RES_ERR_NULL; + if (s->node_count > OMEGA_RES_MAX_NODES || s->side_count > OMEGA_RES_MAX_SIDES) return OMEGA_RES_ERR_MISMATCH; + sha256_ctx c; + h_domain(&c, OMEGA_RES_DOMAIN_STATE); + sha256_update(&c, s->config_id, OMEGA_RES_DIGEST_SIZE); + h_u64(&c, s->step); + h_u32(&c, s->node_count); + h_u32(&c, s->side_count); + for (uint32_t i = 0; i < s->node_count; i++) h_f32(&c, s->v[i]); + for (uint32_t k = 0; k < s->side_count; k++) h_f32(&c, s->y[k]); + for (uint32_t i = 0; i < s->node_count; i++) h_f32(&c, s->vc[i]); + for (uint32_t k = 0; k < s->side_count; k++) h_f32(&c, s->yc[k]); + sha256_final(&c, out); + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_run_receipt(const OmegaResConfig *cfg, const OmegaResInput *in, + const OmegaResState *final_state, OmegaResRunReceipt *out) +{ + if (!cfg || !in || !final_state || !out) return OMEGA_RES_ERR_NULL; + OmegaResStatus st = state_check(cfg, final_state); + if (st != OMEGA_RES_OK) return st; + OmegaResRunReceipt r; + memset(&r, 0, sizeof r); + memcpy(r.config_id, cfg->id, OMEGA_RES_DIGEST_SIZE); + if ((st = omega_res_input_digest(in, r.input_digest)) != OMEGA_RES_OK) return st; + if ((st = omega_res_state_digest(final_state, r.final_state_digest)) != OMEGA_RES_OK) return st; + r.steps = final_state->step; + sha256_ctx c; + h_domain(&c, OMEGA_RES_DOMAIN_RUN); + sha256_update(&c, r.config_id, OMEGA_RES_DIGEST_SIZE); + sha256_update(&c, r.input_digest, OMEGA_RES_DIGEST_SIZE); + h_u64(&c, r.steps); + sha256_update(&c, r.final_state_digest, OMEGA_RES_DIGEST_SIZE); + sha256_final(&c, r.run_id); + *out = r; + return OMEGA_RES_OK; +} diff --git a/src/reservoir/omega_reservoir.h b/src/reservoir/omega_reservoir.h new file mode 100644 index 000000000..6c5aab007 --- /dev/null +++ b/src/reservoir/omega_reservoir.h @@ -0,0 +1,368 @@ +/* Omega ionic-droplet reservoir: deterministic CPU reference (omega#440, Gate 1). + * + * A software simulation of the current-driven droplet-network model of + * Armendarez et al., Sci. Adv. 12(30) eaed0971 (2026), Text S4. What the + * authors' MATLAB code actually integrates, the provenance, every + * paper-versus-code discrepancy and the Gate 2 comparison contract are in + * docs/reservoir/RESERVOIR_REFERENCE.md. The authors' code is a correctness + * check only; this module is not a port of it. + * + * Model (SI units throughout: s, V, A, F, S, m, m^2; pore densities are the + * dimensionless numbers the reference uses): + * L droplets (nodes) with voltages V_i; ground nodes are held at V = 0. + * Each membrane (undirected edge a-b) has two pore populations, one per + * side: N_ab (droplet a's side) and N_ba. dV_ab = V_a - V_b. + * C_m = eps * A / h_m membrane capacitance + * g_ab = G_u * A * (N_ab + N_ba) membrane conductance + * M V' = B, M = C_m * Laplacian (ground rows and columns removed) + * B_i = I_i - sum_j g_ij (V_i - V_j) + * alpha_ab = rate_scale / (tau0_a * e^(dV_ab / v_tau_a)) + * Nss_ab = n0_scale * e^(n0_rate * c_a) * e^(dV_ab / v_e_a) + * N_ab' = alpha_ab * N_ab * (1 - (N_ab / Nss_ab)^Z) + * Parameters of side a-b are those of droplet a (the reference does the + * same). The constants of the two reference tasks are in + * omega_res_params_reference(). + * + * State variable change (exact for N > 0, which every reference initial + * condition satisfies): the module integrates y = ln N, so + * y_ab' = alpha_ab * (1 - e^w), w = Z * (y_ab - ln Nss_ab). + * Reasons: N spans ~40 orders of magnitude (Nss grows e-fold every 5.5 mV), + * e^y > 0 keeps every density positive under an explicit integrator, and + * with Z = 1.5e-4 the factor 1 - (N/Nss)^Z computed directly in binary32 + * keeps only ~3 significant digits; 1 - e^w is evaluated by a series for + * |w| <= 1/2 without cancellation. + * + * Precision and arithmetic (declared, frozen in OMEGA_RES_NUMERIC_POLICY): + * - binary32 everywhere in the state transition, round to nearest even, + * no flush to zero (omega_numeric_fpenv_ok() is checked; refusal + * OMEGA_RES_ERR_FPENV). Build with -ffp-contract=off -fno-fast-math: + * no fused multiply-add, every operation rounds once. + * - exp, log, divide, sqrt: omega_math_exp / omega_math_log / + * omega_math_div / omega_math_sqrt (src/omega_numeric.h). No libm. + * - 1 - e^w: w * P(w) with P the degree-9 Taylor polynomial of + * (e^w - 1)/w in Horner form, negated, for |w| <= 0.5; + * 1 - omega_math_exp(w) otherwise. + * + * Integrator: classical fourth-order Runge-Kutta, fixed step h seconds + * (OmegaResIntegrator). Time is the integer step index n; t = n * h is only + * reported. Stage order: k1 = f(S); k2 = f(S + (h/2) k1); k3 = f(S + (h/2) k2); + * k4 = f(S + h k3); d = (h/6) * (((k1 + 2 k2) + 2 k3) + k4), element by + * element, V before y. h/2 = h * 0.5 (exact), h/6 = omega_math_div(h, 6). + * The update S' = S + d is compensated: with carry c (OmegaResState.vc/yc), + * a = d + c; S' = fl(S + a); c' = the exact rounding error of S + a (TwoSum, + * six binary32 operations). Without it the increments near an equilibrium + * fall below half an ulp of S and are lost, so the error grew as h shrank + * (measured against the binary64 oracle, one-node case: 2.1e-6 V at + * h = 1e-5 s, 6.0e-6 V at h = 5e-6 s; with the carry 1.5e-8 V, about two + * ulps of V, flat from h = 1e-4 s to 5e-6 s). Stages use S, not S + c. + * + * Order inside one derivative evaluation f: + * 1. B_i = I_i(t) for every node, then edges in canonical order (a < b, + * sorted by (a, b)): dv = V_a - V_b; side ab then side ba compute + * alpha, ln Nss, w, y'; g = (G_u * A) * (e^y_ab + e^y_ba); + * q = g * dv; B_a = B_a - q; B_b = B_b + q. + * 2. r_u = B_u * (1 / C_m) for every non-ground node u in node order. + * 3. Laplacian (reduced, integer entries) = R R^T, R lower triangular, + * factored once at omega_res_config_build in binary32; forward then + * backward substitution with the stored reciprocals of R's diagonal. + * 4. V'_ground = 0, so ground voltages stay exactly 0. + * + * Input: piecewise-linear injected current on a uniform knot grid, + * steps_per_knot integration steps per knot interval (the reference + * interpolates its 0.1 ms current samples linearly). At stage time + * t_n + theta h (theta in {0, 1/2, 1}) inside interval k with phase j: + * I = I_k + f * (I_(k+1) - I_k), f = omega_math_div(2j + 2 theta, 2 K). + * Injected current at a ground node is ignored (the reference drops it). + * + * Stiffness guard: before each step the module bounds the fastest decay + * rate lambda = max( max_edges G_u h_m (N_ab + N_ba) / eps, + * max_sides alpha Z e^w ) + * (the first term is a Rayleigh-quotient bound on the eigenvalues of + * M^-1 G; membrane area cancels) and refuses with OMEGA_RES_ERR_STIFF when + * h * lambda > OMEGA_RES_STABILITY_LIMIT (2.0; RK4's real-axis limit is + * ~2.785). The guard covers the diagonal blocks only. Accuracy is shown by + * the convergence test against an independent binary64 oracle + * (tests/reservoir), not by this guard. + * + * Refusals, never silent repair: invalid topology or parameters, NaN or + * infinity anywhere, a membrane voltage |V_a - V_b| > OMEGA_RES_VM_LIMIT, y + * outside [OMEGA_RES_Y_MIN, OMEGA_RES_Y_MAX], current outside +-OMEGA_RES_MAX_CURRENT_A, time past + * the last knot, a state bound to another configuration. A refused step + * leaves the caller's state unchanged. + * + * Bounded, no allocation, no globals: every buffer is a fixed-size member of + * a caller-owned struct. Nothing here reads or writes an OmegaTensor; Gate 2 + * adapters copy into new tensors. Identity: SHA-256(domain || 0x00 || + * canonical little-endian encoding) via src/sha256.c, the same rule as + * src/estimation/est_types.h. */ +#ifndef OMEGA_RESERVOIR_H +#define OMEGA_RESERVOIR_H + +#include +#include + +#define OMEGA_RES_MAX_NODES 64u +#define OMEGA_RES_MAX_DEGREE 6u /* six-neighbour lattice; chains use <= 2 */ +#define OMEGA_RES_MAX_EDGES (OMEGA_RES_MAX_NODES * OMEGA_RES_MAX_DEGREE / 2u) +#define OMEGA_RES_MAX_SIDES (2u * OMEGA_RES_MAX_EDGES) + +#define OMEGA_RES_STABILITY_LIMIT 2.0f /* max h * lambda accepted per step */ +/* Voltage guard (orchestrator decision 2026-10-14, after the first Gate 2 run, + * RESERVOIR_REFERENCE.md section 12): the refusal applies to the voltage + * across each membrane, |V_a - V_b|, which is what the pore kinetics see. + * Node voltages are referenced to the common ground and add up along a + * chain, so they get no bound beyond finiteness. 1 V is a numerical guard + * that catches blowups; it is not a physical limit. Membranes above + * OMEGA_RES_VM_PLAUSIBLE are counted as physically implausible (the paper: + * rupture "when voltages exceed ~200 to 300 mV"), recorded, never refused. */ +#define OMEGA_RES_VM_LIMIT 1.0f /* |V_a - V_b| above 1 V: refused */ +#define OMEGA_RES_VM_PLAUSIBLE 0.3f /* |V_a - V_b| above 0.3 V: flagged */ +#define OMEGA_RES_Y_MIN (-80.0f) /* ln N bounds: e^y stays a normal float */ +#define OMEGA_RES_Y_MAX 80.0f +#define OMEGA_RES_MAX_CURRENT_A 1.0e-6f /* 1 uA; the reference uses <= 1 nA */ +#define OMEGA_RES_MAX_STEP_S 1.0e-3f +#define OMEGA_RES_DIGEST_SIZE 32u + +#define OMEGA_RES_DOMAIN_CONFIG "omega.reservoir.config.v1" +#define OMEGA_RES_DOMAIN_INPUT "omega.reservoir.input.v1" +#define OMEGA_RES_DOMAIN_STATE "omega.reservoir.state.v1" +#define OMEGA_RES_DOMAIN_RUN "omega.reservoir.run.v1" +#define OMEGA_RES_NUMERIC_POLICY \ + "omega.reservoir.numeric.v2: binary32 RNE no-FTZ; ffp-contract=off; " \ + "omega_math_exp/log/div/sqrt; state y=lnN; rk4 fixed step, TwoSum-compensated update; " \ + "1-e^w Taylor9 |w|<=0.5; dense Cholesky of reduced Laplacian; " \ + "refuse |Va-Vb|>1 V per membrane, node V finite only" + +typedef enum { + OMEGA_RES_OK = 0, + OMEGA_RES_ERR_NULL = -1, + OMEGA_RES_ERR_TOPOLOGY = -2, /* bad node/edge count, self loop, duplicate, + degree > 6, isolated node, no ground, or a + connected component without a ground */ + OMEGA_RES_ERR_PARAM = -3, /* parameter non-finite or out of its range */ + OMEGA_RES_ERR_NONFINITE = -4, /* NaN or infinity in input, state or result */ + OMEGA_RES_ERR_RANGE = -5, /* membrane |V_a - V_b| or ln N outside the bounds */ + OMEGA_RES_ERR_STIFF = -6, /* h * lambda above OMEGA_RES_STABILITY_LIMIT */ + OMEGA_RES_ERR_INPUT = -7, /* input shape, current bound, time past last knot */ + OMEGA_RES_ERR_MISMATCH = -8, /* state bound to another configuration */ + OMEGA_RES_ERR_FPENV = -9, /* FPCR is not round-to-nearest with FZ clear */ + OMEGA_RES_ERR_SINGULAR = -10, /* reduced Laplacian or normal matrix not PD */ + OMEGA_RES_ERR_ALIAS = -11 /* input and output buffers overlap */ +} OmegaResStatus; + +/* ------------------------------------------------------------- topology */ + +/* Undirected membrane between nodes a < b (0-based). */ +typedef struct { + uint16_t a, b; +} OmegaResEdge; + +/* Built only by omega_res_topology_build / omega_res_topology_chain, which + * validate and canonicalize: edges sorted by (a, b), degree[] filled. A node + * is a boundary node of a six-neighbour lattice when degree < 6. */ +typedef struct { + uint32_t node_count; + uint32_t edge_count; + OmegaResEdge edge[OMEGA_RES_MAX_EDGES]; + uint8_t degree[OMEGA_RES_MAX_NODES]; + uint8_t is_ground[OMEGA_RES_MAX_NODES]; +} OmegaResTopology; + +/* Edges may be listed in any order and either orientation; grounds are node + * indices. Refuses (OMEGA_RES_ERR_TOPOLOGY) as listed in OmegaResStatus. */ +OmegaResStatus omega_res_topology_build(uint32_t node_count, const OmegaResEdge *edges, uint32_t edge_count, + const uint32_t *grounds, uint32_t ground_count, OmegaResTopology *out); + +/* Path 0-1-...-(n-1) with one ground node (the reference Length5/10/20 + * chains are this with ground = n-1). */ +OmegaResStatus omega_res_topology_chain(uint32_t node_count, uint32_t ground, OmegaResTopology *out); + +/* ----------------------------------------------------------- parameters */ + +/* Per-node arrays hold node_count meaningful entries. All values binary32. */ +typedef struct { + uint32_t node_count; + float eps_f_per_m; /* permittivity, F/m (> 0) */ + float h_m; /* membrane thickness, m (> 0) */ + float area_m2; /* membrane area, m^2, same for every membrane (> 0) */ + float g_u_s; /* single-pore conductance G_u, S (> 0) */ + float z; /* insertion shape exponent Z, 0 < Z <= 1 */ + float rate_scale; /* multiplies 1/tau0 (the reference's 1e4), > 0 */ + float n0_scale; /* Nss prefactor (0.002), > 0 */ + float n0_rate; /* Nss concentration slope (3.7919 per uM), finite */ + float conc_um[OMEGA_RES_MAX_NODES]; /* Alm concentration c_i, uM, >= 0 */ + float tau0_s[OMEGA_RES_MAX_NODES]; /* > 0 */ + float v_tau_v[OMEGA_RES_MAX_NODES]; /* > 0 */ + float v_e_v[OMEGA_RES_MAX_NODES]; /* > 0 */ +} OmegaResParams; + +typedef enum { + OMEGA_RES_REF_NARMA = 1, /* HyperParameterTuningOptimized.m constants */ + OMEGA_RES_REF_LORENZ = 2 /* Lorenz63SolverCustomRegression*.m constants */ +} OmegaResReference; + +/* The reference constants for node_count nodes, concentrations 1,2,3,1,2,3.. + * by node index (file:line for every value in RESERVOIR_REFERENCE.md). */ +OmegaResStatus omega_res_params_reference(OmegaResReference which, uint32_t node_count, OmegaResParams *out); + +/* ----------------------------------------------------------- integrator */ + +typedef struct { + float step_s; /* RK4 step h, 0 < h <= OMEGA_RES_MAX_STEP_S */ + uint32_t steps_per_knot; /* K: input knot spacing = K * h, K >= 1 */ +} OmegaResIntegrator; + +/* --------------------------------------------------------- configuration */ + +/* Immutable after omega_res_config_build: validated copies of topology, + * parameters and integrator, derived constants, the Cholesky factor and the + * content-addressed identity. Callers must not modify it. */ +typedef struct { + OmegaResTopology topo; + OmegaResParams par; + OmegaResIntegrator integ; + uint32_t reduced_count; /* non-ground nodes */ + int16_t reduced_index[OMEGA_RES_MAX_NODES]; /* -1 for ground */ + uint16_t reduced_node[OMEGA_RES_MAX_NODES]; + float chol[OMEGA_RES_MAX_NODES * OMEGA_RES_MAX_NODES]; /* R, row-major lower */ + float chol_inv_diag[OMEGA_RES_MAX_NODES]; + float ln_n0[OMEGA_RES_MAX_NODES]; /* ln n0_scale + n0_rate * c_i */ + float ln_alpha0[OMEGA_RES_MAX_NODES]; /* ln(rate_scale / tau0_i) */ + float inv_v_tau[OMEGA_RES_MAX_NODES]; + float inv_v_e[OMEGA_RES_MAX_NODES]; + float inv_cap; /* 1 / (eps * A / h_m) */ + float g_unit; /* G_u * A */ + float lambda_unit; /* G_u * h_m / eps */ + float half_step, sixth_step; + uint8_t id[OMEGA_RES_DIGEST_SIZE]; /* omega_res_config_id */ +} OmegaResConfig; + +OmegaResStatus omega_res_config_build(const OmegaResTopology *topo, const OmegaResParams *par, + const OmegaResIntegrator *integ, OmegaResConfig *out); + +/* Identity = SHA-256(OMEGA_RES_DOMAIN_CONFIG || 0x00 || encoding), encoding + * (little-endian): u32 node_count, u32 edge_count, edge_count x (u16 a, u16 b), + * node_count x u8 is_ground, 8 global parameter float bit patterns in struct + * order, node_count x 4 per-node float bit patterns (c, tau0, v_tau, v_e per + * node), f32 step_s, u32 steps_per_knot, then the bytes of + * OMEGA_RES_NUMERIC_POLICY. -0.0 is encoded as +0.0. Equal canonical + * configurations give equal ids whatever order the edges were listed in. */ +const uint8_t *omega_res_config_id(const OmegaResConfig *cfg); + +/* ---------------------------------------------------------------- state */ + +typedef struct { + uint8_t config_id[OMEGA_RES_DIGEST_SIZE]; /* the configuration it belongs to */ + uint64_t step; /* integer time n; t = n * h */ + uint32_t node_count, side_count; + float v[OMEGA_RES_MAX_NODES]; /* node voltages, V */ + float y[OMEGA_RES_MAX_SIDES]; /* ln N; side 2e = a->b, 2e+1 = b->a */ + float vc[OMEGA_RES_MAX_NODES]; /* update carries (see "compensated"): */ + float yc[OMEGA_RES_MAX_SIDES]; /* |c| <= 2^-24 |value|, 0 at grounds */ +} OmegaResState; + +typedef enum { + OMEGA_RES_INIT_N0 = 1, /* N_ab(0) = n0_scale e^(n0_rate c_a) (NARMA reference) */ + OMEGA_RES_INIT_CONST = 2 /* N_ab(0) = value > 0 for every side (Lorenz: 1) */ +} OmegaResInit; + +/* V(0) = 0 at every node, step 0. */ +OmegaResStatus omega_res_state_init(const OmegaResConfig *cfg, OmegaResInit kind, float value, + OmegaResState *out); + +/* Pore density of one side, N = e^y (omega_math_exp). */ +float omega_res_state_pore(const OmegaResState *s, uint32_t side); + +/* ---------------------------------------------------------------- input */ + +/* current_a[k * node_count + i] = current injected into node i at knot k, + * amperes. The table is only read. Stepping from step n needs knots + * n / K and n / K + 1, so a table of knot_count knots supports steps + * 0 .. (knot_count - 1) * K. */ +typedef struct { + uint32_t node_count; + uint32_t knot_count; /* >= 2 */ + const float *current_a; +} OmegaResInput; + +/* -------------------------------------------------------------- stepping */ + +/* Scratch for one RK4 step plus the second state buffer (double buffering). */ +typedef struct { + float b[OMEGA_RES_MAX_NODES]; + float r[OMEGA_RES_MAX_NODES]; + float kv[4][OMEGA_RES_MAX_NODES]; + float ky[4][OMEGA_RES_MAX_SIDES]; + float sv[OMEGA_RES_MAX_NODES]; + float sy[OMEGA_RES_MAX_SIDES]; + float cur[OMEGA_RES_MAX_NODES]; + OmegaResState spare; +} OmegaResWorkspace; + +/* One RK4 step from *cur into *next (distinct buffers). On refusal *next is + * unspecified and *cur untouched. */ +OmegaResStatus omega_res_step(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + const OmegaResState *cur, OmegaResState *next); + +/* steps RK4 steps, ping-ponging between *s and ws->spare. On success *s is + * the state after the last step; on refusal *s is the last accepted state + * (s->step says where it stopped) and the refusal code is returned. */ +OmegaResStatus omega_res_advance(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + OmegaResState *s, uint64_t steps); + +/* Physical-plausibility record of a run (recorded, never refused): every + * accepted state passed to omega_res_membrane_observe is counted. A + * membrane is implausible when |V_a - V_b| > OMEGA_RES_VM_PLAUSIBLE. */ +typedef struct { + uint64_t states_observed; + uint64_t states_implausible; /* states with at least one implausible membrane */ + uint32_t membranes_implausible; /* distinct membranes implausible at least once */ + float max_membrane_abs_v; /* largest |V_a - V_b| seen */ + float max_node_abs_v; /* largest |V_i| seen (no bound applies) */ + uint8_t edge_flag[OMEGA_RES_MAX_EDGES]; +} OmegaResMembraneStats; + +/* Zeroes *st. */ +void omega_res_membrane_stats_init(OmegaResMembraneStats *st); + +/* Adds state s to *st. Refuses NULL and a state of another configuration. + * Does not check finiteness: pass only states the simulator accepted (as + * omega_res_advance_observed does); a NaN voltage would go uncounted. */ +OmegaResStatus omega_res_membrane_observe(const OmegaResConfig *cfg, const OmegaResState *s, + OmegaResMembraneStats *st); + +/* omega_res_advance, observing every accepted state into *st (NULL: none). */ +OmegaResStatus omega_res_advance_observed(const OmegaResConfig *cfg, const OmegaResInput *in, OmegaResWorkspace *ws, + OmegaResState *s, uint64_t steps, OmegaResMembraneStats *st); + +/* Fastest decay rate bound lambda (1/s) of the stiffness guard at state s. */ +OmegaResStatus omega_res_stiffness(const OmegaResConfig *cfg, const OmegaResState *s, float *lambda); + +/* ------------------------------------------------------------- receipts */ + +/* SHA-256(OMEGA_RES_DOMAIN_INPUT || 0x00 || u32 node_count || u32 knot_count + * || float bit patterns of the table, knot-major). */ +OmegaResStatus omega_res_input_digest(const OmegaResInput *in, uint8_t out[OMEGA_RES_DIGEST_SIZE]); + +/* SHA-256(OMEGA_RES_DOMAIN_STATE || 0x00 || config_id || u64 step || u32 + * node_count || u32 side_count || v, y, vc, yc bit patterns), -0.0 as +0.0. */ +OmegaResStatus omega_res_state_digest(const OmegaResState *s, uint8_t out[OMEGA_RES_DIGEST_SIZE]); + +/* Run receipt: binds what was run to what came out. It proves only that + * this configuration, this input and this numeric policy produced this + * final state on this CPU tier; agreement with the published reference is a + * separate Gate 2 comparison, and nothing here says anything about physical + * droplets. run_id = SHA-256(OMEGA_RES_DOMAIN_RUN || 0x00 || config_id || + * input_digest || u64 steps || final_state_digest). */ +typedef struct { + uint8_t config_id[OMEGA_RES_DIGEST_SIZE]; + uint8_t input_digest[OMEGA_RES_DIGEST_SIZE]; + uint8_t final_state_digest[OMEGA_RES_DIGEST_SIZE]; + uint64_t steps; + uint8_t run_id[OMEGA_RES_DIGEST_SIZE]; +} OmegaResRunReceipt; + +OmegaResStatus omega_res_run_receipt(const OmegaResConfig *cfg, const OmegaResInput *in, + const OmegaResState *final_state, OmegaResRunReceipt *out); + +#endif /* OMEGA_RESERVOIR_H */ diff --git a/src/reservoir/omega_reservoir_readout.c b/src/reservoir/omega_reservoir_readout.c new file mode 100644 index 000000000..7f96d875b --- /dev/null +++ b/src/reservoir/omega_reservoir_readout.c @@ -0,0 +1,122 @@ +/* Ridge readout and NRMSE; contract in omega_reservoir_readout.h. */ +#include "omega_reservoir_readout.h" + +#include + +static int fin64(double x) { return x == x && x - x == 0.0; } + +OmegaResStatus omega_res_readout_fit(const double *x, const double *y, uint32_t n_samples, uint32_t n_features, + uint32_t n_outputs, double lambda, OmegaResReadoutWorkspace *ws, + OmegaResReadout *out) +{ + if (!x || !y || !ws || !out) return OMEGA_RES_ERR_NULL; + if (n_features < 1u || n_features > OMEGA_RES_READOUT_MAX_FEATURES) return OMEGA_RES_ERR_PARAM; + if (n_outputs < 1u || n_outputs > OMEGA_RES_READOUT_MAX_OUTPUTS) return OMEGA_RES_ERR_PARAM; + if (n_samples < 1u || !fin64(lambda) || lambda < 0.0) return OMEGA_RES_ERR_PARAM; + for (size_t i = 0; i < (size_t)n_samples * n_features; i++) + if (!fin64(x[i])) return OMEGA_RES_ERR_NONFINITE; + for (size_t i = 0; i < (size_t)n_samples * n_outputs; i++) + if (!fin64(y[i])) return OMEGA_RES_ERR_NONFINITE; + + const uint32_t p = n_features + 1u; /* design columns: bias then features */ + const uint32_t D = OMEGA_RES_READOUT_DIM, O = OMEGA_RES_READOUT_MAX_OUTPUTS; + double *G = ws->g, *d = ws->d, *R = ws->rhs; + /* Lower triangle of G and all of R, each a sum over samples in order. */ + for (uint32_t i = 0; i < p; i++) { + for (uint32_t j = 0; j <= i; j++) { + double s = 0.0; + for (uint32_t t = 0; t < n_samples; t++) { + const double xi = i ? x[(size_t)t * n_features + i - 1] : 1.0; + const double xj = j ? x[(size_t)t * n_features + j - 1] : 1.0; + s = s + xi * xj; + } + G[i * D + j] = s; + } + if (i) G[i * D + i] = G[i * D + i] + lambda; + for (uint32_t o = 0; o < n_outputs; o++) { + double s = 0.0; + for (uint32_t t = 0; t < n_samples; t++) { + const double xi = i ? x[(size_t)t * n_features + i - 1] : 1.0; + s = s + xi * y[(size_t)t * n_outputs + o]; + } + R[i * O + o] = s; + } + } + /* G = L D L^T, L unit lower triangular, stored below G's diagonal. */ + for (uint32_t j = 0; j < p; j++) { + double dj = G[j * D + j]; + const double gjj = dj; + for (uint32_t k = 0; k < j; k++) dj = dj - (G[j * D + k] * G[j * D + k]) * d[k]; + if (!(dj > 1e-13 * gjj) || !fin64(dj)) return OMEGA_RES_ERR_SINGULAR; + d[j] = dj; + for (uint32_t i = j + 1; i < p; i++) { + double s = G[i * D + j]; + for (uint32_t k = 0; k < j; k++) s = s - (G[i * D + k] * G[j * D + k]) * d[k]; + G[i * D + j] = s / dj; + } + } + for (uint32_t o = 0; o < n_outputs; o++) { + for (uint32_t i = 0; i < p; i++) { /* L z = r */ + double s = R[i * O + o]; + for (uint32_t k = 0; k < i; k++) s = s - G[i * D + k] * R[k * O + o]; + R[i * O + o] = s; + } + for (uint32_t i = 0; i < p; i++) R[i * O + o] = R[i * O + o] / d[i]; + for (uint32_t ii = p; ii-- > 0;) { /* L^T w = z */ + double s = R[ii * O + o]; + for (uint32_t k = ii + 1; k < p; k++) s = s - G[k * D + ii] * R[k * O + o]; + R[ii * O + o] = s; + } + } + OmegaResReadout r; + memset(&r, 0, sizeof r); + r.n_features = n_features; + r.n_outputs = n_outputs; + r.lambda = lambda; + for (uint32_t i = 0; i < p; i++) + for (uint32_t o = 0; o < n_outputs; o++) { + r.w[i * O + o] = R[i * O + o]; + if (!fin64(r.w[i * O + o])) return OMEGA_RES_ERR_NONFINITE; + } + *out = r; + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_readout_apply(const OmegaResReadout *r, const double *x, double *y_out) +{ + if (!r || !x || !y_out) return OMEGA_RES_ERR_NULL; + if (r->n_features < 1u || r->n_features > OMEGA_RES_READOUT_MAX_FEATURES || r->n_outputs < 1u || + r->n_outputs > OMEGA_RES_READOUT_MAX_OUTPUTS) + return OMEGA_RES_ERR_PARAM; + const uint32_t O = OMEGA_RES_READOUT_MAX_OUTPUTS; + for (uint32_t f = 0; f < r->n_features; f++) + if (!fin64(x[f])) return OMEGA_RES_ERR_NONFINITE; + for (uint32_t o = 0; o < r->n_outputs; o++) { + double s = r->w[o]; + for (uint32_t f = 0; f < r->n_features; f++) s = s + x[f] * r->w[(1u + f) * O + o]; + if (!fin64(s)) return OMEGA_RES_ERR_NONFINITE; + y_out[o] = s; + } + return OMEGA_RES_OK; +} + +OmegaResStatus omega_res_nrmse(const double *ref, const double *pred, uint32_t n, double *out) +{ + if (!ref || !pred || !out) return OMEGA_RES_ERR_NULL; + if (n < 2u) return OMEGA_RES_ERR_PARAM; + double sum = 0.0; + for (uint32_t i = 0; i < n; i++) { + if (!fin64(ref[i]) || !fin64(pred[i])) return OMEGA_RES_ERR_NONFINITE; + sum = sum + ref[i]; + } + const double mean = sum / (double)n; + double num = 0.0, den = 0.0; + for (uint32_t i = 0; i < n; i++) { + const double e = ref[i] - pred[i], c = ref[i] - mean; + num = num + e * e; + den = den + c * c; + } + if (!(den > 0.0) || !fin64(num) || !fin64(den)) return OMEGA_RES_ERR_SINGULAR; + *out = __builtin_sqrt(num / den); + return OMEGA_RES_OK; +} diff --git a/src/reservoir/omega_reservoir_readout.h b/src/reservoir/omega_reservoir_readout.h new file mode 100644 index 000000000..805c7bcc7 --- /dev/null +++ b/src/reservoir/omega_reservoir_readout.h @@ -0,0 +1,63 @@ +/* Linear readout for the Omega reservoir (omega#440, Gate 1): ridge + * regression with an unpenalized bias, and the NRMSE of Sci. Adv. + * eaed0971 Text S6 (eqs. 24-25). + * + * Precision: binary64. Operations: + - * / and the correctly rounded + * square root (AArch64 FSQRT through __builtin_sqrt, built with + * -fno-math-errno so no libm call exists; checked by nm in + * mk/reservoir.mk). Build with -ffp-contract=off -fno-fast-math. + * + * Fit: design Phi = [1, x] (n_samples x (1 + n_features)); normal matrix + * G = Phi^T Phi + lambda * diag(0, 1, ..., 1), right side R = Phi^T Y. Every + * entry is a sum over samples in index order 0..n_samples-1. G = L D L^T + * (no pivoting, row by row); a pivot d_j <= 1e-13 * G_jj refuses with + * OMEGA_RES_ERR_SINGULAR. Then L z = R, z = z / D, L^T W = z. This is the + * closed form of the reference's ridge_multioutput (Lorenz). With + * lambda = 0 it is ordinary least squares with intercept, the model the + * reference fits with MATLAB fitlm (NARMA); fitlm uses a QR solve, so on + * badly conditioned features the two can differ (Gate 2 records this). + * + * Feature construction (which states, squared states, range scaling) is + * the caller's; the readout only sees the matrix it is given. + * + * Bounded: n_features <= OMEGA_RES_READOUT_MAX_FEATURES, n_outputs <= + * OMEGA_RES_READOUT_MAX_OUTPUTS; the normal matrix lives in a caller-owned + * workspace (~0.5 MiB). No allocation, no globals. */ +#ifndef OMEGA_RESERVOIR_READOUT_H +#define OMEGA_RESERVOIR_READOUT_H + +#include "omega_reservoir.h" + +#define OMEGA_RES_READOUT_MAX_FEATURES 256u +#define OMEGA_RES_READOUT_MAX_OUTPUTS 4u +#define OMEGA_RES_READOUT_DIM (OMEGA_RES_READOUT_MAX_FEATURES + 1u) + +typedef struct { + uint32_t n_features, n_outputs; + double lambda; + /* (1 + n_features) x n_outputs, row-major; row 0 is the bias. */ + double w[OMEGA_RES_READOUT_DIM * OMEGA_RES_READOUT_MAX_OUTPUTS]; +} OmegaResReadout; + +typedef struct { + double g[OMEGA_RES_READOUT_DIM * OMEGA_RES_READOUT_DIM]; /* G, then L below the diagonal */ + double d[OMEGA_RES_READOUT_DIM]; + double rhs[OMEGA_RES_READOUT_DIM * OMEGA_RES_READOUT_MAX_OUTPUTS]; +} OmegaResReadoutWorkspace; + +/* x: n_samples x n_features row-major; y: n_samples x n_outputs row-major. + * lambda >= 0. Refuses non-finite data (OMEGA_RES_ERR_NONFINITE), bad + * sizes or lambda (OMEGA_RES_ERR_PARAM) and a singular system. */ +OmegaResStatus omega_res_readout_fit(const double *x, const double *y, uint32_t n_samples, uint32_t n_features, + uint32_t n_outputs, double lambda, OmegaResReadoutWorkspace *ws, + OmegaResReadout *out); + +/* y_out[o] = w[0][o] + sum_f x[f] * w[1 + f][o], f in order. */ +OmegaResStatus omega_res_readout_apply(const OmegaResReadout *r, const double *x, double *y_out); + +/* NRMSE(ref, pred) = sqrt( sum (ref - pred)^2 / sum (ref - mean(ref))^2 ), + * sums in index order, mean = (sum ref) / n. Refuses n < 2, non-finite + * data and a constant reference (zero denominator). */ +OmegaResStatus omega_res_nrmse(const double *ref, const double *pred, uint32_t n, double *out); + +#endif /* OMEGA_RESERVOIR_READOUT_H */ diff --git a/tests/.crumb b/tests/.crumb index a549b57af..87bc3d01e 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -258,6 +258,12 @@ "name": "relations", "purpose": "Directory tests/relations. Purpose not yet described by a human." }, + { + "digest": "e505518cad5dd5bb87591ad6e105c0394161cebe5ac399ff0cde45d0dec59ee9", + "last_commit": "2ec9e45f", + "name": "reservoir", + "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" + }, { "digest": "bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", "last_commit": "501d555c", @@ -289,15 +295,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:a80059a12ccef6b1902ebde2550dd8a76e75029cca2b2bb3a5ede7312b9784a6", - "compiled_at": "2026-10-14T14:16:58Z", + "children_root": "sha256:05117e2d294be3c1e110d84e9d3142ccc280a90ef9607760e30a51e0a68efc82", + "compiled_at": "2026-10-14T17:30:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:c5837ce9777c62e8a126c1be31fffcabf2a5291d901a682607ed2ce257ba521a", + "digest": "sha256:1a7ec3be8f1a68674ec997fc9c0f973a62432b1e19fdb977e1a0fd0ff3b9fdcb", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1029, - "generated_at_commit": "5901baa51d97c34632c12a783776ada5336b4fed", - "source_tree": "sha256:938a3678f2f5f710001d1fabdebeff1a38ab749d5d8235be30a234e33fba2129" + "files": 1036, + "generated_at_commit": "2ec9e45fbc14d6838cceffe5c164f2af43b61a31", + "source_tree": "sha256:48234d0bfb811160e5e0240c090cddfaff2e3c4fe8a649032788047d250512a3" }, "owner_lane": "", "provenance": { diff --git a/tests/reservoir/.crumb b/tests/reservoir/.crumb new file mode 100644 index 000000000..3a3eee1d6 --- /dev/null +++ b/tests/reservoir/.crumb @@ -0,0 +1,27 @@ +{ + "extensions": { + "generated": { + "children": [ + { + "digest": "3f7fa0c52f7bb68844ccc5ace8d5e96284fe1846698f9df59483c2e13b9cf2e9", + "last_commit": "ac35a166", + "name": "fixtures", + "purpose": "Two unmodified CC-BY-4.0 files from the authors' Zenodo archive 10.5281/zenodo.17296788 (Length5" + } + ], + "children_root": "sha256:7f9e3ef224698ef23587379e76f59fa3b24eb483797f039bb99529208213655e", + "compiled_at": "2026-10-14T17:30:45Z", + "compiler": "crumb-compile/1", + "digest": "sha256:e505518cad5dd5bb87591ad6e105c0394161cebe5ac399ff0cde45d0dec59ee9", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 7, + "generated_at_commit": "2ec9e45fbc14d6838cceffe5c164f2af43b61a31", + "source_tree": "sha256:561b5fd05cade59a3396ae2a64fa78df240908db2bed1576c949b20bffcd3d96" + } + }, + "layer": "tests/reservoir", + "name": "tests/reservoir", + "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64 oracle, and the Gate 2 .mat and inflate reader tests; run by make test-reservoir, plain and ASan/UBSan.", + "schema_version": "1.0.0" +} diff --git a/tests/reservoir/fixtures/.crumb b/tests/reservoir/fixtures/.crumb new file mode 100644 index 000000000..8062d82a1 --- /dev/null +++ b/tests/reservoir/fixtures/.crumb @@ -0,0 +1,20 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-14T16:13:42Z", + "compiler": "crumb-compile/1", + "digest": "sha256:3f7fa0c52f7bb68844ccc5ace8d5e96284fe1846698f9df59483c2e13b9cf2e9", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 2, + "generated_at_commit": "ac35a16615c2ebe0e6916b23a8234172f6362849", + "source_tree": "sha256:422014f985ebdf7a9f241f45b4757c79e7da5711037deb2ed589c44a417eef16" + } + }, + "layer": "tests/reservoir/fixtures", + "name": "tests/reservoir/fixtures", + "purpose": "Two unmodified CC-BY-4.0 files from the authors' Zenodo archive 10.5281/zenodo.17296788 (Length5.mat, Length50.mat), sha256-pinned in RESERVOIR_REFERENCE.md section 11.6, so CI can test the .mat reader without the archive. Data, never code; do not edit.", + "schema_version": "1.0.0" +} diff --git a/tests/reservoir/fixtures/Length5.mat b/tests/reservoir/fixtures/Length5.mat new file mode 100644 index 000000000..cdcdd877e Binary files /dev/null and b/tests/reservoir/fixtures/Length5.mat differ diff --git a/tests/reservoir/fixtures/Length50.mat b/tests/reservoir/fixtures/Length50.mat new file mode 100644 index 000000000..6927fff24 Binary files /dev/null and b/tests/reservoir/fixtures/Length50.mat differ diff --git a/tests/reservoir/res_fixtures.h b/tests/reservoir/res_fixtures.h new file mode 100644 index 000000000..f48ce1245 --- /dev/null +++ b/tests/reservoir/res_fixtures.h @@ -0,0 +1,132 @@ +/* Reference topologies of Armendarez et al. (Zenodo 10.5281/zenodo.17296788, + * zip md5 ad2c5057dfeafe890e624d8b1174f5d8), as data for the Gate 1 tests + * and the Gate 2 comparison. Generated mechanically from the archive, not + * typed by hand; node numbers are the reference's 1-based numbers. + * + * Lattices (nodeNeighbors tables; the reference symmetrizes them with + * max(A, A.') and zeroes the diagonal, so a pair listed on one side only is + * still an edge): + * 13 nodes: Lorenz63SolverCustomRegression13Nodes.m:211-223, ground 8, + * inputs 1, 2, 13 (:30-31). sha256 c9e2ad2b...eedbf1 + * 25 nodes: Lorenz63SolverCustomRegression25Nodes.m:211-235 (its builder + * is named buildAdjacencyMatrix43 but builds 25 nodes, :208-209), + * ground 14, inputs 1, 2, 25 (:30-31). sha256 c1b31403...dece + * 43 nodes: Lorenz63SolverCustomRegression.m:212-254, ground 21, inputs + * 1, 28, 42 (:30-31). sha256 d291460f...afdcac + * 50-node chain: conmat of NARMA .../Connected Reservoir/Length50.mat + * (sha256 ff4c9d14...2aae3), 49 undirected edges, a single path with + * permuted node numbers; ground = 50 (an interior node of the path). + * Length5/10/20.mat are the plain path 1-2-..-L with ground L, which + * omega_res_topology_chain(L, L - 1) builds. */ +#ifndef RES_FIXTURES_H +#define RES_FIXTURES_H + +#include + +/* neighbour lists, 1-based, count first */ +static const uint8_t RES_FIX_HEX13_NB[13][7] = { + {1, 3}, + {1, 6}, + {3, 1, 4, 7}, + {4, 3, 5, 7, 8}, + {4, 4, 8, 9, 6}, + {3, 2, 5, 9}, + {4, 3, 4, 8, 10}, + {6, 4, 5, 7, 9, 10, 11}, + {4, 5, 6, 8, 11}, + {4, 7, 8, 11, 12}, + {4, 8, 9, 10, 12}, + {3, 10, 11, 13}, + {1, 12}, +}; +/* neighbour lists, 1-based, count first */ +static const uint8_t RES_FIX_HEX25_NB[25][7] = { + {1, 3}, + {1, 7}, + {3, 1, 4, 8}, + {4, 3, 5, 8, 9}, + {4, 4, 6, 9, 10}, + {4, 5, 7, 10, 11}, + {3, 2, 6, 11}, + {5, 3, 4, 9, 12, 13}, + {6, 4, 5, 8, 10, 13, 14}, + {6, 5, 6, 9, 11, 14, 15}, + {5, 6, 7, 10, 15, 16}, + {3, 8, 13, 17}, + {6, 8, 9, 12, 14, 17, 18}, + {6, 9, 10, 13, 15, 18, 19}, + {6, 10, 11, 14, 16, 19, 20}, + {2, 15, 20}, + {4, 12, 13, 18, 21}, + {6, 13, 14, 17, 19, 21, 22}, + {6, 14, 15, 18, 20, 22, 23}, + {4, 15, 16, 19, 23}, + {3, 17, 18, 22}, + {5, 18, 19, 21, 23, 24}, + {4, 19, 20, 22, 24}, + {3, 22, 23, 25}, + {1, 24}, +}; +/* neighbour lists, 1-based, count first */ +static const uint8_t RES_FIX_HEX43_NB[43][7] = { + {1, 3}, + {3, 4, 5, 7}, + {3, 1, 6, 9}, + {4, 2, 6, 7, 10}, + {4, 2, 7, 8, 11}, + {5, 3, 4, 9, 10, 13}, + {6, 2, 4, 5, 10, 11, 14}, + {4, 5, 11, 12, 15}, + {4, 3, 6, 13, 16}, + {6, 4, 6, 7, 13, 14, 17}, + {6, 5, 7, 8, 14, 15, 18}, + {3, 8, 15, 19}, + {6, 6, 9, 10, 16, 17, 20}, + {6, 7, 10, 11, 17, 18, 21}, + {6, 8, 11, 12, 18, 19, 22}, + {4, 9, 13, 20, 24}, + {6, 10, 13, 14, 20, 21, 25}, + {6, 11, 14, 15, 21, 22, 26}, + {5, 12, 15, 22, 23, 27}, + {6, 13, 16, 17, 24, 25, 29}, + {6, 14, 17, 18, 25, 26, 30}, + {6, 15, 18, 19, 26, 27, 31}, + {3, 19, 27, 28}, + {4, 16, 20, 29, 32}, + {6, 17, 20, 21, 29, 30, 33}, + {6, 18, 21, 22, 30, 31, 34}, + {5, 19, 22, 23, 31, 35}, + {1, 23}, + {6, 20, 24, 25, 32, 33, 36}, + {6, 21, 25, 26, 33, 34, 37}, + {6, 22, 26, 27, 34, 35, 38}, + {4, 24, 29, 36, 39}, + {6, 25, 29, 30, 36, 37, 40}, + {6, 26, 30, 31, 37, 38, 41}, + {3, 27, 31, 38}, + {5, 29, 32, 33, 39, 40}, + {6, 30, 33, 34, 40, 41, 43}, + {4, 31, 34, 35, 41}, + {3, 32, 36, 42}, + {4, 33, 36, 37, 43}, + {4, 34, 37, 38, 43}, + {1, 39}, + {3, 37, 40, 41}, +}; +static const uint8_t RES_FIX_CHAIN50_EDGES[49][2] = { + {1, 4}, {2, 5}, {3, 6}, {3, 7}, {5, 8}, {6, 9}, {7, 10}, {4, 11}, {8, 12}, {9, 12}, + {10, 13}, {13, 14}, {11, 15}, {14, 16}, {15, 17}, {16, 18}, {17, 19}, {18, 20}, {20, 25}, {19, 26}, + {21, 27}, {21, 28}, {22, 28}, {22, 29}, {23, 29}, {23, 30}, {24, 30}, {24, 31}, {25, 31}, {27, 32}, + {26, 33}, {32, 34}, {33, 35}, {35, 36}, {34, 37}, {36, 38}, {37, 39}, {39, 40}, {38, 41}, {40, 42}, + {41, 43}, {42, 44}, {43, 47}, {44, 48}, {45, 48}, {45, 49}, {46, 49}, {46, 50}, {47, 50}, +}; + +#define RES_FIX_HEX13_GROUND 8u +#define RES_FIX_HEX25_GROUND 14u +#define RES_FIX_HEX43_GROUND 21u +#define RES_FIX_CHAIN50_GROUND 50u +static const uint8_t RES_FIX_HEX13_INPUTS[3] = {1, 2, 13}; +static const uint8_t RES_FIX_HEX25_INPUTS[3] = {1, 2, 25}; +static const uint8_t RES_FIX_HEX43_INPUTS[3] = {1, 28, 42}; + +#endif /* RES_FIXTURES_H */ diff --git a/tests/reservoir/res_oracle64.c b/tests/reservoir/res_oracle64.c new file mode 100644 index 000000000..3cb815d9e --- /dev/null +++ b/tests/reservoir/res_oracle64.c @@ -0,0 +1,173 @@ +/* binary64 Dormand-Prince oracle; see res_oracle64.h. */ +#include "res_oracle64.h" + +#include +#include + +#define NMAX OMEGA_RES_MAX_NODES +#define YMAX (OMEGA_RES_MAX_NODES + OMEGA_RES_MAX_SIDES) + +typedef struct { + unsigned n, ne, m; /* nodes, undirected edges, unknown nodes */ + unsigned a[OMEGA_RES_MAX_EDGES], b[OMEGA_RES_MAX_EDGES]; + int unk[NMAX]; /* node -> unknown index or -1 */ + unsigned unk_node[NMAX]; + double lu[NMAX][NMAX]; /* LU of the reduced capacitance matrix */ + unsigned piv[NMAX]; + double gu_a, z, rate, n0s, n0r; + double c[NMAX], tau0[NMAX], vtau[NMAX], ve[NMAX]; +} model; + +static int lu_factor(model *md) +{ + for (unsigned k = 0; k < md->m; k++) { + unsigned p = k; + for (unsigned i = k + 1; i < md->m; i++) + if (fabs(md->lu[i][k]) > fabs(md->lu[p][k])) p = i; + if (md->lu[p][k] == 0.0) return -1; + md->piv[k] = p; + if (p != k) + for (unsigned j = 0; j < md->m; j++) { double t = md->lu[k][j]; md->lu[k][j] = md->lu[p][j]; md->lu[p][j] = t; } + for (unsigned i = k + 1; i < md->m; i++) { + md->lu[i][k] /= md->lu[k][k]; + for (unsigned j = k + 1; j < md->m; j++) md->lu[i][j] -= md->lu[i][k] * md->lu[k][j]; + } + } + return 0; +} + +static void lu_solve(const model *md, double *x) +{ + for (unsigned k = 0; k < md->m; k++) { + unsigned p = md->piv[k]; + if (p != k) { double t = x[k]; x[k] = x[p]; x[p] = t; } + for (unsigned i = k + 1; i < md->m; i++) x[i] -= md->lu[i][k] * x[k]; + } + for (unsigned i = md->m; i-- > 0;) { + for (unsigned j = i + 1; j < md->m; j++) x[i] -= md->lu[i][j] * x[j]; + x[i] /= md->lu[i][i]; + } +} + +/* y = [V (n), N (2 ne)] */ +static void rhs(const model *md, const double *cur, const double *y, double *dy) +{ + double B[NMAX], x[NMAX]; + const double *V = y, *N = y + md->n; + double *dN = dy + md->n; + for (unsigned i = 0; i < md->n; i++) B[i] = cur[i]; + for (unsigned e = 0; e < md->ne; e++) { + const unsigned a = md->a[e], b = md->b[e]; + const double q = md->gu_a * (N[2 * e] + N[2 * e + 1]) * (V[a] - V[b]); + B[a] -= q; + B[b] += q; + for (int side = 0; side < 2; side++) { + const unsigned o = side ? b : a, p = side ? a : b; + const double dv = V[o] - V[p]; + const double alpha = md->rate / (md->tau0[o] * exp(dv / md->vtau[o])); + const double nss = md->n0s * exp(md->n0r * md->c[o]) * exp(dv / md->ve[o]); + const double Nk = N[2 * e + (unsigned)side]; + dN[2 * e + (unsigned)side] = alpha * Nk * (1.0 - pow(Nk / nss, md->z)); + } + } + for (unsigned u = 0; u < md->m; u++) x[u] = B[md->unk_node[u]]; + lu_solve(md, x); + for (unsigned i = 0; i < md->n; i++) dy[i] = md->unk[i] < 0 ? 0.0 : x[md->unk[i]]; +} + +int res64_run(const OmegaResTopology *topo, const OmegaResParams *par, const double *n_init, + const float *current_a, unsigned knot_count, double dt_s, res64_opts *opt, double *v_out, + double *n_final) +{ + static const double c2 = 1.0 / 5, c3 = 3.0 / 10, c4 = 4.0 / 5, c5 = 8.0 / 9; + static const double a21 = 1.0 / 5, a31 = 3.0 / 40, a32 = 9.0 / 40, a41 = 44.0 / 45, a42 = -56.0 / 15, + a43 = 32.0 / 9, a51 = 19372.0 / 6561, a52 = -25360.0 / 2187, a53 = 64448.0 / 6561, + a54 = -212.0 / 729, a61 = 9017.0 / 3168, a62 = -355.0 / 33, a63 = 46732.0 / 5247, + a64 = 49.0 / 176, a65 = -5103.0 / 18656, b1 = 35.0 / 384, b3 = 500.0 / 1113, + b4 = 125.0 / 192, b5 = -2187.0 / 6784, b6 = 11.0 / 84; + static const double e1 = 35.0 / 384 - 5179.0 / 57600, e3 = 500.0 / 1113 - 7571.0 / 16695, + e4 = 125.0 / 192 - 393.0 / 640, e5 = -2187.0 / 6784 + 92097.0 / 339200, + e6 = 11.0 / 84 - 187.0 / 2100, e7 = -1.0 / 40; + static model md; + memset(&md, 0, sizeof md); + md.n = topo->node_count; + md.ne = topo->edge_count; + for (unsigned e = 0; e < md.ne; e++) { md.a[e] = topo->edge[e].a; md.b[e] = topo->edge[e].b; } + md.gu_a = (double)par->g_u_s * (double)par->area_m2; + md.z = par->z; md.rate = par->rate_scale; md.n0s = par->n0_scale; md.n0r = par->n0_rate; + for (unsigned i = 0; i < md.n; i++) { + md.c[i] = par->conc_um[i]; md.tau0[i] = par->tau0_s[i]; md.vtau[i] = par->v_tau_v[i]; md.ve[i] = par->v_e_v[i]; + md.unk[i] = -1; + if (!topo->is_ground[i]) { md.unk[i] = (int)md.m; md.unk_node[md.m++] = i; } + } + const double cap = (double)par->eps_f_per_m * (double)par->area_m2 / (double)par->h_m; + for (unsigned e = 0; e < md.ne; e++) { + const int ua = md.unk[md.a[e]], ub = md.unk[md.b[e]]; + if (ua >= 0) md.lu[ua][ua] += cap; + if (ub >= 0) md.lu[ub][ub] += cap; + if (ua >= 0 && ub >= 0) { md.lu[ua][ub] -= cap; md.lu[ub][ua] -= cap; } + } + if (lu_factor(&md)) return -1; + + const unsigned ny = md.n + 2 * md.ne; + double y[YMAX], yn[YMAX], yt[YMAX], k[7][YMAX], cur[NMAX]; + memset(y, 0, sizeof y); + for (unsigned s = 0; s < 2 * md.ne; s++) y[md.n + s] = n_init[s]; + for (unsigned i = 0; i < md.n; i++) v_out[i] = 0.0; + double h = dt_s; + opt->steps_accepted = opt->steps_rejected = 0; + for (unsigned kn = 0; kn + 1 < knot_count; kn++) { + const float *i0 = current_a + (size_t)kn * md.n, *i1 = i0 + md.n; + double t = 0.0; /* time within this knot interval */ + while (t < dt_s) { + if (h > dt_s - t) h = dt_s - t; + if (h < 1e-18) return -1; + const double cs[7] = {0.0, c2, c3, c4, c5, 1.0, 1.0}; + for (int st = 0; st < 7; st++) { + for (unsigned j = 0; j < ny; j++) { + double acc = y[j]; + switch (st) { + case 0: break; + case 1: acc += h * (a21 * k[0][j]); break; + case 2: acc += h * (a31 * k[0][j] + a32 * k[1][j]); break; + case 3: acc += h * (a41 * k[0][j] + a42 * k[1][j] + a43 * k[2][j]); break; + case 4: acc += h * (a51 * k[0][j] + a52 * k[1][j] + a53 * k[2][j] + a54 * k[3][j]); break; + case 5: acc += h * (a61 * k[0][j] + a62 * k[1][j] + a63 * k[2][j] + a64 * k[3][j] + a65 * k[4][j]); break; + default: acc += h * (b1 * k[0][j] + b3 * k[2][j] + b4 * k[3][j] + b5 * k[4][j] + b6 * k[5][j]); break; + } + yt[j] = acc; + } + if (st == 6) memcpy(yn, yt, sizeof(double) * ny); + const double f = (t + cs[st] * h) / dt_s; + for (unsigned i = 0; i < md.n; i++) cur[i] = (double)i0[i] + f * ((double)i1[i] - (double)i0[i]); + rhs(&md, cur, yt, k[st]); + } + double err = 0.0; + int bad = 0; + for (unsigned j = 0; j < ny; j++) { + const double ej = h * (e1 * k[0][j] + e3 * k[2][j] + e4 * k[3][j] + e5 * k[4][j] + e6 * k[5][j] + e7 * k[6][j]); + const double sc = opt->atol + opt->rtol * fmax(fabs(y[j]), fabs(yn[j])); + const double r = fabs(ej) / sc; + if (!isfinite(r) || !isfinite(yn[j])) bad = 1; + else if (r > err) err = r; + if (j >= md.n && !(yn[j] > 0.0)) bad = 1; /* densities stay positive */ + } + if (bad) err = INFINITY; + if (err <= 1.0) { + memcpy(y, yn, sizeof(double) * ny); + t += h; + opt->steps_accepted++; + h *= fmin(5.0, fmax(0.2, 0.9 * pow(err > 1e-30 ? err : 1e-30, -0.2))); + } else { + opt->steps_rejected++; + h *= err < INFINITY ? fmax(0.1, 0.9 * pow(err, -0.2)) : 0.1; + } + } + for (unsigned i = 0; i < md.n; i++) v_out[(size_t)(kn + 1) * md.n + i] = y[i]; + } + for (unsigned j = 0; j < ny; j++) + if (!isfinite(y[j])) return -1; + if (n_final) + for (unsigned s = 0; s < 2 * md.ne; s++) n_final[s] = y[md.n + s]; + return 0; +} diff --git a/tests/reservoir/res_oracle64.h b/tests/reservoir/res_oracle64.h new file mode 100644 index 000000000..8c59127eb --- /dev/null +++ b/tests/reservoir/res_oracle64.h @@ -0,0 +1,33 @@ +/* Independent binary64 oracle for the reservoir tests. Written from the + * equations of Text S4 as the reference code integrates them (see + * docs/reservoir/RESERVOIR_REFERENCE.md), NOT from omega_reservoir.c: + * - state is the pore density N itself (not ln N), as in the reference; + * - 1 - (N/Nss)^Z with libm pow, alpha and Nss with libm exp; + * - M V' = B solved by LU with partial pivoting; + * - adaptive Dormand-Prince 5(4) with relative/absolute tolerances + * (the reference uses ode15s with RelTol 1e-6, AbsTol 1e-8), restarted + * at every input knot so the piecewise-linear current is smooth inside + * each integration interval. + * It reads the module's topology and parameter structs as plain data only. + * Test code: uses libm, allocates nothing. */ +#ifndef RES_ORACLE64_H +#define RES_ORACLE64_H + +#include "omega_reservoir.h" + +typedef struct { + double rtol, atol; + unsigned long steps_accepted, steps_rejected; +} res64_opts; + +/* Integrates from V = 0 and N(0) = n_init[side] (side order as the module: + * 2e = a->b, 2e+1 = b->a over topo->edge) across knots 0..knot_count-1 of + * the knot-major current table with spacing dt_s. Writes the node voltages + * at every knot into v_out[k * node_count + i] and the final densities into + * n_final (may be NULL). Returns 0 on success, -1 on failure (step size + * underflow or non-finite values). */ +int res64_run(const OmegaResTopology *topo, const OmegaResParams *par, const double *n_init, + const float *current_a, unsigned knot_count, double dt_s, res64_opts *opt, double *v_out, + double *n_final); + +#endif /* RES_ORACLE64_H */ diff --git a/tests/reservoir/test_res_mat.c b/tests/reservoir/test_res_mat.c new file mode 100644 index 000000000..c59e80431 --- /dev/null +++ b/tests/reservoir/test_res_mat.c @@ -0,0 +1,204 @@ +/* omega#440 Gate 2 tests for the in-house zlib inflate and MAT v5 reader + * (tools/reservoir/res_inflate.c, res_mat.c), which read the authors' + * archive. Expected values: a published test vector (Adler-32 of + * "Wikipedia" = 0x11E60398, the worked example of the Wikipedia article on + * Adler-32), a deflate stream made by `gzip -9n` (fixed Huffman), and the reference + * topologies of res_fixtures.h, which were transcribed from the archive by + * a separate tool in Gate 1; never from the code under test. + * + * Fixtures tests/reservoir/fixtures/Length5.mat and Length50.mat are copied + * unmodified from Armendarez et al., Zenodo 10.5281/zenodo.17296788 + * (data/raw/Codes for Zenodo/NARMA Final Code/Connected Reservoir/), + * licensed CC-BY-4.0; sha256 pinned below. */ +#include "res_fixtures.h" +#include "res_inflate.h" +#include "res_mat.h" + +#include +#include +#include + +static int g_checks, g_fail; +#define CHECK(c) do { g_checks++; if (!(c)) { g_fail++; \ + fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #c); } } while (0) + +static const char *FIX5 = "tests/reservoir/fixtures/Length5.mat"; +static const char *FIX50 = "tests/reservoir/fixtures/Length50.mat"; +static const uint8_t SHA5[32] = {0xdc, 0x6e, 0x79, 0x14, 0xd2, 0x16, 0xa2, 0x1f, 0x66, 0x4a, 0xdc, 0xd4, 0x84, 0x3e, 0x9f, 0x70, + 0x56, 0x16, 0xdf, 0x47, 0x51, 0x18, 0x79, 0xba, 0x0b, 0xbe, 0xce, 0xb2, 0x41, 0xb9, 0xb5, 0x0a}; +static const uint8_t SHA50[32] = {0xff, 0x4c, 0x9d, 0x14, 0xab, 0xb6, 0xf6, 0x4b, 0x1a, 0xb9, 0xf3, 0x01, 0x07, 0x2d, 0xc6, 0x73, + 0x16, 0xb7, 0xfd, 0x59, 0xfe, 0x61, 0xd0, 0xb7, 0x63, 0x2e, 0xe4, 0x67, 0xa8, 0xc2, 0xaa, 0xe3}; + +static void test_inflate(void) +{ + static const uint8_t word[9] = {'W', 'i', 'k', 'i', 'p', 'e', 'd', 'i', 'a'}; + CHECK(res_adler32(word, 9) == 0x11E60398u); + CHECK(res_adler32(word, 0) == 1u); + /* stored block: header 78 01, BFINAL=1 BTYPE=00, LEN 9, NLEN ~9 */ + uint8_t st[] = {0x78, 0x01, 0x01, 0x09, 0x00, 0xf6, 0xff, 'W', 'i', 'k', 'i', 'p', 'e', 'd', 'i', 'a', + 0x11, 0xe6, 0x03, 0x98}; + /* fixed Huffman block: the raw deflate of `printf Wikipedia | gzip -9n` */ + uint8_t fx[] = {0x78, 0x9c, 0x0b, 0xcf, 0xcc, 0xce, 0x2c, 0x48, 0x4d, 0xc9, 0x4c, 0x04, 0x00, + 0x11, 0xe6, 0x03, 0x98}; + uint8_t *out = NULL; + size_t n = 0, used = 0; + CHECK(res_zlib_inflate(st, sizeof st, &out, &n, &used) == RES_INF_OK); + CHECK(n == 9 && out && memcmp(out, word, 9) == 0 && used == sizeof st); + free(out); + out = NULL; + CHECK(res_zlib_inflate(fx, sizeof fx, &out, &n, &used) == RES_INF_OK); + CHECK(n == 9 && out && memcmp(out, word, 9) == 0 && used == sizeof fx); + free(out); + /* refusals */ + uint8_t bad[sizeof st]; + memcpy(bad, fx, sizeof fx); + bad[sizeof fx - 1] ^= 1u; /* Adler-32 trailer */ + out = NULL; + CHECK(res_zlib_inflate(bad, sizeof fx, &out, &n, &used) == RES_INF_ERR_ADLER); + free(out); + memcpy(bad, st, sizeof st); + bad[5] ^= 1u; /* NLEN no longer the complement of LEN */ + out = NULL; + CHECK(res_zlib_inflate(bad, sizeof st, &out, &n, &used) == RES_INF_ERR_BLOCK); + free(out); + uint8_t hdr_check[] = {0x78, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01}; + out = NULL; + CHECK(res_zlib_inflate(hdr_check, sizeof hdr_check, &out, &n, &used) == RES_INF_ERR_HEADER); + free(out); + uint8_t dict[] = {0x78, 0xbb, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01}; + out = NULL; + CHECK(res_zlib_inflate(dict, sizeof dict, &out, &n, &used) == RES_INF_ERR_HEADER); + free(out); + uint8_t reserved[] = {0x78, 0x01, 0x07, 0x00, 0x00, 0x00, 0x01}; /* BTYPE=11 */ + out = NULL; + CHECK(res_zlib_inflate(reserved, sizeof reserved, &out, &n, &used) == RES_INF_ERR_BLOCK); + free(out); + for (size_t cut = 0; cut < sizeof fx; cut++) { /* every truncation refuses */ + out = NULL; + CHECK(res_zlib_inflate(fx, cut, &out, &n, &used) != RES_INF_OK); + free(out); + } +} + +static uint8_t *slurp(const char *path, size_t *n) +{ + FILE *f = fopen(path, "rb"); + if (!f) return NULL; + uint8_t *b = malloc(1u << 16); + *n = b ? fread(b, 1, 1u << 16, f) : 0; + fclose(f); + return b; +} + +/* 1-based edge list of a chain conmat (column-major L x L), checked symmetric. */ +static int chain_edges(const double *cm, uint32_t L, uint32_t (*e)[2], uint32_t max) +{ + int m = 0; + for (uint32_t j = 0; j < L; j++) + for (uint32_t i = 0; i < L; i++) { + if (cm[i + L * j] != cm[j + L * i]) return -1; + if (i < j && cm[i + L * j] != 0.0) { + if (cm[i + L * j] != 1.0 || (uint32_t)m >= max) return -1; + e[m][0] = i + 1u; + e[m][1] = j + 1u; + m++; + } + } + return m; +} + +/* The ASan build (-DRES_QUICK) samples the flip and truncation sweeps: + * each parse is slow under ASan's stack-use-after-return detection (a fake + * frame per call). The plain build flips three bits at every byte and cuts + * at every length. */ +#ifdef RES_QUICK +#define FLIP_STRIDE 11u +#else +#define FLIP_STRIDE 1u +#endif + +static ResMatFile g_f, g_g; + +static int same_values(const ResMatFile *a, const ResMatFile *b, const char *name) +{ + const ResMatArray *x = res_mat_find(a, name), *y = res_mat_find(b, name); + if (!x || !y) return x == y; + if (x->numel != y->numel || x->cls != y->cls) return 0; + return !x->re || memcmp(x->re, y->re, x->numel * sizeof(double)) == 0; +} + +static void test_mat(void) +{ + const double *cm, *gr, *ix; + uint32_t e[64][2]; + CHECK(res_mat_load(FIX5, SHA5, &g_f) == RES_MAT_OK); + CHECK(res_mat_values(res_mat_find(&g_f, "conmat"), 25, &cm) == RES_MAT_OK); + CHECK(res_mat_values(res_mat_find(&g_f, "ground"), 1, &gr) == RES_MAT_OK && gr[0] == 5.0); + CHECK(res_mat_values(res_mat_find(&g_f, "inex"), 25, &ix) == RES_MAT_OK); + int all1 = 1; + for (int k = 0; k < 25; k++) all1 &= ix[k] == 1.0; + CHECK(all1); + CHECK(chain_edges(cm, 5, e, 64) == 4); + for (uint32_t k = 0; k < 4; k++) CHECK(e[k][0] == k + 1u && e[k][1] == k + 2u); + CHECK(res_mat_find(&g_f, "no_such_variable") == NULL); + res_mat_free(&g_f); + + CHECK(res_mat_load(FIX50, SHA50, &g_f) == RES_MAT_OK); + CHECK(res_mat_values(res_mat_find(&g_f, "conmat"), 2500, &cm) == RES_MAT_OK); + CHECK(res_mat_values(res_mat_find(&g_f, "ground"), 1, &gr) == RES_MAT_OK && gr[0] == 50.0); + int m = chain_edges(cm, 50, e, 64); + CHECK(m == 49); + int same = m == 49; + for (int k = 0; same && k < 49; k++) /* fixture edges may be listed either way round */ + same = (e[k][0] == RES_FIX_CHAIN50_EDGES[k][0] && e[k][1] == RES_FIX_CHAIN50_EDGES[k][1]) || + (e[k][0] == RES_FIX_CHAIN50_EDGES[k][1] && e[k][1] == RES_FIX_CHAIN50_EDGES[k][0]); + CHECK(same); + res_mat_free(&g_f); + + CHECK(res_mat_load(FIX5, SHA50, &g_f) == RES_MAT_ERR_DIGEST); + CHECK(res_mat_load("tests/reservoir/fixtures/absent.mat", NULL, &g_f) == RES_MAT_ERR_IO); +} + +/* A corrupted or truncated file must refuse, or decode to exactly the same + * values: never silently different data. */ +static void test_corruption(void) +{ + size_t n = 0; + uint8_t *b = slurp(FIX5, &n); + CHECK(b && n == 2130); + if (!b || n != 2130) return; + CHECK(res_mat_parse(b, n, &g_f) == RES_MAT_OK); + uint32_t full = g_f.var_count; + int silent = 0, refused = 0; + for (size_t off = 0; off < n; off += FLIP_STRIDE) + for (int bit = 0; bit < 8; bit += 3) { + b[off] ^= (uint8_t)(1u << bit); + ResMatStatus s = res_mat_parse(b, n, &g_g); + if (s != RES_MAT_OK) refused++; + else if (g_g.var_count != full || !same_values(&g_f, &g_g, "conmat") || !same_values(&g_f, &g_g, "ground") || + !same_values(&g_f, &g_g, "inex")) + silent++; + res_mat_free(&g_g); + b[off] ^= (uint8_t)(1u << bit); + } + CHECK(silent == 0); + CHECK(refused > 0); + for (size_t cut = 0; cut < n; cut += FLIP_STRIDE) { + ResMatStatus s = res_mat_parse(b, cut, &g_g); + if (s == RES_MAT_OK) /* a cut at an element boundary is a valid shorter file */ + CHECK(g_g.var_count < full && (!res_mat_find(&g_g, "conmat") || same_values(&g_f, &g_g, "conmat"))); + res_mat_free(&g_g); + } + res_mat_free(&g_f); + free(b); +} + +int main(void) +{ + res_mat_verbose = 0; /* thousands of expected refusals below */ + test_inflate(); + test_mat(); + test_corruption(); + printf("test_res_mat: %d checks, %d failed\n", g_checks, g_fail); + return g_fail ? 1 : 0; +} diff --git a/tests/reservoir/test_reservoir.c b/tests/reservoir/test_reservoir.c new file mode 100644 index 000000000..70e01165a --- /dev/null +++ b/tests/reservoir/test_reservoir.c @@ -0,0 +1,890 @@ +/* omega#440 Gate 1 tests for src/reservoir. Expected values come from hand + * derivations in the comments, from closed forms evaluated here in + * binary64, from the independent binary64 oracle (res_oracle64.c), or from + * counts taken off the reference archive by tools outside this repo (noted + * where used); never from calling the code under test. Every CHECK is one + * test case; any failure makes the program exit nonzero. */ +#include "omega_reservoir.h" +#include "omega_reservoir_readout.h" +#include "res_fixtures.h" +#include "res_oracle64.h" + +#include +#include +#include +#include + +static int g_checks, g_fail; +#define CHECK(c) do { g_checks++; if (!(c)) { g_fail++; \ + fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #c); } } while (0) +#define CHECK_ST(expr, want) do { OmegaResStatus s_ = (expr); g_checks++; if (s_ != (want)) { g_fail++; \ + fprintf(stderr, "FAIL %s:%d: %s -> %d, want %d\n", __FILE__, __LINE__, #expr, (int)s_, (int)(want)); } } while (0) +#define NEAR(a, b, rel) do { double a_ = (a), b_ = (b); g_checks++; \ + if (!(fabs(a_ - b_) <= (rel) * fmax(fabs(b_), 1e-300))) { g_fail++; \ + fprintf(stderr, "FAIL %s:%d: %s = %.17g, want %.17g\n", __FILE__, __LINE__, #a, a_, b_); } } while (0) +#define NEARABS(a, b, ab) do { double a_ = (a), b_ = (b); g_checks++; \ + if (!(fabs(a_ - b_) <= (ab))) { g_fail++; \ + fprintf(stderr, "FAIL %s:%d: %s = %.17g, want %.17g\n", __FILE__, __LINE__, #a, a_, b_); } } while (0) + +/* Shorter oracle scenarios under ASan (mk/reservoir.mk passes -DRES_QUICK). */ +#ifdef RES_QUICK +#define ORACLE_SAMPLES 20u +#else +#define ORACLE_SAMPLES 100u +#endif + +static OmegaResWorkspace g_ws; +static OmegaResConfig g_cfg, g_cfg2; +static OmegaResState g_s, g_s2; +#define MAX_KNOTS 4096u +static float g_tab[MAX_KNOTS * OMEGA_RES_MAX_NODES]; +static double g_vref[MAX_KNOTS * OMEGA_RES_MAX_NODES]; + +static uint64_t g_rng = 0x9E3779B97F4A7C15ull; +static uint64_t rnd(void) +{ + g_rng ^= g_rng >> 12; g_rng ^= g_rng << 25; g_rng ^= g_rng >> 27; + return g_rng * 0x2545F4914F6CDD1Dull; +} +static double runit(void) { return (double)(rnd() >> 11) / 9007199254740992.0; } + +static OmegaResIntegrator integ(float h, uint32_t K) { OmegaResIntegrator i = {h, K}; return i; } + +/* Symmetrized edge list of a 1-based reference neighbour table. */ +static uint32_t fixture_edges(const uint8_t (*nb)[7], uint32_t n, OmegaResEdge *e) +{ + uint32_t m = 0; + for (uint32_t i = 0; i < n; i++) + for (uint32_t k = 1; k <= nb[i][0]; k++) { + uint32_t a = i, b = (uint32_t)nb[i][k] - 1u, lo = a < b ? a : b, hi = a < b ? b : a, dup = 0; + for (uint32_t q = 0; q < m && !dup; q++) dup = e[q].a == lo && e[q].b == hi; + if (!dup) { e[m].a = (uint16_t)lo; e[m].b = (uint16_t)hi; m++; } + } + return m; +} + +static OmegaResStatus fixture_topology(const uint8_t (*nb)[7], uint32_t n, uint32_t ground1, OmegaResTopology *t) +{ + OmegaResEdge e[OMEGA_RES_MAX_EDGES]; + uint32_t m = fixture_edges(nb, n, e), g = ground1 - 1u; + return omega_res_topology_build(n, e, m, &g, 1, t); +} + +static void fill_const(float *tab, uint32_t knots, uint32_t n, const float *per_node) +{ + for (uint32_t k = 0; k < knots; k++) + for (uint32_t i = 0; i < n; i++) tab[k * n + i] = per_node[i]; +} + +/* NARMA-style masked drive (Sci. Adv. Fig. 4A; reference condition 7): + * u ~ U[0, 0.5), I = u * hi / 0.5, sub-pulses of 1 ms (10 knots of 0.1 ms), + * mask bit 1 -> I, bit 0 -> hi - I (the reference "inverter" with lo = 0). + * Masks here come from this file's own generator, not MATLAB's. */ +static uint32_t fill_masked(float *tab, uint32_t n, uint32_t samples, uint32_t mask_len, float hi) +{ + uint8_t mask[OMEGA_RES_MAX_NODES][8]; + for (uint32_t i = 0; i < n; i++) + for (uint32_t j = 0; j < mask_len; j++) mask[i][j] = (uint8_t)(rnd() & 1u); + const uint32_t knots = samples * mask_len * 10u + 1u; + double seq = 0.0; + for (uint32_t k = 0; k < knots; k++) { + uint32_t sub = k / 10u, smp = sub / mask_len, mi = sub % mask_len; + if (k % (10u * mask_len) == 0 && smp < samples) seq = runit() * 0.5 * (double)hi / 0.5; + for (uint32_t i = 0; i < n; i++) tab[k * n + i] = mask[i][mi] ? (float)seq : (float)((double)hi - seq); + } + return knots; +} + +/* ------------------------------------------------------------ topology */ + +static void test_topology(void) +{ + OmegaResTopology t, t2; + CHECK_ST(omega_res_topology_chain(5, 4, &t), OMEGA_RES_OK); + CHECK(t.node_count == 5 && t.edge_count == 4); + CHECK(t.degree[0] == 1 && t.degree[1] == 2 && t.degree[2] == 2 && t.degree[3] == 2 && t.degree[4] == 1); + CHECK(t.is_ground[4] == 1 && t.is_ground[0] == 0); + CHECK(t.edge[0].a == 0 && t.edge[0].b == 1 && t.edge[3].a == 3 && t.edge[3].b == 4); + + /* Same membranes listed shuffled and reversed: identical canonical struct. */ + OmegaResEdge sh[4] = {{4, 3}, {1, 0}, {2, 3}, {2, 1}}; + uint32_t g4 = 4; + CHECK_ST(omega_res_topology_build(5, sh, 4, &g4, 1, &t2), OMEGA_RES_OK); + CHECK(memcmp(&t, &t2, sizeof t) == 0); + + uint32_t g0 = 0, gg[2] = {0, 0}, gall[2] = {0, 1}; + OmegaResEdge self[1] = {{1, 1}}, dupl[2] = {{0, 1}, {1, 0}}, oob[1] = {{0, 5}}; + CHECK_ST(omega_res_topology_build(2, self, 1, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(2, dupl, 2, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(5, oob, 1, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(2, dupl, 1, gg, 2, &t2), OMEGA_RES_ERR_TOPOLOGY); /* duplicate ground */ + CHECK_ST(omega_res_topology_build(2, dupl, 1, gall, 2, &t2), OMEGA_RES_ERR_TOPOLOGY); /* every node ground */ + CHECK_ST(omega_res_topology_build(2, dupl, 1, &g0, 0, &t2), OMEGA_RES_ERR_TOPOLOGY); /* no ground */ + CHECK_ST(omega_res_topology_build(2, dupl, 0, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); /* no edge */ + CHECK_ST(omega_res_topology_build(1, dupl, 1, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(OMEGA_RES_MAX_NODES + 1, dupl, 1, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + uint32_t g9 = 9; + CHECK_ST(omega_res_topology_build(3, dupl, 1, &g9, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); /* ground out of range */ + /* Isolated node 2 (no membrane, so no capacitance). */ + CHECK_ST(omega_res_topology_build(3, dupl, 1, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + /* Star with 7 leaves: centre degree 7 > 6. */ + OmegaResEdge star[7]; + for (uint16_t i = 0; i < 7; i++) { star[i].a = 0; star[i].b = (uint16_t)(i + 1); } + CHECK_ST(omega_res_topology_build(8, star, 7, &g0, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(7, star, 6, &g0, 1, &t2), OMEGA_RES_OK); /* degree 6 is fine */ + CHECK(t2.degree[0] == 6); + /* Two components, only one grounded: M would be singular. */ + OmegaResEdge two[3] = {{0, 1}, {1, 2}, {3, 4}}; + uint32_t g2 = 2, g24[2] = {2, 4}; + CHECK_ST(omega_res_topology_build(5, two, 3, &g2, 1, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_build(5, two, 3, g24, 2, &t2), OMEGA_RES_OK); + CHECK_ST(omega_res_topology_build(5, NULL, 3, g24, 2, &t2), OMEGA_RES_ERR_NULL); + CHECK_ST(omega_res_topology_chain(1, 0, &t2), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_topology_chain(4, 4, &t2), OMEGA_RES_ERR_TOPOLOGY); +} + +/* Edge counts and degree histograms below were counted off the .m tables + * with awk (outside this repo) after the reference's own symmetrization. */ +static void degree_histogram(const OmegaResTopology *t, uint32_t h[8]) +{ + memset(h, 0, 8 * sizeof h[0]); + for (uint32_t i = 0; i < t->node_count; i++) h[t->degree[i]]++; +} + +static void test_reference_lattices(void) +{ + OmegaResTopology t; + uint32_t h[8]; + CHECK_ST(fixture_topology(RES_FIX_HEX13_NB, 13, RES_FIX_HEX13_GROUND, &t), OMEGA_RES_OK); + CHECK(t.edge_count == 21); + degree_histogram(&t, h); + CHECK(h[1] == 3 && h[2] == 0 && h[3] == 3 && h[4] == 6 && h[5] == 0 && h[6] == 1); + CHECK(t.degree[RES_FIX_HEX13_GROUND - 1] == 6 && t.is_ground[RES_FIX_HEX13_GROUND - 1]); + for (int k = 0; k < 3; k++) CHECK(t.degree[RES_FIX_HEX13_INPUTS[k] - 1] == 1); + + CHECK_ST(fixture_topology(RES_FIX_HEX25_NB, 25, RES_FIX_HEX25_GROUND, &t), OMEGA_RES_OK); + CHECK(t.edge_count == 51); + degree_histogram(&t, h); + CHECK(h[1] == 3 && h[2] == 0 && h[3] == 6 && h[4] == 6 && h[5] == 3 && h[6] == 7); + CHECK(t.degree[RES_FIX_HEX25_GROUND - 1] == 6); + for (int k = 0; k < 3; k++) CHECK(t.degree[RES_FIX_HEX25_INPUTS[k] - 1] == 1); + + CHECK_ST(fixture_topology(RES_FIX_HEX43_NB, 43, RES_FIX_HEX43_GROUND, &t), OMEGA_RES_OK); + CHECK(t.edge_count == 99); + degree_histogram(&t, h); + CHECK(h[1] == 3 && h[2] == 0 && h[3] == 7 && h[4] == 10 && h[5] == 4 && h[6] == 19); + CHECK(t.degree[RES_FIX_HEX43_GROUND - 1] == 6); + for (int k = 0; k < 3; k++) CHECK(t.degree[RES_FIX_HEX43_INPUTS[k] - 1] == 1); + /* Boundary nodes of the six-neighbour lattice: degree < 6 (43 - 19). */ + uint32_t boundary = 0; + for (uint32_t i = 0; i < t.node_count; i++) boundary += t.degree[i] < 6; + CHECK(boundary == 24); + + /* Length50.mat: one path, leaves 1 and 2, ground 50 interior. */ + OmegaResEdge e[49]; + for (int i = 0; i < 49; i++) { + e[i].a = (uint16_t)(RES_FIX_CHAIN50_EDGES[i][0] - 1); + e[i].b = (uint16_t)(RES_FIX_CHAIN50_EDGES[i][1] - 1); + } + uint32_t g = RES_FIX_CHAIN50_GROUND - 1; + CHECK_ST(omega_res_topology_build(50, e, 49, &g, 1, &t), OMEGA_RES_OK); + degree_histogram(&t, h); + CHECK(h[1] == 2 && h[2] == 48 && t.degree[0] == 1 && t.degree[1] == 1 && t.degree[49] == 2); +} + +/* ---------------------------------------------------------- parameters */ + +static void test_params(void) +{ + OmegaResParams p; + CHECK_ST(omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p), OMEGA_RES_OK); + CHECK(p.eps_f_per_m == 8.85e-12f && p.h_m == 4e-9f && p.area_m2 == 5e-8f && p.g_u_s == 5e-8f); + CHECK(p.z == 0.00015f && p.rate_scale == 1e4f && p.n0_scale == 0.002f && p.n0_rate == 3.7919f); + CHECK(p.conc_um[0] == 1.0f && p.conc_um[1] == 2.0f && p.conc_um[2] == 3.0f && p.conc_um[3] == 1.0f); + CHECK(p.tau0_s[4] == 0.001f && p.v_tau_v[4] == 0.045f && p.v_e_v[4] == 0.0055f); + CHECK_ST(omega_res_params_reference(OMEGA_RES_REF_LORENZ, 43, &p), OMEGA_RES_OK); + CHECK(p.eps_f_per_m == (float)(2.1 * 8.85e-12) && p.v_tau_v[42] == 0.0454f); + CHECK(p.conc_um[41] == 3.0f && p.conc_um[42] == 1.0f); /* 1 + (i mod 3), 0-based node i */ + CHECK_ST(omega_res_params_reference((OmegaResReference)7, 5, &p), OMEGA_RES_ERR_PARAM); + CHECK_ST(omega_res_params_reference(OMEGA_RES_REF_NARMA, 0, &p), OMEGA_RES_ERR_PARAM); + + OmegaResTopology t; + omega_res_topology_chain(5, 4, &t); + OmegaResIntegrator ig = integ(1e-5f, 10); + const float nan = (float)NAN; + struct { float *field; float bad; } cases[] = { + {&p.eps_f_per_m, nan}, {&p.eps_f_per_m, -1.0f}, {&p.h_m, 0.0f}, {&p.area_m2, -5e-8f}, + {&p.g_u_s, (float)INFINITY}, {&p.z, 0.0f}, {&p.z, 1.5f}, {&p.rate_scale, 0.0f}, {&p.n0_scale, -1.0f}, + {&p.n0_rate, nan}, {&p.conc_um[2], -1.0f}, {&p.tau0_s[1], 0.0f}, {&p.v_tau_v[0], nan}, {&p.v_e_v[3], -0.0055f}, + }; + for (size_t c = 0; c < sizeof cases / sizeof cases[0]; c++) { + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + *cases[c].field = cases[c].bad; + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_ERR_PARAM); + } + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + p.n0_rate = 40.0f; /* ln N0 = ln 0.002 + 40 * 3 = 113.8 > OMEGA_RES_Y_MAX */ + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_ERR_PARAM); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 4, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_ERR_PARAM); /* node count mismatch */ + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + OmegaResIntegrator bad[] = {integ(0.0f, 10), integ(-1e-5f, 10), integ(2e-3f, 1), integ(nan, 10), integ(1e-5f, 0)}; + for (size_t c = 0; c < sizeof bad / sizeof bad[0]; c++) + CHECK_ST(omega_res_config_build(&t, &p, &bad[c], &g_cfg), OMEGA_RES_ERR_PARAM); + /* A hand-edited (non-canonical) topology is refused. */ + OmegaResTopology t2 = t; + t2.degree[0] = 3; + CHECK_ST(omega_res_config_build(&t2, &p, &ig, &g_cfg), OMEGA_RES_ERR_TOPOLOGY); + t2 = t; + OmegaResEdge tmp = t2.edge[0]; t2.edge[0] = t2.edge[1]; t2.edge[1] = tmp; + CHECK_ST(omega_res_config_build(&t2, &p, &ig, &g_cfg), OMEGA_RES_ERR_TOPOLOGY); + CHECK_ST(omega_res_config_build(NULL, &p, &ig, &g_cfg), OMEGA_RES_ERR_NULL); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); +} + +/* ------------------------------------------------------------ identity */ + +static void test_identity(void) +{ + OmegaResTopology t, t2; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(5, 4, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(omega_res_config_id(&g_cfg), omega_res_config_id(&g_cfg2), 32) == 0); + CHECK(omega_res_config_id(NULL) == NULL); + uint8_t zero[32] = {0}; + CHECK(memcmp(g_cfg.id, zero, 32) != 0); + /* Edge listing order does not change the identity. */ + OmegaResEdge sh[4] = {{3, 4}, {2, 1}, {0, 1}, {3, 2}}; + uint32_t g4 = 4; + omega_res_topology_build(5, sh, 4, &g4, 1, &t2); + CHECK_ST(omega_res_config_build(&t2, &p, &ig, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) == 0); + /* -0.0 and +0.0 encode alike (here: concentration of node 0). */ + OmegaResParams pz = p, pn = p; + pz.conc_um[0] = 0.0f; pn.conc_um[0] = -0.0f; + CHECK_ST(omega_res_config_build(&t, &pz, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_config_build(&t, &pn, &ig, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) == 0); + /* One ulp in any parameter, a different ground, step or K: new identity. */ + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + float *fields[] = {&p.eps_f_per_m, &p.h_m, &p.area_m2, &p.g_u_s, &p.z, &p.rate_scale, &p.n0_scale, + &p.n0_rate, &p.conc_um[3], &p.tau0_s[0], &p.v_tau_v[2], &p.v_e_v[4]}; + for (size_t f = 0; f < sizeof fields / sizeof fields[0]; f++) { + float keep = *fields[f]; + *fields[f] = nextafterf(keep, INFINITY); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) != 0); + *fields[f] = keep; + } + OmegaResIntegrator ig2 = integ(nextafterf(1e-5f, 1.0f), 10), ig3 = integ(1e-5f, 11); + CHECK_ST(omega_res_config_build(&t, &p, &ig2, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) != 0); + CHECK_ST(omega_res_config_build(&t, &p, &ig3, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) != 0); + omega_res_topology_chain(5, 0, &t2); + CHECK_ST(omega_res_config_build(&t2, &p, &ig, &g_cfg2), OMEGA_RES_OK); + CHECK(memcmp(g_cfg.id, g_cfg2.id, 32) != 0); +} + +/* ------------------------------------------------- dynamics: closed forms */ + +/* Zero input from N = N0 on every side, V = 0: dV = 0, ln Nss = ln N0, w = 0, + * so 1 - e^w = -0 and every derivative is zero. The state must not move. */ +static void test_zero_input_fixed_point(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(5, 4, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + /* N0 = 0.002 e^(3.7919 c): c = 1 -> 0.08871, c = 2 -> 3.9343 (binary64 by hand). */ + NEAR(omega_res_state_pore(&g_s, 0), 0.002 * exp(3.7919), 1e-5); + NEAR(omega_res_state_pore(&g_s, 1), 0.002 * exp(3.7919 * 2), 1e-5); + CHECK(isnan(omega_res_state_pore(&g_s, 8))); + memset(g_tab, 0, sizeof(float) * 5 * 401); + OmegaResInput in = {5, 401, g_tab}; + g_s2 = g_s; + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 4000), OMEGA_RES_OK); + CHECK(g_s.step == 4000); + CHECK(memcmp(g_s.v, g_s2.v, sizeof g_s.v) == 0); + CHECK(memcmp(g_s.y, g_s2.y, sizeof g_s.y) == 0); +} + +/* Decay. One membrane, V = 0 (no input), every side starts at N = 1000. + * With u = y - ln N0 and V = 0: u' = -alpha0 (e^(Z u) - 1), alpha0 = + * rate_scale / tau0 = 1e7 /s. s = e^(-Z u) obeys s' = Z alpha0 (1 - s), so + * s(t) = 1 - (1 - s0) e^(-Z alpha0 t) and u(t) = -ln(s(t)) / Z. */ +static void test_decay(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(2, 1, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 2, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1000.0f, &g_s), OMEGA_RES_OK); + memset(g_tab, 0, sizeof(float) * 2 * 101); + OmegaResInput in = {2, 101, g_tab}; + const double Z = 0.00015, a0 = 1e7; + double prev[2] = {1e9, 1e9}; + for (int ms = 1; ms <= 8; ms++) { + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 100), OMEGA_RES_OK); + CHECK(g_s.v[0] == 0.0f && g_s.v[1] == 0.0f); + for (int side = 0; side < 2; side++) { + const double ln_n0 = log(0.002) + 3.7919 * (side ? 2.0 : 1.0); /* side 1 belongs to node 1 (c = 2) */ + const double u0 = log(1000.0) - ln_n0, s0 = exp(-Z * u0); + const double s = 1.0 - (1.0 - s0) * exp(-Z * a0 * ms * 1e-3); + const double y = ln_n0 - log(s) / Z; + NEARABS(g_s.y[side], y, 2e-4); + CHECK(g_s.y[side] < prev[side] && g_s.y[side] > ln_n0); /* monotone, from above */ + prev[side] = g_s.y[side]; + } + } +} + +/* Charging. Pore kinetics frozen (rate_scale tiny) and conductance + * negligible (N = 1e-30), so V' = I / C_node exactly: a node with one + * membrane has C = eps A / h = 8.85e-12 * 5e-8 / 4e-9 = 1.10625e-10 F; + * a node between two grounded neighbours has 2 C. RK4 integrates a + * constant derivative exactly, up to rounding. */ +static void test_charging(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(2, 1, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 2, &p); + p.rate_scale = 1e-12f; + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1e-30f, &g_s), OMEGA_RES_OK); + const float cur[2] = {1e-10f, 5e-10f}; /* current at the ground is ignored */ + fill_const(g_tab, 11, 2, cur); + OmegaResInput in = {2, 11, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 100), OMEGA_RES_OK); + const double C = 8.85e-12 * 5e-8 / 4e-9; + NEAR(g_s.v[0], 1e-10 * 1e-3 / C, 1e-5); /* 9.0395e-4 V after 1 ms */ + CHECK(g_s.v[1] == 0.0f); + + OmegaResEdge e[2] = {{0, 1}, {1, 2}}; + uint32_t gr[2] = {0, 2}; + CHECK_ST(omega_res_topology_build(3, e, 2, gr, 2, &t), OMEGA_RES_OK); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 3, &p); + p.rate_scale = 1e-12f; + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1e-30f, &g_s), OMEGA_RES_OK); + const float cur3[3] = {0.0f, 1e-10f, 0.0f}; + fill_const(g_tab, 11, 3, cur3); + OmegaResInput in3 = {3, 11, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &in3, &g_ws, &g_s, 100), OMEGA_RES_OK); + NEAR(g_s.v[1], 1e-10 * 1e-3 / (2.0 * C), 1e-5); + CHECK(g_s.v[0] == 0.0f && g_s.v[2] == 0.0f); +} + +/* Saturation. One membrane, constant 0.1 nA into node 0 (c = 1), ground + * node 1 (c = 2). At rest N_01 = Nss_01 = N0(1) e^(V/v_e) and N_10 = + * N0(2) e^(-V/v_e), and the injected current equals the membrane current: + * I = G_u A (N0(1) e^(V/v_e) + N0(2) e^(-V/v_e)) V. + * V* is found here by bisection in binary64 (about 0.085 V). */ +static void test_saturation(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 1000); + omega_res_topology_chain(2, 1, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 2, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + const float cur[2] = {1e-10f, 0.0f}; + fill_const(g_tab, 301, 2, cur); + OmegaResInput in = {2, 301, g_tab}; + const double I = (double)1e-10f, gua = 5e-8 * 5e-8, ve = 0.0055; + const double n01 = 0.002 * exp(3.7919), n10 = 0.002 * exp(3.7919 * 2); + double lo = 0.0, hi = 0.5; + for (int it = 0; it < 200; it++) { + double mid = 0.5 * (lo + hi); + double f = gua * (n01 * exp(mid / ve) + n10 * exp(-mid / ve)) * mid - I; + if (f > 0) hi = mid; else lo = mid; + } + const double vstar = 0.5 * (lo + hi); + CHECK(vstar > 0.08 && vstar < 0.09); + /* The pores lag the voltage, so V may overshoot V* before it settles; + * after 1.5 s every 10 ms sample must sit at V* and stay there. */ + double worst_late = 0.0; + for (int k = 0; k < 300; k++) { /* 3 s in 10 ms chunks */ + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 1000), OMEGA_RES_OK); + if (k >= 150 && fabs(g_s.v[0] - vstar) > worst_late) worst_late = fabs(g_s.v[0] - vstar); + } + CHECK(worst_late <= 2e-4 * vstar); + NEAR(g_s.v[0], vstar, 2e-5); + float lam; + CHECK_ST(omega_res_stiffness(&g_cfg, &g_s, &lam), OMEGA_RES_OK); + CHECK(lam > 0.0f && 1e-5f * lam < 0.1f); /* far from the RK4 limit */ +} + +/* ------------------------------------------------ connected, disconnected */ + +static void test_connected_and_disconnected(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + /* Chain 0-1-2 grounded at 2, current into node 0 only: node 1 must + * respond through the membrane (V0 > V1 > 0 = V2). */ + omega_res_topology_chain(3, 2, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 3, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + const float cur3[3] = {1e-10f, 0.0f, 0.0f}; + fill_const(g_tab, 101, 3, cur3); + OmegaResInput in3 = {3, 101, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &in3, &g_ws, &g_s, 1000), OMEGA_RES_OK); + CHECK(g_s.v[0] > g_s.v[1] && g_s.v[1] > 0.0f && g_s.v[2] == 0.0f); + + /* Two components {0,1,2} (ground 2) and {3,4} (ground 4): driving node 0 + * leaves the second component exactly at rest. */ + OmegaResEdge e[3] = {{0, 1}, {1, 2}, {3, 4}}; + uint32_t gr[2] = {2, 4}; + CHECK_ST(omega_res_topology_build(5, e, 3, gr, 2, &t), OMEGA_RES_OK); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + g_s2 = g_s; + const float cur5[5] = {1e-10f, 0.0f, 0.0f, 0.0f, 0.0f}; + fill_const(g_tab, 101, 5, cur5); + OmegaResInput in5 = {5, 101, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &in5, &g_ws, &g_s, 1000), OMEGA_RES_OK); + CHECK(g_s.v[0] > 0.0f && g_s.v[1] > 0.0f); + CHECK(g_s.v[3] == 0.0f && g_s.v[4] == 0.0f); + CHECK(g_s.y[4] == g_s2.y[4] && g_s.y[5] == g_s2.y[5]); /* sides of membrane 3-4 */ + CHECK(g_s.y[0] != g_s2.y[0]); + + /* 43-node reference lattice, Lorenz constants, N(0) = 1, constant drive + * at the three tail nodes: everything finite, centre held at 0, each + * degree-1 injection node above its only neighbour. */ + CHECK_ST(fixture_topology(RES_FIX_HEX43_NB, 43, RES_FIX_HEX43_GROUND, &t), OMEGA_RES_OK); + omega_res_params_reference(OMEGA_RES_REF_LORENZ, 43, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1.0f, &g_s), OMEGA_RES_OK); + float cur43[43] = {0}; + for (int k = 0; k < 3; k++) cur43[RES_FIX_HEX43_INPUTS[k] - 1] = 1.1e-10f; + fill_const(g_tab, 201, 43, cur43); + OmegaResInput in43 = {43, 201, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &in43, &g_ws, &g_s, 2000), OMEGA_RES_OK); + CHECK(g_s.v[RES_FIX_HEX43_GROUND - 1] == 0.0f); + CHECK(g_s.v[0] > g_s.v[2] && g_s.v[27] > g_s.v[22] && g_s.v[41] > g_s.v[38]); /* 1-3, 28-23, 42-39 */ +} + +/* ------------------------------------------------------- reproducibility */ + +static void test_reproducibility(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(5, 4, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + g_rng = 42; + const uint32_t knots = fill_masked(g_tab, 5, 30, 2, 1e-10f); + OmegaResInput in = {5, knots, g_tab}; + OmegaResRunReceipt r1, r2; + for (int run = 0; run < 2; run++) { + if (run) memset(&g_ws, 0xFF, sizeof g_ws); /* a dirty (all-NaN) workspace changes nothing */ + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, (uint64_t)(knots - 1) * 10u), OMEGA_RES_OK); + CHECK_ST(omega_res_run_receipt(&g_cfg, &in, &g_s, run ? &r2 : &r1), OMEGA_RES_OK); + if (run == 0) g_s2 = g_s; + } + CHECK(memcmp(&g_s, &g_s2, sizeof g_s) == 0); + CHECK(memcmp(&r1, &r2, sizeof r1) == 0); + CHECK(r1.steps == (uint64_t)(knots - 1) * 10u); + CHECK(g_s.v[0] != 0.0f); + /* Step by step with omega_res_step equals one advance call, bit for bit. */ + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + OmegaResState a, b; + a = g_s; + for (uint64_t i = 0; i < (uint64_t)(knots - 1) * 10u; i++) { + if (omega_res_step(&g_cfg, &in, &g_ws, &a, &b) != OMEGA_RES_OK) { CHECK(0); break; } + a = b; + } + CHECK(memcmp(&a, &g_s2, sizeof a) == 0); + /* One ulp in one input value: different input digest and final state. */ + uint8_t d1[32], d2[32]; + CHECK_ST(omega_res_input_digest(&in, d1), OMEGA_RES_OK); + g_tab[7] = nextafterf(g_tab[7], 1.0f); + CHECK_ST(omega_res_input_digest(&in, d2), OMEGA_RES_OK); + CHECK(memcmp(d1, d2, 32) != 0); + CHECK(memcmp(d1, r1.input_digest, 32) == 0); + /* A one-ulp current change can vanish in rounding; 1 % cannot. */ + g_tab[7] = g_tab[7] * 1.01f + 1e-12f; + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, (uint64_t)(knots - 1) * 10u), OMEGA_RES_OK); + CHECK(memcmp(g_s.v, g_s2.v, sizeof g_s.v) != 0); + OmegaResRunReceipt r3; + CHECK_ST(omega_res_run_receipt(&g_cfg, &in, &g_s, &r3), OMEGA_RES_OK); + CHECK(memcmp(r3.run_id, r1.run_id, 32) != 0 && memcmp(r3.config_id, r1.config_id, 32) == 0); +} + +/* ------------------------------------------------------------- refusals */ + +static void test_refusals(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + omega_res_topology_chain(3, 2, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 3, &p); + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_N0, 0.0f, &g_s), OMEGA_RES_OK); + const float cur[3] = {1e-10f, 0.0f, 0.0f}; + fill_const(g_tab, 2, 3, cur); + OmegaResInput in = {3, 2, g_tab}; + OmegaResState keep = g_s, nx; + + /* Past the last knot: 2 knots support 10 steps. */ + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 25), OMEGA_RES_ERR_INPUT); + CHECK(g_s.step == 10); + g_s = keep; + /* NaN and out-of-bound currents; the state is left as it was. */ + g_tab[1] = (float)NAN; + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 1), OMEGA_RES_ERR_NONFINITE); + CHECK(memcmp(&g_s, &keep, sizeof g_s) == 0); + g_tab[1] = 2e-6f; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_INPUT); + g_tab[1] = 0.0f; + OmegaResInput bad_in = {2, 2, g_tab}, one_knot = {3, 1, g_tab}, no_tab = {3, 2, NULL}; + CHECK_ST(omega_res_step(&g_cfg, &bad_in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_INPUT); + CHECK_ST(omega_res_step(&g_cfg, &one_knot, &g_ws, &g_s, &nx), OMEGA_RES_ERR_INPUT); + CHECK_ST(omega_res_step(&g_cfg, &no_tab, &g_ws, &g_s, &nx), OMEGA_RES_ERR_NULL); + /* Corrupted states. */ + g_s.v[0] = (float)NAN; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_NONFINITE); + g_s = keep; g_s.v[2] = 1e-3f; /* ground not at zero */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = keep; g_s.v[0] = 1.5f; /* membrane 0-1 at 1.5 V */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = keep; g_s.y[1] = 100.0f; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = keep; g_s.yc[1] = 1e-3f; /* carry larger than half an ulp of its value */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = keep; g_s.vc[2] = 1e-30f; /* any carry at a ground */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = keep; g_s.vc[0] = (float)INFINITY; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_NONFINITE); + g_s = keep; g_s.config_id[5] ^= 1u; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_MISMATCH); + g_s = keep; g_s.side_count = 2; + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_MISMATCH); + g_s = keep; + /* Aliasing and NULL. */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &g_s), OMEGA_RES_ERR_ALIAS); + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_ws.spare, &nx), OMEGA_RES_OK); /* spare is not scratch */ + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_ws.spare, 1), OMEGA_RES_ERR_ALIAS); + CHECK_ST(omega_res_step(NULL, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_NULL); + CHECK_ST(omega_res_advance(&g_cfg, NULL, &g_ws, &g_s, 1), OMEGA_RES_ERR_NULL); + CHECK_ST(omega_res_state_init(&g_cfg, (OmegaResInit)9, 0.0f, &g_s2), OMEGA_RES_ERR_PARAM); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, -1.0f, &g_s2), OMEGA_RES_ERR_PARAM); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1e-38f, &g_s2), OMEGA_RES_ERR_RANGE); + CHECK(memcmp(&g_s, &keep, sizeof g_s) == 0); + + /* Stiffness: N = e^70 on every side gives lambda >= G_u h_m 2 e^70 / eps + * ~ 1e26 /s, far above 2 / h. */ + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, (float)exp(70.0), &g_s), OMEGA_RES_OK); + float lam; + CHECK_ST(omega_res_stiffness(&g_cfg, &g_s, &lam), OMEGA_RES_OK); + CHECK(lam > 1e25f); + keep = g_s; + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &g_s, 1), OMEGA_RES_ERR_STIFF); + CHECK(memcmp(&g_s, &keep, sizeof g_s) == 0); + + /* Overflow of the model's voltage range: 1 uA into a node whose + * membranes neither conduct nor adapt charges it at 9e3 V/s; the run + * stops at the first step past 1 V and keeps the last valid state. */ + omega_res_topology_chain(2, 1, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 2, &p); + p.rate_scale = 1e-12f; + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1e-30f, &g_s), OMEGA_RES_OK); + const float big[2] = {1e-6f, 0.0f}; + fill_const(g_tab, 101, 2, big); + OmegaResInput inb = {2, 101, g_tab}; + CHECK_ST(omega_res_advance(&g_cfg, &inb, &g_ws, &g_s, 1000), OMEGA_RES_ERR_RANGE); + CHECK(g_s.v[0] <= 1.0f && g_s.v[0] > 0.99f && g_s.step == 11); /* 9.04 V/s * 1e-5 s per step */ +} + + +/* Voltage guard on membranes, not nodes (orchestrator decision 2026-10-14, + * RESERVOIR_REFERENCE.md section 12). A 30-node chain grounded at node 29 + * whose membranes neither conduct nor adapt is a series of equal + * capacitors: 10 nA into node 0 charges every membrane at I / C = 90.4 V/s + * and node 0 at 29 times that. Node 0 passes 1 V after about 38 steps, + * where the earlier node-voltage guard refused; the run must go on, flag + * every membrane once it passes 0.3 V, and refuse only when a membrane + * passes 1 V (about step 1106). */ +static float max_membrane(const OmegaResConfig *c, const OmegaResState *s) +{ + float m = 0.0f; + for (uint32_t e = 0; e < c->topo.edge_count; e++) { + float d = s->v[c->topo.edge[e].a] - s->v[c->topo.edge[e].b]; + if (d < 0.0f) d = -d; + if (d > m) m = d; + } + return m; +} + +static void test_membrane_guard(void) +{ + OmegaResTopology t; + OmegaResParams p; + OmegaResIntegrator ig = integ(1e-5f, 10); + CHECK_ST(omega_res_topology_chain(30, 29, &t), OMEGA_RES_OK); + CHECK_ST(omega_res_params_reference(OMEGA_RES_REF_NARMA, 30, &p), OMEGA_RES_OK); + p.rate_scale = 1e-12f; + CHECK_ST(omega_res_config_build(&t, &p, &ig, &g_cfg), OMEGA_RES_OK); + CHECK_ST(omega_res_state_init(&g_cfg, OMEGA_RES_INIT_CONST, 1e-30f, &g_s), OMEGA_RES_OK); + const OmegaResState rest = g_s; + float cur[30] = {0}; + cur[0] = 1e-8f; + fill_const(g_tab, 201, 30, cur); + OmegaResInput in = {30, 201, g_tab}; + OmegaResMembraneStats ms; + omega_res_membrane_stats_init(&ms); + + /* Node voltages far above 1 V, every membrane below 0.3 V: runs, no flag. */ + CHECK_ST(omega_res_advance_observed(&g_cfg, &in, &g_ws, &g_s, 300, &ms), OMEGA_RES_OK); + CHECK(g_s.step == 300); + CHECK(g_s.v[0] > 7.5f && g_s.v[0] < 8.2f); /* 29 * 90.4 V/s * 3 ms = 7.86 V */ + CHECK(max_membrane(&g_cfg, &g_s) > 0.26f && max_membrane(&g_cfg, &g_s) < 0.28f); + CHECK(ms.states_observed == 300 && ms.states_implausible == 0 && ms.membranes_implausible == 0); + CHECK(ms.max_node_abs_v == g_s.v[0] && ms.max_membrane_abs_v == max_membrane(&g_cfg, &g_s)); + + /* Past 0.3 V every membrane is flagged (recorded, not refused); past 1 V + * the step is refused and the last accepted state is kept. */ + CHECK_ST(omega_res_advance_observed(&g_cfg, &in, &g_ws, &g_s, 1900, &ms), OMEGA_RES_ERR_RANGE); + CHECK(g_s.step > 1090 && g_s.step < 1120); + CHECK(ms.states_observed == g_s.step); + CHECK(ms.membranes_implausible == 29); + CHECK(ms.states_implausible > 700 && ms.states_implausible < ms.states_observed); + CHECK(ms.max_membrane_abs_v <= OMEGA_RES_VM_LIMIT && ms.max_membrane_abs_v > 0.99f); + CHECK(g_s.v[0] > 28.0f); + /* Without the observer the same run stops at the same step. */ + OmegaResState plain = rest; + CHECK_ST(omega_res_advance(&g_cfg, &in, &g_ws, &plain, 1900), OMEGA_RES_ERR_RANGE); + CHECK(plain.step == g_s.step && memcmp(plain.v, g_s.v, sizeof plain.v) == 0); + + /* Hand-set states: a 0.09 V ramp (node 0 at 2.61 V) steps; one membrane + * over 1 V with every node below 2.8 V is refused. */ + OmegaResState nx; + g_s = rest; + for (uint32_t i = 0; i < 29; i++) g_s.v[i] = 0.09f * (float)(29u - i); + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_OK); + g_s.v[10] += 1.05f; /* membranes 9-10 and 10-11 at 0.96 V and 1.14 V */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s.v[10] -= 1.05f; + g_s.v[28] = 1.2f; /* the membrane to the ground */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + /* The bound is on |V_a - V_b|: a negative membrane voltage is refused too + * (catches a one-sided guard dv > limit). */ + g_s = rest; + g_s.v[0] = -1.5f; /* membrane 0-1 at -1.5 V */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + g_s = rest; + g_s.v[28] = -1.2f; /* the membrane to the ground, negative */ + CHECK_ST(omega_res_step(&g_cfg, &in, &g_ws, &g_s, &nx), OMEGA_RES_ERR_RANGE); + + /* Observer refusals. */ + CHECK_ST(omega_res_membrane_observe(&g_cfg, &rest, NULL), OMEGA_RES_ERR_NULL); + g_s = rest; + g_s.config_id[0] ^= 1u; + CHECK_ST(omega_res_membrane_observe(&g_cfg, &g_s, &ms), OMEGA_RES_ERR_MISMATCH); + g_s = rest; + CHECK_ST(omega_res_advance_observed(&g_cfg, &in, &g_ws, &g_s, 1, (OmegaResMembraneStats *)(void *)&g_ws), + OMEGA_RES_ERR_ALIAS); +} + +/* --------------------------------------- agreement with the binary64 oracle */ + +typedef struct { double max_err, vmax; } cmp_result; + +/* Runs the module at (h, K) on the knot table and compares node voltages at + * every knot with vref (knot-major, as res64_run writes it). */ +static int compare_oracle(const OmegaResTopology *t, const OmegaResParams *p, float h, uint32_t K, OmegaResInit init, + float init_value, uint32_t knots, const double *vref, cmp_result *out) +{ + OmegaResIntegrator ig = integ(h, K); + if (omega_res_config_build(t, p, &ig, &g_cfg) != OMEGA_RES_OK) return -1; + if (omega_res_state_init(&g_cfg, init, init_value, &g_s) != OMEGA_RES_OK) return -1; + const uint32_t n = t->node_count; + OmegaResInput in = {n, knots, g_tab}; + out->max_err = 0.0; + out->vmax = 0.0; + for (uint32_t k = 1; k < knots; k++) { + if (omega_res_advance(&g_cfg, &in, &g_ws, &g_s, K) != OMEGA_RES_OK) return -1; + for (uint32_t i = 0; i < n; i++) { + const double r = vref[(size_t)k * n + i], e = fabs((double)g_s.v[i] - r); + if (e > out->max_err) out->max_err = e; + if (fabs(r) > out->vmax) out->vmax = fabs(r); + } + } + return 0; +} + +static double g_vtight[MAX_KNOTS * OMEGA_RES_MAX_NODES]; + +/* Gate 1 agreement contract (declared in RESERVOIR_REFERENCE.md): at every + * knot of every scenario and for every step size from 1e-4 s down to + * 5e-6 s, |V_omega - V_oracle(rtol 1e-10)| <= 1e-6 max|V|. The oracle at + * the reference's own tolerances (rtol 1e-6, atol 1e-8) is reported beside + * it for the convergence record. */ +#define AGREE_REL 1e-6 + +static void oracle_case(const char *name, const OmegaResTopology *t, const OmegaResParams *p, OmegaResInit init, + float init_value, uint32_t knots) +{ + static const float hs[5] = {1e-4f, 5e-5f, 2e-5f, 1e-5f, 5e-6f}; + static const uint32_t ks[5] = {1, 2, 5, 10, 20}; + cmp_result r[5], reftol = {0.0, 0.0}; + double ninit[OMEGA_RES_MAX_SIDES]; + for (uint32_t e = 0; e < t->edge_count; e++) + for (int side = 0; side < 2; side++) { + uint32_t o = side ? t->edge[e].b : t->edge[e].a; + ninit[2 * e + (uint32_t)side] = init == OMEGA_RES_INIT_N0 + ? (double)p->n0_scale * exp((double)p->n0_rate * (double)p->conc_um[o]) : (double)init_value; + } + res64_opts ot = {1e-10, 1e-14, 0, 0}, orf = {1e-6, 1e-8, 0, 0}; + CHECK(res64_run(t, p, ninit, g_tab, knots, 1e-4, &ot, g_vtight, NULL) == 0); + CHECK(res64_run(t, p, ninit, g_tab, knots, 1e-4, &orf, g_vref, NULL) == 0); + for (size_t q = (size_t)t->node_count; q < (size_t)knots * t->node_count; q++) { + double e = fabs(g_vref[q] - g_vtight[q]); + if (e > reftol.max_err) reftol.max_err = e; + if (fabs(g_vtight[q]) > reftol.vmax) reftol.vmax = fabs(g_vtight[q]); + } + for (int c = 0; c < 5; c++) CHECK(compare_oracle(t, p, hs[c], ks[c], init, init_value, knots, g_vtight, &r[c]) == 0); + printf("oracle %-26s max|V| %.4e V; max|V err| fp32 rk4 h=1e-4 %.2e, 5e-5 %.2e, 2e-5 %.2e, 1e-5 %.2e," + " 5e-6 %.2e; binary64 at ref tol %.2e (%lu steps tight)\n", name, r[3].vmax, r[0].max_err, + r[1].max_err, r[2].max_err, r[3].max_err, r[4].max_err, reftol.max_err, ot.steps_accepted); + CHECK(r[3].vmax > 0.0); + for (int c = 0; c < 5; c++) CHECK(r[c].max_err <= AGREE_REL * r[3].vmax); + CHECK(reftol.max_err <= 1e-9 * reftol.vmax); /* the reference's tolerances suffice */ +} + +static void test_oracle_agreement(void) +{ + OmegaResTopology t; + OmegaResParams p; + /* (a) one membrane, constant 0.1 nA, 200 ms */ + omega_res_topology_chain(2, 1, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 2, &p); + const float c2[2] = {1e-10f, 0.0f}; + fill_const(g_tab, 2001, 2, c2); + oracle_case("one-node const 0.1nA", &t, &p, OMEGA_RES_INIT_N0, 0.0f, 2001); + /* (b) 5-node chain, NARMA-style masked drive (mask 2, 0.1 nA) */ + omega_res_topology_chain(5, 4, &t); + omega_res_params_reference(OMEGA_RES_REF_NARMA, 5, &p); + g_rng = 7; + uint32_t knots = fill_masked(g_tab, 5, ORACLE_SAMPLES, 2, 1e-10f); + oracle_case("chain5 masked NARMA-style", &t, &p, OMEGA_RES_INIT_N0, 0.0f, knots); + /* (c) 13-node reference lattice, Lorenz constants, N(0) = 1, smooth + * drive (I = (x * 1.05e-10 + 1e-9) / 10 with x a 20 Hz sine of + * amplitude 15) at the three injection nodes. */ + CHECK_ST(fixture_topology(RES_FIX_HEX13_NB, 13, RES_FIX_HEX13_GROUND, &t), OMEGA_RES_OK); + omega_res_params_reference(OMEGA_RES_REF_LORENZ, 13, &p); + knots = 10u * ORACLE_SAMPLES + 1u; + memset(g_tab, 0, sizeof(float) * 13 * knots); + for (uint32_t k = 0; k < knots; k++) + for (int q = 0; q < 3; q++) { + double x = 15.0 * sin(2.0 * M_PI * 20.0 * k * 1e-4 + q); + g_tab[k * 13 + RES_FIX_HEX13_INPUTS[q] - 1] = (float)((x * 1.05e-10 + 1e-9) / 10.0); + } + oracle_case("hex13 Lorenz-style", &t, &p, OMEGA_RES_INIT_CONST, 1.0f, knots); +} + +/* -------------------------------------------------------------- readout */ + +static OmegaResReadoutWorkspace g_rws; + +static void test_readout(void) +{ + enum { NS = 60, NF = 3 }; + static double x[NS * NF], y[NS * 2]; + g_rng = 99; + for (int s = 0; s < NS; s++) { + for (int f = 0; f < NF; f++) x[s * NF + f] = runit() * 2.0 - 1.0; + y[s * 2 + 0] = 0.5 + 2.0 * x[s * NF] - 1.0 * x[s * NF + 1] + 0.25 * x[s * NF + 2]; + y[s * 2 + 1] = -3.0 + 0.125 * x[s * NF + 1]; + } + OmegaResReadout r; + CHECK_ST(omega_res_readout_fit(x, y, NS, NF, 2, 0.0, &g_rws, &r), OMEGA_RES_OK); + const double want0[4] = {0.5, 2.0, -1.0, 0.25}, want1[4] = {-3.0, 0.0, 0.125, 0.0}; + for (int i = 0; i < 4; i++) { + NEARABS(r.w[i * OMEGA_RES_READOUT_MAX_OUTPUTS + 0], want0[i], 1e-12); + NEARABS(r.w[i * OMEGA_RES_READOUT_MAX_OUTPUTS + 1], want1[i], 1e-12); + } + double out[2]; + CHECK_ST(omega_res_readout_apply(&r, &x[5 * NF], out), OMEGA_RES_OK); + NEARABS(out[0], y[10], 1e-12); + /* Very large lambda: weights -> 0, the unpenalized bias -> mean(y). */ + double mean = 0.0; + for (int s = 0; s < NS; s++) mean += y[s * 2]; + mean /= NS; + CHECK_ST(omega_res_readout_fit(x, y, NS, NF, 2, 1e12, &g_rws, &r), OMEGA_RES_OK); + NEARABS(r.w[0], mean, 1e-6); + NEARABS(r.w[1 * OMEGA_RES_READOUT_MAX_OUTPUTS], 0.0, 1e-9); + CHECK(r.lambda == 1e12); + /* Duplicate feature column with lambda = 0: singular. With lambda > 0: fine. */ + static double xd[NS * 2]; + for (int s = 0; s < NS; s++) { xd[s * 2] = x[s * NF]; xd[s * 2 + 1] = x[s * NF]; } + CHECK_ST(omega_res_readout_fit(xd, y, NS, 2, 2, 0.0, &g_rws, &r), OMEGA_RES_ERR_SINGULAR); + CHECK_ST(omega_res_readout_fit(xd, y, NS, 2, 2, 1e-3, &g_rws, &r), OMEGA_RES_OK); + CHECK_ST(omega_res_readout_fit(x, y, NS, NF, 2, -1.0, &g_rws, &r), OMEGA_RES_ERR_PARAM); + CHECK_ST(omega_res_readout_fit(x, y, NS, OMEGA_RES_READOUT_MAX_FEATURES + 1, 2, 0.0, &g_rws, &r), + OMEGA_RES_ERR_PARAM); + CHECK_ST(omega_res_readout_fit(x, y, NS, NF, 0, 0.0, &g_rws, &r), OMEGA_RES_ERR_PARAM); + x[7] = NAN; + CHECK_ST(omega_res_readout_fit(x, y, NS, NF, 2, 0.0, &g_rws, &r), OMEGA_RES_ERR_NONFINITE); + CHECK_ST(omega_res_readout_apply(&r, &x[6], out), OMEGA_RES_ERR_NONFINITE); + CHECK_ST(omega_res_readout_fit(NULL, y, NS, NF, 2, 0.0, &g_rws, &r), OMEGA_RES_ERR_NULL); + + /* NRMSE (Text S6): ref 1,2,3,4 and pred 1,2,3,5: sum e^2 = 1, sum + * (ref - 2.5)^2 = 5, NRMSE = sqrt(1/5) = 0.44721359549995793. */ + const double ref[4] = {1, 2, 3, 4}, pred[4] = {1, 2, 3, 5}, flat[4] = {2.5, 2.5, 2.5, 2.5}, c4[4] = {7, 7, 7, 7}; + double v; + CHECK_ST(omega_res_nrmse(ref, pred, 4, &v), OMEGA_RES_OK); + NEAR(v, 0.44721359549995793, 1e-15); + CHECK_ST(omega_res_nrmse(ref, ref, 4, &v), OMEGA_RES_OK); + CHECK(v == 0.0); + CHECK_ST(omega_res_nrmse(ref, flat, 4, &v), OMEGA_RES_OK); + CHECK(v == 1.0); + CHECK_ST(omega_res_nrmse(c4, ref, 4, &v), OMEGA_RES_ERR_SINGULAR); + CHECK_ST(omega_res_nrmse(ref, pred, 1, &v), OMEGA_RES_ERR_PARAM); + const double withnan[4] = {1, NAN, 3, 4}; + CHECK_ST(omega_res_nrmse(withnan, pred, 4, &v), OMEGA_RES_ERR_NONFINITE); +} + +int main(void) +{ + test_topology(); + test_reference_lattices(); + test_params(); + test_identity(); + test_zero_input_fixed_point(); + test_decay(); + test_charging(); + test_saturation(); + test_connected_and_disconnected(); + test_reproducibility(); + test_refusals(); + test_membrane_guard(); + test_oracle_agreement(); + test_readout(); + printf("test_reservoir: %d checks, %d failed\n", g_checks, g_fail); + if (g_fail) { printf("test_reservoir: FAIL\n"); return 1; } + printf("test_reservoir: PASS\n"); + return 0; +} diff --git a/tools/.crumb b/tools/.crumb index a676f8ea3..11a141d6c 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -48,6 +48,12 @@ "name": "estimation", "purpose": "Directory tools/estimation. Purpose not yet described by a human." }, + { + "digest": "b91acbb0b29060651bc17dc79406adeb9376748f4d4a3005175cd307aa52b9c8", + "last_commit": "48c6ed71", + "name": "reservoir", + "purpose": "Gate 2 tooling for the reservoir (omega#440): in-house zlib inflate and MAT v5 reader, the archi" + }, { "digest": "98d1f4d802b90006977d73b14acb92971927f2cf5bdf05d8dc5653a1b10fcf1b", "last_commit": "ae1dd00a", @@ -55,15 +61,15 @@ "purpose": "Directory tools/turing_verify_indep. Purpose not yet described by a human." } ], - "children_root": "sha256:3051f793dc23155cfff1c4a549e97d3bfe74b3e094d3bd812985bba517919051", - "compiled_at": "2026-10-14T01:16:48Z", + "children_root": "sha256:e1f826c2beb8604bb0dcba49575f7c6b48cf5488c40b616b212fda2ed70c62ee", + "compiled_at": "2026-10-14T17:03:15Z", "compiler": "crumb-compile/1", - "digest": "sha256:751046d381404b4a7ed1c8c001d2525cf0fe79cf7570bca83ee67f12214563cc", + "digest": "sha256:830418862bdcd02444691e0b076e753a6eea237d4a018ce1704b58fdfa1da16d", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 140, - "generated_at_commit": "e0abd0b524f5bf8e3ba6960b53868980bdd41b4e", - "source_tree": "sha256:e8c553f8d91bf7cae7e23cc7bbd864a48ec113acdafe4e5eb2728990f4de9eca" + "files": 149, + "generated_at_commit": "0f6d71513dfd29b85b22fe2ca15e4287991e7303", + "source_tree": "sha256:84179359bda279e6cd62a846a714c9b52f66482a1b9dfe1fc689786d49b8f283" }, "owner_lane": "", "provenance": { diff --git a/tools/reservoir/.crumb b/tools/reservoir/.crumb new file mode 100644 index 000000000..d478dad2d --- /dev/null +++ b/tools/reservoir/.crumb @@ -0,0 +1,20 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-14T17:03:15Z", + "compiler": "crumb-compile/1", + "digest": "sha256:b91acbb0b29060651bc17dc79406adeb9376748f4d4a3005175cd307aa52b9c8", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 9, + "generated_at_commit": "0f6d71513dfd29b85b22fe2ca15e4287991e7303", + "source_tree": "sha256:0c7bc062441363c2b926e51d2db71fd644d52f854d36c343b341f8dccdc92699" + } + }, + "layer": "tools/reservoir", + "name": "tools/reservoir", + "purpose": "Gate 2 tooling for the reservoir (omega#440): in-house zlib inflate and MAT v5 reader, the archived-reference comparison (res_qualify), benchmarks and timing (res_bench), and qualify_reservoir.sh, which writes the content-addressed receipt under evidence/RESERVOIR. No Python; reads the untrusted archive as data only.", + "schema_version": "1.0.0" +} diff --git a/tools/reservoir/qualify_reservoir.sh b/tools/reservoir/qualify_reservoir.sh new file mode 100755 index 000000000..4ad120f8e --- /dev/null +++ b/tools/reservoir/qualify_reservoir.sh @@ -0,0 +1,215 @@ +#!/bin/bash +# qualify_reservoir.sh -- omega#440 Gate 2 receipt for the ionic-droplet reservoir +# (docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1, 8, 10, 10.1). +# +# RES_ARCHIVE= [RES_V2_RESULTS=] tools/reservoir/qualify_reservoir.sh [out-dir] +# make qualify-reservoir RES_ARCHIVE= [RES_V2_RESULTS=] +# +# RES_ARCHIVE is the unpacked project-zenodo-ready_with-paper/ directory of Zenodo +# 10.5281/zenodo.17296788 (every file used is sha256-pinned by the tool); RES_V2_RESULTS +# the version 2 HyperParameterOptimizationVariablesToPlot.mat (sha256-pinned; without it +# case N1b-v2 is NOT_RUN). The archive is data: read and hashed, never executed. +# +# On the committed tree only: make test-reservoir (wrapped in `flock $BENCH_LOCK`), then +# res_qualify: pins; G2-N1 cases N1a, N1b, N1b-v2 and control NC-N; G2-L1 on 13, 25 and +# 43 nodes and control NC-L; the NARMA and Lorenz benchmarks; and, when the quiet flag +# is clear, the timing run (under the lock). The receipt is a NEW file named by the +# SHA-256 of its own bytes; nothing under evidence/ is rewritten. Its status is FAIL +# (with reasons) when the tree is dirty or changes during the run, a pin mismatches, +# the build or tests fail, or a command errors. A comparison case that FAILs is a +# recorded result, not a receipt failure. Shell and coreutils only (git, sha256sum, +# grep, sed, awk, make, flock; jq only to check the JSON when present). No Python. +set -u + +HERE=$(cd "$(dirname "$0")/../.." && pwd) +cd "$HERE" || exit 2 +ARCHIVE=${RES_ARCHIVE:-} +V2=${RES_V2_RESULTS:-} +OUTDIR=${1:-evidence/RESERVOIR} +BENCH_LOCK=${BENCH_LOCK:-$HOME/workspace/.argus-bench.lock} +LANES=${LANES:-$HOME/.claude/skills/orchestrate-lanes/lanes.sh} +Q=build/resq +REASONS=() +if [ -z "$ARCHIVE" ] || [ ! -d "$ARCHIVE" ]; then + echo "qualify_reservoir: RES_ARCHIVE must name the unpacked archive directory" >&2 + exit 2 +fi +mkdir -p "$(dirname "$BENCH_LOCK")" || exit 2 + +head0=$(git rev-parse HEAD) +tree0=$(git rev-parse 'HEAD^{tree}') +dirty0=$(git status --porcelain) +[ -z "$dirty0" ] || REASONS+=("tree dirty at start") +started=$(date -u +%Y-%m-%dT%H:%M:%SZ) +rm -rf "$Q" && mkdir -p "$Q/r" + +json_str() { printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\t/ /g' | awk 'BEGIN{ORS=""} {if (NR>1) print "\\n"; print}'; } + +# ---- build and unit tests ------------------------------------------------------ +build_rc=0 +flock "$BENCH_LOCK" make OUT_DIR="$Q/out" PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-reservoir \ + > "$Q/test-reservoir.log" 2>&1 || build_rc=$? +[ "$build_rc" -eq 0 ] || REASONS+=("make test-reservoir failed (rc $build_rc)") +T=$Q/out/tests-reservoir/res_qualify +tests_summary=$(grep -E '^test_res(ervoir|_mat): [0-9]+ checks' "$Q/test-reservoir.log" | tr '\n' ';') + +run() { # run : stdout JSON, stderr and exit code kept + local name=$1 + shift + "$T" "$@" > "$Q/r/$name.json" 2> "$Q/r/$name.err" + echo $? > "$Q/r/$name.rc" +} + +CASES="g2-narma-N1a g2-narma-N1b g2-narma-N1b-v2 g2-narma-NC-N g2-lorenz-13 g2-lorenz-25 g2-lorenz-43 g2-lorenz-13-NC-L" +if [ "$build_rc" -eq 0 ]; then + run pins pins "$ARCHIVE" + [ "$(cat "$Q/r/pins.rc")" = 0 ] || REASONS+=("archive pin mismatch (see results.pins)") + # the comparisons are independent processes and untimed: run them side by side + run g2-narma-N1a g2-narma "$ARCHIVE" N1a & + run g2-narma-N1b g2-narma "$ARCHIVE" N1b & + run g2-narma-NC-N g2-narma "$ARCHIVE" NC-N & + if [ -n "$V2" ]; then run g2-narma-N1b-v2 g2-narma "$ARCHIVE" N1b-v2 "$V2" & fi + run g2-lorenz-13 g2-lorenz "$ARCHIVE" 13 & + run g2-lorenz-25 g2-lorenz "$ARCHIVE" 25 & + run g2-lorenz-43 g2-lorenz "$ARCHIVE" 43 & + run g2-lorenz-13-NC-L g2-lorenz "$ARCHIVE" 13 NC-L & + wait + run bench-narma bench-narma + run bench-lorenz bench-lorenz +fi + +# ---- timing (task e): only on a quiet machine ------------------------------------ +quiet="not checked (no lanes.sh on this host)" +perf_state=NOT_RUN +perf_reason="build failed" +if [ "$build_rc" -eq 0 ]; then + idle=1 + if [ -x "$LANES" ]; then + nurse=$("$LANES" nurse 2>&1) + quiet=$(printf '%s\n' "$nurse" | grep -m1 -i 'quiet flag' | sed 's/^ *//') + quiet="$quiet; $(printf '%s\n' "$nurse" | grep -m1 -i 'forge:' | sed 's/^ *//')" + printf '%s\n' "$nurse" | grep -qi 'quiet flag: *clear' || idle=0 + printf '%s\n' "$nurse" | grep -i 'forge:' | grep -qi 'not running' || idle=0 + fi + if [ "$idle" -eq 0 ]; then + perf_reason="machine not quiet (a GB10 job or the quiet flag): $quiet" + else + loadavg_before=$(cut -d' ' -f1-3 /proc/loadavg 2>/dev/null) + flock "$BENCH_LOCK" "$T" perf > "$Q/r/perf.json" 2> "$Q/r/perf.err" + echo $? > "$Q/r/perf.rc" + perf_state=RUN + perf_reason="load average before: ${loadavg_before:-unknown}" + fi +fi + +# ---- collect -------------------------------------------------------------------- +verdict_of() { grep -o '"verdict": "[A-Z_]*"' "$1" 2>/dev/null | tail -1 | sed 's/.*: "\(.*\)"/\1/'; } +results="" +summary="" +for name in pins $CASES bench-narma bench-lorenz perf; do + f=$Q/r/$name.json + if [ ! -f "$Q/r/$name.rc" ]; then + why="not run" + [ "$name" = g2-narma-N1b-v2 ] && [ -z "$V2" ] && why="NOT_RUN: RES_V2_RESULTS not given" + [ "$name" = perf ] && why="NOT_RUN: $perf_reason" + results+="${results:+,} + \"$name\": {\"status\": \"$(json_str "$why")\"}" + summary+="${summary:+, }\"$name\": \"$(json_str "$why")\"" + continue + fi + rc=$(cat "$Q/r/$name.rc") + [ "$rc" -le 1 ] || REASONS+=("$name exited $rc: $(head -c 300 "$Q/r/$name.err")") + if [ "$rc" -le 1 ] && [ -s "$f" ]; then + results+="${results:+,} + \"$name\": $(cat "$f")" + else + results+="${results:+,} + \"$name\": {\"status\": \"ERROR\", \"rc\": $rc, \"stderr\": \"$(json_str "$(head -c 2000 "$Q/r/$name.err")")\"}" + fi + v=$(verdict_of "$f") + [ -n "$v" ] || { [ "$rc" = 0 ] && v=RAN || v="ERROR rc $rc"; } + summary+="${summary:+, }\"$name\": \"$v\"" +done +# negative controls must fail; a passing control means the contract cannot see that error +for c in g2-narma-NC-N g2-lorenz-13-NC-L; do + v=$(verdict_of "$Q/r/$c.json") + [ -z "$v" ] || [ "$v" = FAIL ] || REASONS+=("negative control $c did not fail ($v)") +done + +head1=$(git rev-parse HEAD) +dirty1=$(git status --porcelain) +stable=true +{ [ "$head1" = "$head0" ] && [ "$dirty1" = "$dirty0" ]; } || { stable=false; REASONS+=("tree changed during the run"); } +tree_dirty=false +[ -z "$dirty0" ] || tree_dirty=true +status=RECORDED +[ "${#REASONS[@]}" -eq 0 ] || status=FAIL +reasons_json="" +for r in "${REASONS[@]}"; do reasons_json+="${reasons_json:+, }\"$(json_str "$r")\""; done + +body=$(cat </dev/null)")"}, + "compiler": "$(json_str "$(${CC:-cc} --version 2>/dev/null | head -1)")", + "unit_tests": "$(json_str "$tests_summary")", + "unit_tests_log_sha256": "$(sha256sum "$Q/test-reservoir.log" | awk '{print $1}')", + "archive": {"record": "10.5281/zenodo.17296788", "license": "CC-BY-4.0", "pins": "results.pins", "v2_results_file_given": $([ -n "$V2" ] && echo true || echo false)}, + "quiet_flag": "$(json_str "$quiet")", + "timing": {"state": "$perf_state", "note": "$(json_str "$perf_reason")"}, + "hardware_scope": "CPU only; no GPU opened, no silicon, no energy or power measurement", + "summary": {$summary}, + "blocked": [ + "63 of the 64 archived NARMA grid cells: their input masks come from MATLAB's rng/randi stream, which is not reimplemented (no MATLAB or Octave here)", + "state-trace comparison against the authors' code: the version 1 archive holds no state trajectories", + "whether the archived outputs came from the archived code (discrepancy 15): needs MATLAB", + "the paper's parallel reservoir (S5): a different, voltage-clamped model, not implemented" + ], + "not_run": [ + "energy and power: not instrumented, no efficiency claim", + "AIEN telemetry workload: no real telemetry with a time-ordered train/validation/test split exists (section 11)", + "RC with squared states on the 50-node NARMA chain: 295 features, above the readout bound of 256" + ], + "proves": [ + "For the cases whose verdict is PASS: numerical agreement, under the tolerances declared before the runs, between Omega's binary32 simulator with its binary64 readout and the outputs the authors archived from their MATLAB code (targets, predictions and NRMSE), on the archived inputs.", + "For the cases whose verdict is FAIL: that Omega does not meet the declared criteria there, with the diagnostics recorded in the case.", + "The benchmark and timing numbers below, for this commit, compiler and host." + ], + "does_not_prove": [ + "physical validity of the droplet model, or anything about real droplets or devices", + "agreement on the BLOCKED cases, or with the authors' code beyond its archived outputs", + "GPU qualification of any kind (CPU only)", + "energy, power or efficiency (NOT_RUN)", + "production readiness" + ], + "status": "$status", + "status_reasons": [$reasons_json], + "results": {$results + } +} +EOF +) +mkdir -p "$OUTDIR" +tmp=$(mktemp "$OUTDIR/.tmp-XXXXXX") +printf '%s\n' "$body" > "$tmp" +if command -v jq > /dev/null 2>&1 && ! jq -e . "$tmp" > /dev/null 2>&1; then + echo "qualify_reservoir: receipt is not valid JSON; kept at $tmp" >&2 + exit 2 +fi +digest=$(sha256sum "$tmp" | awk '{print $1}') +final=$OUTDIR/$digest.json +if [ -e "$final" ]; then rm -f "$tmp"; else mv "$tmp" "$final"; fi +chmod 0644 "$final" +echo "SUMMARY {$summary}" +echo "RECEIPT $final" +echo "STATUS $status" +[ "$status" = RECORDED ] diff --git a/tools/reservoir/res_bench.c b/tools/reservoir/res_bench.c new file mode 100644 index 000000000..7068d6c2d --- /dev/null +++ b/tools/reservoir/res_bench.c @@ -0,0 +1,945 @@ +/* res_qualify bench-narma | bench-lorenz | perf: the Gate 2 benchmark and + * performance protocol of docs/reservoir/RESERVOIR_REFERENCE.md section 10. + * Omega's own data from Omega's own generator; every seed is reported, + * failures included. Seeds run in parallel threads (one per seed); every + * result depends only on its seed. */ +#define _GNU_SOURCE +#include "res_common.h" + +#include +#include +#include +#include +#include +#include +#include + +#define NSEED_MAX 16 +#define STEP_S 1.0e-5f +#define KSTEP 10u /* steps per knot: knots every 0.1 ms */ + +static const double GRID[9] = {1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1.0, 1e1, 1e2}; + +/* One generator stream per (seed, purpose). */ +enum { P_NARMA_TRAIN = 1, P_NARMA_TEST = 2, P_NARMA_MASK = 3, P_LORENZ_TRAIN = 4, P_LORENZ_TEST = 5, P_PERF = 6 }; +static ResRng stream(int seed, int purpose) +{ + ResRng r = {((uint64_t)(uint32_t)seed << 32) | (uint64_t)purpose}; + return r; +} + +static void jd(FILE *o, double v) +{ + if (v == v && v - v == 0.0) fprintf(o, "%.10g", v); + else fputs("null", o); +} + +static void jhex(FILE *o, const uint8_t *d) +{ + char h[65]; + res_hex(d, 32, h); + fprintf(o, "\"%s\"", h); +} + +typedef struct { + OmegaResStatus st; + OmegaResRunReceipt rc; + uint64_t stopped_at; + OmegaResMembraneStats ms; /* every accepted state of the run */ +} Run; + +static void run_json(FILE *o, const char *name, const Run *r) +{ + fprintf(o, "{\"run\": \"%s\", \"status\": \"%s\"", name, res_status_name(r->st)); + if (r->st == OMEGA_RES_OK) { + fputs(", \"run_id\": ", o); + jhex(o, r->rc.run_id); + fputs(", \"config_id\": ", o); + jhex(o, r->rc.config_id); + fprintf(o, ", \"steps\": %llu", (unsigned long long)r->rc.steps); + } else + fprintf(o, ", \"stopped_at_step\": %llu", (unsigned long long)r->stopped_at); + res_mstats_json(o, &r->ms); + fputc('}', o); +} + +/* Builds and runs one reservoir from rest; records all node voltages at the + * integer steps (non-decreasing); then runs to the last knot and takes the + * run receipt. */ +static Run simulate(const OmegaResTopology *t, const OmegaResParams *p, OmegaResInit init, float initv, + const float *tab, uint32_t knots, const uint64_t *steps, size_t ns, double *v) +{ + Run r; + memset(&r, 0, sizeof r); + r.st = OMEGA_RES_ERR_NULL; + ResSim *sim = calloc(1, sizeof *sim); + OmegaResIntegrator ig = {STEP_S, KSTEP}; + if (!sim) return r; + r.st = omega_res_config_build(t, p, &ig, &sim->cfg); + if (r.st == OMEGA_RES_OK) r.st = omega_res_state_init(&sim->cfg, init, initv, &sim->s); + OmegaResInput in = {t->node_count, knots, tab}; + const uint64_t last = (uint64_t)(knots - 1u) * KSTEP; + if (r.st == OMEGA_RES_OK) r.st = res_sim_at_steps(sim, &in, steps, ns, v); + if (r.st == OMEGA_RES_OK && sim->s.step < last) + r.st = omega_res_advance_observed(&sim->cfg, &in, &sim->ws, &sim->s, last - sim->s.step, &sim->mstats); + if (r.st == OMEGA_RES_OK) r.st = omega_res_run_receipt(&sim->cfg, &in, &sim->s, &r.rc); + r.stopped_at = sim->s.step; + r.ms = sim->mstats; + free(sim); + return r; +} + +typedef struct { + double test[3], train[3], lambda, cv; + OmegaResStatus st; + uint32_t nf; +} Fit; + +static Fit fit(const double *xtr, const double *ytr, uint32_t ntr, const double *xte, const double *yte, uint32_t nte, + uint32_t nf, uint32_t no) +{ + Fit f; + memset(&f, 0, sizeof f); + f.nf = nf; + double *ptr = malloc((size_t)ntr * no * sizeof(double)), *pte = malloc((size_t)nte * no * sizeof(double)); + if (!ptr || !pte) { + f.st = OMEGA_RES_ERR_NULL; + } else { + ResCvResult cv = res_ridge_cv(xtr, ytr, ntr, nf, no, xte, nte, GRID, 9, 5, ptr, pte); + f.st = cv.status; + f.lambda = cv.lambda; + f.cv = cv.cv_score; + for (uint32_t c = 0; c < no; c++) { + f.train[c] = f.st == OMEGA_RES_OK ? res_nrmse(ytr + c, ptr + c, ntr, no) : 0.0 / 0.0; + f.test[c] = f.st == OMEGA_RES_OK ? res_nrmse(yte + c, pte + c, nte, no) : 0.0 / 0.0; + } + } + free(ptr); + free(pte); + return f; +} + +static double fit_mean(const Fit *f, uint32_t no) +{ + double s = 0.0; + for (uint32_t c = 0; c < no; c++) s += f->test[c]; + return s / no; +} + +static void fit_json(FILE *o, const char *model, const char *task, const Fit *f, uint32_t no) +{ + fprintf(o, "{\"model\": \"%s\", \"task\": \"%s\", \"features\": %u, \"status\": \"%s\", \"lambda\": ", model, task, + f->nf, res_status_name(f->st)); + jd(o, f->lambda); + fputs(", \"cv_score\": ", o); + jd(o, f->cv); + fputs(", \"test_nrmse\": [", o); + for (uint32_t c = 0; c < no; c++) { + fputs(c ? ", " : "", o); + jd(o, f->test[c]); + } + fputs("], \"train_nrmse\": [", o); + for (uint32_t c = 0; c < no; c++) { + fputs(c ? ", " : "", o); + jd(o, f->train[c]); + } + fputs("]}", o); +} + +/* Product features: x (n x nf) -> [x, x_i x_j for i <= j]. */ +static double *with_products(const double *x, uint32_t n, uint32_t nf, uint32_t *nf_out) +{ + uint32_t m = nf + nf * (nf + 1u) / 2u; + double *z = malloc((size_t)n * m * sizeof(double)); + if (!z) return NULL; + for (uint32_t r = 0; r < n; r++) { + const double *a = x + (size_t)r * nf; + double *b = z + (size_t)r * m; + uint32_t k = 0; + for (uint32_t i = 0; i < nf; i++) b[k++] = a[i]; + for (uint32_t i = 0; i < nf; i++) + for (uint32_t j = i; j < nf; j++) b[k++] = a[i] * a[j]; + } + *nf_out = m; + return z; +} + +/* Squares only: x -> [x, x.^2]. */ +static double *with_squares(const double *x, uint32_t n, uint32_t nf) +{ + double *z = malloc((size_t)n * 2u * nf * sizeof(double)); + if (!z) return NULL; + for (uint32_t r = 0; r < n; r++) + for (uint32_t i = 0; i < nf; i++) { + double v = x[(size_t)r * nf + i]; + z[(size_t)r * 2u * nf + i] = v; + z[(size_t)r * 2u * nf + nf + i] = v * v; + } + return z; +} + +/* ---------------------------------------------------------------- NARMA */ + +#define NM 3u /* sub-pulses per input */ +#define NPW 100u /* steps per 1 ms sub-pulse */ +#define N_TRAIN 2000u +#define N_TEST 1000u +#define WASHOUT 100u +#define NDELAY 12u +#define I_HI 1e-10 +#define NMODEL_N 6 +#define NNET_N 2 +static const uint32_t ORDERS[3] = {2, 5, 10}; +/* models 0, 1: the declared 50-node chain; 4, 5: the post-hoc 5-node chain (section 10.1) */ +static const char *NARMA_MODELS[NMODEL_N] = {"RC-connected", "RC-disconnected", + "BL-linear", "BL-quadratic", + "RC-connected-5 (post hoc)", "RC-disconnected-5 (post hoc)"}; + +typedef struct { + int seed; + uint32_t mask_start[64], nd[NNET_N], nodes[NNET_N][2]; + Run run[NNET_N][2][2]; /* [net][connected, disconnected][train, test] */ + Fit f[NMODEL_N][3]; +} NarmaResult; + +/* Knot table for one split: sub-pulse j covers knots [10 j, 10 j + 10); + * one extra final knot repeats the last value. */ +static float *narma_table(const double *u, uint32_t n, const uint32_t *drv, uint32_t nd, uint32_t L, + const uint8_t (*mask)[NM], uint32_t *knots) +{ + const uint32_t kn = n * NM * 10u + 1u; + float *tab = calloc((size_t)kn * L, sizeof(float)); + if (!tab) return NULL; + for (uint32_t k = 0; k < kn; k++) { + uint32_t j = k / 10u; + if (j >= n * NM) j = n * NM - 1u; + uint32_t c = j / NM, sub = j % NM; + double on = 2.0 * u[c] * I_HI; + for (uint32_t d = 0; d < nd; d++) tab[(size_t)k * L + drv[d]] = (float)(mask[d][sub] ? on : I_HI - on); + } + *knots = kn; + return tab; +} + +static void fit_refused(Fit *F, OmegaResStatus st, uint32_t nf) +{ + memset(F, 0, sizeof *F); + F->st = st; + F->nf = nf; + for (int c = 0; c < 3; c++) F->test[c] = F->train[c] = 0.0 / 0.0; + F->lambda = F->cv = 0.0 / 0.0; +} + +static void *narma_seed(void *arg) +{ + NarmaResult *R = arg; + const int seed = R->seed; + double u[2][N_TRAIN]; + const uint32_t n[2] = {N_TRAIN, N_TEST}, nr[2] = {N_TRAIN - WASHOUT, N_TEST - WASHOUT}; + ResRng ru[2] = {stream(seed, P_NARMA_TRAIN), stream(seed, P_NARMA_TEST)}, rm = stream(seed, P_NARMA_MASK); + for (int sp = 0; sp < 2; sp++) + for (uint32_t c = 0; c < n[sp]; c++) u[sp][c] = 0.5 * res_rng_unit(&ru[sp]); + static const uint8_t DB[4] = {0, 0, 1, 1}; /* de Bruijn B(2, 2) */ + uint8_t mask[64][NM]; + for (uint32_t d = 0; d < 64; d++) { /* 49 used by the 50-node chain, the first 4 by the 5-node one */ + R->mask_start[d] = (uint32_t)(res_rng_next(&rm) % 4u); + for (uint32_t k = 0; k < NM; k++) mask[d][k] = DB[(R->mask_start[d] + k) % 4u]; + } + double *y[3][2]; + for (int sp = 0; sp < 2; sp++) + for (int o = 0; o < 3; o++) { + double *full = malloc((size_t)n[sp] * sizeof(double)); + if (!full) return NULL; + res_narma(u[sp], n[sp], ORDERS[o], full); + y[o][sp] = full + WASHOUT; + } + for (int net = 0; net < NNET_N; net++) { + OmegaResTopology tc, td; + OmegaResParams pc, pd; + uint32_t inp[3], g = 4, drv_c[64], nd = 0, drv_d[64]; + float conc[64]; + OmegaResStatus st = net == 0 ? res_net_topology(RES_NET_CHAIN50, &tc, inp, &g) : omega_res_topology_chain(5, 4, &tc); + if (st != OMEGA_RES_OK || omega_res_params_reference(OMEGA_RES_REF_NARMA, tc.node_count, &pc) != OMEGA_RES_OK) + return NULL; + for (uint32_t i = 0; i < tc.node_count; i++) + if (i != g) { + drv_c[nd] = i; + conc[nd] = pc.conc_um[i]; + drv_d[nd] = nd; + nd++; + } + OmegaResStatus dst = res_net_disconnected(OMEGA_RES_REF_NARMA, conc, nd, &td, &pd); + R->nd[net] = nd; + R->nodes[net][0] = tc.node_count; + R->nodes[net][1] = dst == OMEGA_RES_OK ? td.node_count : 0; + const uint32_t nfr = nd * NM + 1u; + double *xr[2][2] = {{0}}; + for (int sp = 0; sp < 2; sp++) { + uint64_t *steps = malloc((size_t)n[sp] * NM * sizeof(uint64_t)); + if (!steps) return NULL; + for (uint32_t j = 0; j < n[sp] * NM; j++) steps[j] = (uint64_t)(j + 1u) * NPW; /* end of sub-pulse j */ + for (int m = 0; m < 2; m++) { + const OmegaResTopology *t = m ? &td : &tc; + const uint32_t *drv = m ? drv_d : drv_c; + if (m && dst != OMEGA_RES_OK) { + R->run[net][m][sp].st = dst; + continue; + } + uint32_t kn; + float *tab = narma_table(u[sp], n[sp], drv, nd, t->node_count, (const uint8_t(*)[NM])mask, &kn); + double *v = malloc((size_t)n[sp] * NM * t->node_count * sizeof(double)); + xr[m][sp] = malloc((size_t)nr[sp] * nfr * sizeof(double)); + if (!tab || !v || !xr[m][sp]) return NULL; + R->run[net][m][sp] = + simulate(t, m ? &pd : &pc, OMEGA_RES_INIT_N0, 0.0f, tab, kn, steps, (size_t)n[sp] * NM, v); + for (uint32_t r = 0; r < nr[sp]; r++) { + uint32_t c = WASHOUT + r; /* features: sub-pulses of input c-1, then u(c-1) */ + double *row = xr[m][sp] + (size_t)r * nfr; + for (uint32_t d = 0; d < nd; d++) + for (uint32_t k = 0; k < NM; k++) + row[d * NM + k] = v[((size_t)(c - 1u) * NM + k) * t->node_count + drv[d]]; + row[nd * NM] = u[sp][c - 1u]; + } + free(tab); + free(v); + } + free(steps); + } + for (int o = 0; o < 3; o++) + for (int m = 0; m < 2; m++) { + Fit *F = &R->f[net ? 4 + m : m][o]; + const Run *a = &R->run[net][m][0], *b = &R->run[net][m][1]; + if (a->st != OMEGA_RES_OK || b->st != OMEGA_RES_OK) + fit_refused(F, a->st != OMEGA_RES_OK ? a->st : b->st, nfr); + else + *F = fit(xr[m][0], y[o][0], nr[0], xr[m][1], y[o][1], nr[1], nfr, 1); + } + for (int sp = 0; sp < 2; sp++) { + free(xr[0][sp]); + free(xr[1][sp]); + } + } + /* baselines */ + double *xb[2], *xq[2]; + uint32_t nfq = 0; + for (int sp = 0; sp < 2; sp++) { + xb[sp] = malloc((size_t)nr[sp] * NDELAY * sizeof(double)); + if (!xb[sp]) return NULL; + for (uint32_t r = 0; r < nr[sp]; r++) + for (uint32_t i = 0; i < NDELAY; i++) xb[sp][(size_t)r * NDELAY + i] = u[sp][WASHOUT + r - 1u - i]; + xq[sp] = with_products(xb[sp], nr[sp], NDELAY, &nfq); + if (!xq[sp]) return NULL; + } + for (int o = 0; o < 3; o++) { + R->f[2][o] = fit(xb[0], y[o][0], nr[0], xb[1], y[o][1], nr[1], NDELAY, 1); + R->f[3][o] = fit(xq[0], y[o][0], nr[0], xq[1], y[o][1], nr[1], nfq, 1); + } + for (int sp = 0; sp < 2; sp++) { + free(xb[sp]); + free(xq[sp]); + for (int o = 0; o < 3; o++) free(y[o][sp] - WASHOUT); + } + return R; +} + +/* --------------------------------------------------------------- Lorenz */ + +#define LZ_DT 1e-4 +#define LZ_DISCARD 200000u +#define LZ_POINTS 200001u /* 20 s recorded, the knots */ +#define LZ_SAMPLE 100u /* trajectory points per 10 ms sample */ +#define LZ_NS 2001u /* samples 0 .. 20 s */ +#define LZ_ROW0 200u +#define LZ_ROW1 1975u +#define LZ_NROW (LZ_ROW1 - LZ_ROW0 + 1u) +#define LZ_LAGS 5u +#define NMODEL_L 6 +static const uint32_t HORIZONS[3] = {0, 1, 25}; +static const char *LZ_TASKS[3] = {"T0", "T1", "T25"}; +static const char *LZ_MODELS[NMODEL_L] = {"RC-connected-lin", "RC-connected-sq", "RC-disconnected-lin", + "RC-disconnected-sq", "BL-linear", "BL-quadratic"}; + +typedef struct { + int seed; + double ic[2][3]; + uint32_t nodes[2]; + Run run[2][2]; + Fit f[NMODEL_L][3]; +} LorenzResult; + +static void lz_deriv(const double *s, double *d) +{ + d[0] = 10.0 * (s[1] - s[0]); + d[1] = s[0] * (28.0 - s[2]) - s[1]; + d[2] = s[0] * s[1] - (8.0 / 3.0) * s[2]; +} + +static void lz_rk4(double *s) +{ + double k1[3], k2[3], k3[3], k4[3], t[3]; + lz_deriv(s, k1); + for (int i = 0; i < 3; i++) t[i] = s[i] + 0.5 * LZ_DT * k1[i]; + lz_deriv(t, k2); + for (int i = 0; i < 3; i++) t[i] = s[i] + 0.5 * LZ_DT * k2[i]; + lz_deriv(t, k3); + for (int i = 0; i < 3; i++) t[i] = s[i] + LZ_DT * k3[i]; + lz_deriv(t, k4); + for (int i = 0; i < 3; i++) s[i] += LZ_DT / 6.0 * (k1[i] + 2.0 * k2[i] + 2.0 * k3[i] + k4[i]); +} + +/* Reference injection currents (Lorenz63SolverCustomRegression.m:46-49). */ +static double lz_current(double v, int c) +{ + return c < 2 ? (v * 1.05e-10 + 1e-9) / 10.0 : (v * 1e-10 * 2.05) / 10.0; +} + +static void *lorenz_seed(void *arg) +{ + LorenzResult *R = arg; + double *X[2]; + for (int sp = 0; sp < 2; sp++) { + ResRng r = stream(R->seed, sp ? P_LORENZ_TEST : P_LORENZ_TRAIN); + double s[3] = {-10.0 + 20.0 * res_rng_unit(&r), -10.0 + 20.0 * res_rng_unit(&r), 10.0 + 30.0 * res_rng_unit(&r)}; + memcpy(R->ic[sp], s, sizeof s); + for (uint32_t k = 0; k < LZ_DISCARD; k++) lz_rk4(s); + X[sp] = malloc((size_t)LZ_POINTS * 3u * sizeof(double)); + if (!X[sp]) return NULL; + for (uint32_t k = 0; k < LZ_POINTS; k++) { + memcpy(X[sp] + (size_t)k * 3u, s, sizeof s); + lz_rk4(s); + } + } + OmegaResTopology tc, td; + OmegaResParams pc, pd; + uint32_t inp[3], g, drv_d[3] = {0, 1, 2}; + if (res_net_topology(RES_NET_HEX43, &tc, inp, &g) != OMEGA_RES_OK || + omega_res_params_reference(OMEGA_RES_REF_LORENZ, tc.node_count, &pc) != OMEGA_RES_OK) + return NULL; + float conc[3] = {pc.conc_um[inp[0]], pc.conc_um[inp[1]], pc.conc_um[inp[2]]}; + OmegaResStatus dst = res_net_disconnected(OMEGA_RES_REF_LORENZ, conc, 3, &td, &pd); + R->nodes[0] = tc.node_count; + R->nodes[1] = dst == OMEGA_RES_OK ? td.node_count : 0; + uint64_t steps[LZ_NS]; + for (uint32_t j = 0; j < LZ_NS; j++) steps[j] = (uint64_t)j * LZ_SAMPLE * KSTEP; + /* reservoir features at rows j = LZ_ROW0 .. LZ_ROW1 */ + const uint32_t nfl[2] = {tc.node_count - 1u, 3u}; + double *xl[2][2] = {{0}}, *xs[2][2] = {{0}}, *xb[2], *xq[2], *y[3][2]; + uint32_t nfq = 0; + for (int sp = 0; sp < 2; sp++) { + for (int m = 0; m < 2; m++) { + const OmegaResTopology *t = m ? &td : &tc; + if (m && dst != OMEGA_RES_OK) { + R->run[m][sp].st = dst; + continue; + } + const uint32_t *drv = m ? drv_d : inp, L = t->node_count; + float *tab = calloc((size_t)LZ_POINTS * L, sizeof(float)); + double *v = malloc((size_t)LZ_NS * L * sizeof(double)); + xl[m][sp] = malloc((size_t)LZ_NROW * nfl[m] * sizeof(double)); + if (!tab || !v || !xl[m][sp]) return NULL; + for (uint32_t k = 0; k < LZ_POINTS; k++) + for (int c = 0; c < 3; c++) tab[(size_t)k * L + drv[c]] = (float)lz_current(X[sp][(size_t)k * 3u + c], c); + R->run[m][sp] = simulate(t, m ? &pd : &pc, OMEGA_RES_INIT_CONST, 1.0f, tab, LZ_POINTS, steps, LZ_NS, v); + for (uint32_t r = 0; r < LZ_NROW; r++) { + uint32_t j = LZ_ROW0 + r, f = 0; + for (uint32_t i = 0; i < L; i++) { + if (m == 0 && i == g) continue; /* the ground is 0 V */ + if (m == 1 && i >= 3u) break; /* disconnected: the three driven droplets */ + xl[m][sp][(size_t)r * nfl[m] + f++] = v[(size_t)j * L + i]; + } + } + xs[m][sp] = with_squares(xl[m][sp], LZ_NROW, nfl[m]); + if (!xs[m][sp]) return NULL; + free(tab); + free(v); + } + xb[sp] = malloc((size_t)LZ_NROW * LZ_LAGS * 3u * sizeof(double)); + if (!xb[sp]) return NULL; + for (uint32_t r = 0; r < LZ_NROW; r++) + for (uint32_t l = 0; l < LZ_LAGS; l++) + for (int c = 0; c < 3; c++) + xb[sp][(size_t)r * LZ_LAGS * 3u + l * 3u + c] = + X[sp][((size_t)(LZ_ROW0 + r - l) * LZ_SAMPLE) * 3u + c]; + xq[sp] = with_products(xb[sp], LZ_NROW, LZ_LAGS * 3u, &nfq); + for (int h = 0; h < 3; h++) { + y[h][sp] = malloc((size_t)LZ_NROW * 3u * sizeof(double)); + if (!y[h][sp] || !xq[sp]) return NULL; + for (uint32_t r = 0; r < LZ_NROW; r++) + for (int c = 0; c < 3; c++) + y[h][sp][(size_t)r * 3u + c] = X[sp][((size_t)(LZ_ROW0 + r + HORIZONS[h]) * LZ_SAMPLE) * 3u + c]; + } + free(X[sp]); + } + for (int h = 0; h < 3; h++) { + for (int m = 0; m < 2; m++) { + int ok = R->run[m][0].st == OMEGA_RES_OK && R->run[m][1].st == OMEGA_RES_OK; + for (int q = 0; q < 2; q++) { + Fit *F = &R->f[2 * m + q][h]; + if (!ok) { + memset(F, 0, sizeof *F); + F->st = R->run[m][0].st != OMEGA_RES_OK ? R->run[m][0].st : R->run[m][1].st; + F->nf = nfl[m] * (q + 1u); + for (int c = 0; c < 3; c++) F->test[c] = F->train[c] = 0.0 / 0.0; + F->lambda = F->cv = 0.0 / 0.0; + continue; + } + *F = q ? fit(xs[m][0], y[h][0], LZ_NROW, xs[m][1], y[h][1], LZ_NROW, 2u * nfl[m], 3) + : fit(xl[m][0], y[h][0], LZ_NROW, xl[m][1], y[h][1], LZ_NROW, nfl[m], 3); + } + } + R->f[4][h] = fit(xb[0], y[h][0], LZ_NROW, xb[1], y[h][1], LZ_NROW, LZ_LAGS * 3u, 3); + R->f[5][h] = fit(xq[0], y[h][0], LZ_NROW, xq[1], y[h][1], LZ_NROW, nfq, 3); + } + for (int sp = 0; sp < 2; sp++) { + for (int m = 0; m < 2; m++) { + free(xl[m][sp]); + free(xs[m][sp]); + } + free(xb[sp]); + free(xq[sp]); + for (int h = 0; h < 3; h++) free(y[h][sp]); + } + return R; +} + +/* ------------------------------------------------------------ summaries */ + +typedef struct { + double mean, sd, min, max; + int n; +} Stat; + +static Stat stat(const double *v, int n) +{ + Stat s = {0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0}; + double sum = 0.0, mn = 1.0 / 0.0, mx = -1.0 / 0.0; + for (int i = 0; i < n; i++) { + if (!(v[i] == v[i])) continue; + sum += v[i]; + if (v[i] < mn) mn = v[i]; + if (v[i] > mx) mx = v[i]; + s.n++; + } + if (!s.n) return s; + s.mean = sum / s.n; + s.min = mn; + s.max = mx; + if (s.n > 1) { + double q = 0.0; + for (int i = 0; i < n; i++) + if (v[i] == v[i]) q += (v[i] - s.mean) * (v[i] - s.mean); + s.sd = res_sqrt(q / (s.n - 1)); + } + return s; +} + +static void stat_json(FILE *o, const Stat *s) +{ + fprintf(o, "{\"seeds_ok\": %d, \"mean\": ", s->n); + jd(o, s->mean); + fputs(", \"sd\": ", o); + jd(o, s->sd); + fputs(", \"min\": ", o); + jd(o, s->min); + fputs(", \"max\": ", o); + jd(o, s->max); + fputc('}', o); +} + +/* Paired comparison a - b over seeds; wins = seeds where a < b. */ +static void paired_json(FILE *o, const char *name, const double *a, const double *b, int n) +{ + double d[NSEED_MAX]; + int wins = 0, both = 0; + for (int i = 0; i < n; i++) { + d[i] = a[i] - b[i]; + if (d[i] == d[i]) { + both++; + wins += a[i] < b[i]; + } + } + Stat s = stat(d, n); + fprintf(o, "{\"comparison\": \"%s\", \"difference\": ", name); + stat_json(o, &s); + fprintf(o, ", \"first_wins\": %d, \"seeds_compared\": %d}", wins, both); +} + +static int parse_seeds(int argc, char **argv, int *seeds) +{ + int n = 0; + for (int i = 0; i < argc && n < NSEED_MAX; i++) seeds[n++] = atoi(argv[i]); + if (!n) + for (n = 0; n < 5; n++) seeds[n] = n + 1; + return n; +} + +static void seeds_json(FILE *o, const int *seeds, int n) +{ + fputs("[", o); + for (int i = 0; i < n; i++) fprintf(o, "%s%d", i ? ", " : "", seeds[i]); + fputs("]", o); +} + +int res_bench_narma(int argc, char **argv, FILE *o) +{ + int seeds[NSEED_MAX], ns = parse_seeds(argc, argv, seeds), bad = 0; + NarmaResult *R = calloc((size_t)ns, sizeof *R); + pthread_t th[NSEED_MAX]; + if (!R) return 2; + double t0 = res_now_s(); + for (int i = 0; i < ns; i++) { + R[i].seed = seeds[i]; + if (pthread_create(&th[i], NULL, narma_seed, &R[i])) return 2; + } + for (int i = 0; i < ns; i++) { + void *ret; + pthread_join(th[i], &ret); + if (!ret) bad = 1; + } + if (bad) { + fprintf(stderr, "res_qualify: bench-narma setup failed\n"); + return 2; + } + fprintf(o, "{\n \"schema\": \"omega-reservoir-bench-narma/1\",\n \"protocol\": \"RESERVOIR_REFERENCE.md section 10\"," + "\n \"seeds\": "); + seeds_json(o, seeds, ns); + fprintf(o, ",\n \"setup\": {\"train_inputs\": %u, \"test_inputs\": %u, \"washout\": %u, \"subpulses\": %u, " + "\"subpulse_s\": 1e-3, \"current_hi_a\": 1e-10, \"delay_line\": %u, \"lambda_grid\": [1e-6, 1e2, 9], " + "\"folds\": 5,\n \"networks\": [{\"name\": \"Length50 chain (declared)\", \"driven_nodes\": %u, \"nodes_connected\": %u, " + "\"nodes_disconnected\": %u}, {\"name\": \"Length5 chain (post hoc, section 10.1)\", \"driven_nodes\": %u, " + "\"nodes_connected\": %u, \"nodes_disconnected\": %u}],\n " + "\"rc_squared_states\": \"NOT_RUN (50-node chain: 295 features > readout bound 256)\"},\n", + N_TRAIN, N_TEST, WASHOUT, NM, NDELAY, R[0].nd[0], R[0].nodes[0][0], R[0].nodes[0][1], R[0].nd[1], + R[0].nodes[1][0], R[0].nodes[1][1]); + fprintf(o, " \"wall_s\": %.1f,\n \"per_seed\": [", res_now_s() - t0); + for (int i = 0; i < ns; i++) { + fprintf(o, "%s\n {\"seed\": %d, \"runs\": [", i ? "," : "", R[i].seed); + static const char *rn[2][2][2] = {{{"chain50 connected/train", "chain50 connected/test"}, + {"chain50 disconnected/train", "chain50 disconnected/test"}}, + {{"chain5 connected/train", "chain5 connected/test"}, + {"chain5 disconnected/train", "chain5 disconnected/test"}}}; + for (int net = 0; net < NNET_N; net++) + for (int m = 0; m < 2; m++) + for (int sp = 0; sp < 2; sp++) { + fputs(net || m || sp ? ", " : "", o); + run_json(o, rn[net][m][sp], &R[i].run[net][m][sp]); + } + fputs("],\n \"mask_starts\": [", o); + for (uint32_t d = 0; d < R[i].nd[0]; d++) fprintf(o, "%s%u", d ? ", " : "", R[i].mask_start[d]); + fputs("],\n \"fits\": [", o); + for (int m = 0; m < NMODEL_N; m++) + for (int t = 0; t < 3; t++) { + char task[16]; + snprintf(task, sizeof task, "NARMA-%u", ORDERS[t]); + fputs(m || t ? ",\n " : "", o); + fit_json(o, NARMA_MODELS[m], task, &R[i].f[m][t], 1); + } + fputs("]}", o); + } + fputs("\n ],\n \"summary\": [", o); + for (int t = 0; t < 3; t++) { + double v[NMODEL_N][NSEED_MAX], best[NSEED_MAX]; + for (int i = 0; i < ns; i++) { + for (int m = 0; m < NMODEL_N; m++) v[m][i] = R[i].f[m][t].test[0]; + /* best baseline per seed: the lower cross-validation score (training rows only) */ + const Fit *a = &R[i].f[2][t], *b = &R[i].f[3][t]; + best[i] = (b->st == OMEGA_RES_OK && (a->st != OMEGA_RES_OK || b->cv < a->cv)) ? b->test[0] : a->test[0]; + } + fprintf(o, "%s\n {\"task\": \"NARMA-%u\", \"test_nrmse\": {", t ? "," : "", ORDERS[t]); + for (int m = 0; m < NMODEL_N; m++) { + Stat s = stat(v[m], ns); + fprintf(o, "%s\"%s\": ", m ? ", " : "", NARMA_MODELS[m]); + stat_json(o, &s); + } + fputs("},\n \"paired\": [", o); + paired_json(o, "RC-connected - RC-disconnected", v[0], v[1], ns); + fputs(", ", o); + paired_json(o, "RC-connected - best baseline (by CV score)", v[0], best, ns); + fputs(", ", o); + paired_json(o, "RC-connected-5 - RC-disconnected-5 (post hoc)", v[4], v[5], ns); + fputs(", ", o); + paired_json(o, "RC-connected-5 - best baseline (by CV score) (post hoc)", v[4], best, ns); + fputs("]}", o); + } + fputs("\n ],\n \"significance\": \"none claimed (five seeds)\"\n}\n", o); + free(R); + return 0; +} + +int res_bench_lorenz(int argc, char **argv, FILE *o) +{ + int seeds[NSEED_MAX], ns = parse_seeds(argc, argv, seeds), bad = 0; + LorenzResult *R = calloc((size_t)ns, sizeof *R); + pthread_t th[NSEED_MAX]; + if (!R) return 2; + double t0 = res_now_s(); + for (int i = 0; i < ns; i++) { + R[i].seed = seeds[i]; + if (pthread_create(&th[i], NULL, lorenz_seed, &R[i])) return 2; + } + for (int i = 0; i < ns; i++) { + void *ret; + pthread_join(th[i], &ret); + if (!ret) bad = 1; + } + if (bad) { + fprintf(stderr, "res_qualify: bench-lorenz setup failed\n"); + return 2; + } + fprintf(o, "{\n \"schema\": \"omega-reservoir-bench-lorenz/1\",\n \"protocol\": \"RESERVOIR_REFERENCE.md section 10\"," + "\n \"seeds\": "); + seeds_json(o, seeds, ns); + fprintf(o, ",\n \"setup\": {\"dt\": 1e-4, \"discard_s\": 20, \"record_s\": 20, \"sample_s\": 0.01, " + "\"rows\": [%u, %u], \"horizons_samples\": [0, 1, 25], \"lags\": %u, \"lambda_grid\": [1e-6, 1e2, 9], " + "\"folds\": 5, \"nodes_connected\": %u, \"nodes_disconnected\": %u},\n", + LZ_ROW0, LZ_ROW1, LZ_LAGS, R[0].nodes[0], R[0].nodes[1]); + fprintf(o, " \"wall_s\": %.1f,\n \"per_seed\": [", res_now_s() - t0); + for (int i = 0; i < ns; i++) { + fprintf(o, "%s\n {\"seed\": %d, \"initial_state\": {\"train\": [", i ? "," : "", R[i].seed); + for (int sp = 0; sp < 2; sp++) { + if (sp) fputs("], \"test\": [", o); + for (int c = 0; c < 3; c++) { + fputs(c ? ", " : "", o); + jd(o, R[i].ic[sp][c]); + } + } + fputs("]}, \"runs\": [", o); + static const char *rn[2][2] = {{"connected/train", "connected/test"}, {"disconnected/train", "disconnected/test"}}; + for (int m = 0; m < 2; m++) + for (int sp = 0; sp < 2; sp++) { + fputs(m || sp ? ", " : "", o); + run_json(o, rn[m][sp], &R[i].run[m][sp]); + } + fputs("],\n \"fits\": [", o); + for (int m = 0; m < NMODEL_L; m++) + for (int t = 0; t < 3; t++) { + fputs(m || t ? ",\n " : "", o); + fit_json(o, LZ_MODELS[m], LZ_TASKS[t], &R[i].f[m][t], 3); + } + fputs("]}", o); + } + fputs("\n ],\n \"summary\": [", o); + for (int t = 0; t < 3; t++) { + double v[NMODEL_L][NSEED_MAX], best[NSEED_MAX]; + for (int i = 0; i < ns; i++) { + for (int m = 0; m < NMODEL_L; m++) v[m][i] = fit_mean(&R[i].f[m][t], 3); + const Fit *a = &R[i].f[4][t], *b = &R[i].f[5][t]; + best[i] = (b->st == OMEGA_RES_OK && (a->st != OMEGA_RES_OK || b->cv < a->cv)) ? fit_mean(b, 3) + : fit_mean(a, 3); + } + fprintf(o, "%s\n {\"task\": \"%s\", \"test_nrmse_mean_over_xyz\": {", t ? "," : "", LZ_TASKS[t]); + for (int m = 0; m < NMODEL_L; m++) { + Stat s = stat(v[m], ns); + fprintf(o, "%s\"%s\": ", m ? ", " : "", LZ_MODELS[m]); + stat_json(o, &s); + } + fputs("},\n \"paired\": [", o); + paired_json(o, "RC-connected-lin - RC-disconnected-lin", v[0], v[2], ns); + fputs(", ", o); + paired_json(o, "RC-connected-sq - RC-disconnected-sq", v[1], v[3], ns); + fputs(", ", o); + paired_json(o, "RC-connected-lin - best baseline (by CV score)", v[0], best, ns); + fputs(", ", o); + paired_json(o, "RC-connected-sq - best baseline (by CV score)", v[1], best, ns); + fputs("]}", o); + } + fputs("\n ],\n \"significance\": \"none claimed (five seeds)\"\n}\n", o); + free(R); + return 0; +} + +/* ---------------------------------------------------------- performance */ + +#define PERF_WARM 10000u +#define PERF_STEPS 40000u +#define PERF_REPS 5u + +static int64_t now_ns(void) +{ + struct timespec t; + clock_gettime(CLOCK_MONOTONIC, &t); + return (int64_t)t.tv_sec * 1000000000 + t.tv_nsec; +} + +static int cmp_i64(const void *a, const void *b) +{ + int64_t x = *(const int64_t *)a, y = *(const int64_t *)b; + return (x > y) - (x < y); +} + +static int64_t pct(const int64_t *s, size_t n, double p) /* nearest rank */ +{ + size_t k = (size_t)(p * (double)n + 0.999999999); + if (k < 1) k = 1; + if (k > n) k = n; + return s[k - 1]; +} + +/* /proc/cpuinfo "CPU part" of one logical CPU, or "unknown". */ +static void cpu_part(int cpu, char *out, size_t n) +{ + snprintf(out, n, "unknown"); + FILE *f = fopen("/proc/cpuinfo", "r"); + if (!f) return; + char line[256]; + int cur = -1; + while (fgets(line, sizeof line, f)) { + int p; + if (sscanf(line, "processor : %d", &p) == 1) cur = p; + char *c = strstr(line, "CPU part"); + if (c && cur == cpu) { + char *v = strchr(c, ':'); + if (v) { + v++; + while (*v == ' ' || *v == '\t') v++; + snprintf(out, n, "%.*s", (int)strcspn(v, "\n"), v); + } + break; + } + } + fclose(f); +} + +typedef struct { + const char *name; + ResNet net; /* 0: the 5-node chain */ + OmegaResReference ref; +} PerfNet; + +int res_perf(FILE *o) +{ + /* pin to one core: RES_PERF_CPU, else the first Cortex-X925 (part 0xd85), else CPU 0 */ + int cpu = -1; + const char *env = getenv("RES_PERF_CPU"); + char part[64]; + if (env) cpu = atoi(env); + for (int c = 0; cpu < 0 && c < CPU_SETSIZE && c < 1024; c++) { + cpu_part(c, part, sizeof part); + if (!strcmp(part, "0xd85")) cpu = c; + if (!strcmp(part, "unknown") && c > 0) break; + } + if (cpu < 0) cpu = 0; + cpu_set_t set; + CPU_ZERO(&set); + CPU_SET(cpu, &set); + int pinned = sched_setaffinity(0, sizeof set, &set) == 0; + cpu_part(cpu, part, sizeof part); + struct utsname un; + uname(&un); + /* timer cost */ + int64_t tc0 = now_ns(); + for (int i = 0; i < 100000; i++) (void)now_ns(); + double timer_ns = (double)(now_ns() - tc0) / 100000.0; + + static const PerfNet nets[3] = {{"chain5 NARMA (G2-N1)", (ResNet)0, OMEGA_RES_REF_NARMA}, + {"chain50 NARMA", RES_NET_CHAIN50, OMEGA_RES_REF_NARMA}, + {"hex43 Lorenz", RES_NET_HEX43, OMEGA_RES_REF_LORENZ}}; + fprintf(o, "{\n \"schema\": \"omega-reservoir-perf/1\",\n \"protocol\": \"RESERVOIR_REFERENCE.md section 10\",\n"); + fprintf(o, " \"host\": {\"sysname\": \"%s\", \"release\": \"%s\", \"machine\": \"%s\", \"cpu\": %d, " + "\"cpu_part\": \"%s\", \"pinned\": %s, \"sched_getcpu\": %d},\n", + un.sysname, un.release, un.machine, cpu, part, pinned ? "true" : "false", sched_getcpu()); + fputs(" \"compiler\": ", o); + res_json_str(o, __VERSION__); +#ifdef RES_BUILD_FLAGS + fputs(",\n \"flags\": ", o); + res_json_str(o, RES_BUILD_FLAGS); +#endif + fprintf(o, ",\n \"timer\": {\"clock\": \"CLOCK_MONOTONIC\", \"mean_call_ns\": %.1f, \"included_in_latency\": true},\n", + timer_ns); + fprintf(o, " \"struct_bytes\": {\"OmegaResConfig\": %zu, \"OmegaResState\": %zu, \"OmegaResWorkspace\": %zu, " + "\"OmegaResTopology\": %zu, \"OmegaResReadout\": %zu, \"OmegaResReadoutWorkspace\": %zu},\n", + sizeof(OmegaResConfig), sizeof(OmegaResState), sizeof(OmegaResWorkspace), sizeof(OmegaResTopology), + sizeof(OmegaResReadout), sizeof(OmegaResReadoutWorkspace)); + fprintf(o, " \"warmup_steps\": %u, \"timed_steps\": %u, \"repetitions\": %u,\n \"networks\": [", PERF_WARM, + PERF_STEPS, PERF_REPS); + const uint32_t total = PERF_WARM + PERF_STEPS * PERF_REPS, knots = total / KSTEP + 1u; + int64_t *lat = malloc((size_t)PERF_STEPS * PERF_REPS * sizeof(int64_t)); + int rc = 0; + if (!lat) return 2; + struct rusage ru0, ru1; + for (int ni = 0; ni < 3; ni++) { + OmegaResTopology t; + OmegaResParams p; + uint32_t inp[3], g = 0; + OmegaResStatus st = nets[ni].net ? res_net_topology(nets[ni].net, &t, inp, &g) + : omega_res_topology_chain(5, 4, &t); + if (!nets[ni].net) g = 4; + if (st == OMEGA_RES_OK) st = omega_res_params_reference(nets[ni].ref, t.node_count, &p); + ResSim *sim = calloc(1, sizeof *sim); + float *tab = calloc((size_t)knots * t.node_count, sizeof(float)); + if (!sim || !tab) return 2; + /* input (section 11.4): zero-mean 1 ms pulses on every non-ground node, uniform in + * +-0.1 nA / driven nodes, which keeps the 50-node chain inside |V| <= 1 V for the whole run + * (one-signed pulses of that size do not); or the reference Lorenz currents of a trajectory (hex43) */ + const double i_node = I_HI / (double)(t.node_count - 1u); + ResRng r = stream(1, P_PERF); + double s[3] = {1.0, 1.0, 20.0}; + for (uint32_t k = 0; k < knots; k++) { + if (nets[ni].ref == OMEGA_RES_REF_LORENZ) { + for (int c = 0; c < 3; c++) tab[(size_t)k * t.node_count + inp[c]] = (float)lz_current(s[c], c); + lz_rk4(s); + } else if (k % 10u == 0) { + for (uint32_t i = 0; i < t.node_count; i++) + tab[(size_t)k * t.node_count + i] = i == g ? 0.0f : (float)(i_node * (2.0 * res_rng_unit(&r) - 1.0)); + } else + memcpy(tab + (size_t)k * t.node_count, tab + (size_t)(k - 1u) * t.node_count, t.node_count * sizeof(float)); + } + OmegaResIntegrator ig = {STEP_S, KSTEP}; + if (st == OMEGA_RES_OK) st = omega_res_config_build(&t, &p, &ig, &sim->cfg); + if (st == OMEGA_RES_OK) + st = omega_res_state_init(&sim->cfg, nets[ni].ref == OMEGA_RES_REF_LORENZ ? OMEGA_RES_INIT_CONST : OMEGA_RES_INIT_N0, + nets[ni].ref == OMEGA_RES_REF_LORENZ ? 1.0f : 0.0f, &sim->s); + OmegaResInput in = {t.node_count, knots, tab}; + OmegaResState *cur = &sim->s, *nxt = &sim->next, *tmp; + for (uint32_t k = 0; st == OMEGA_RES_OK && k < PERF_WARM; k++) { + st = omega_res_step(&sim->cfg, &in, &sim->ws, cur, nxt); + tmp = cur, cur = nxt, nxt = tmp; + } + double rep_wall[PERF_REPS]; + getrusage(RUSAGE_SELF, &ru0); + int64_t w0 = now_ns(); + for (uint32_t rep = 0; st == OMEGA_RES_OK && rep < PERF_REPS; rep++) { + int64_t r0 = now_ns(), prev = r0; + for (uint32_t k = 0; st == OMEGA_RES_OK && k < PERF_STEPS; k++) { + st = omega_res_step(&sim->cfg, &in, &sim->ws, cur, nxt); + int64_t nw = now_ns(); + lat[(size_t)rep * PERF_STEPS + k] = nw - prev; + prev = nw; + tmp = cur, cur = nxt, nxt = tmp; + } + rep_wall[rep] = (double)(prev - r0) * 1e-9; + } + double wall = (double)(now_ns() - w0) * 1e-9; + getrusage(RUSAGE_SELF, &ru1); + double cpu_s = (double)(ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec) + 1e-6 * (ru1.ru_utime.tv_usec - ru0.ru_utime.tv_usec) + + (double)(ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec) + 1e-6 * (ru1.ru_stime.tv_usec - ru0.ru_stime.tv_usec); + fprintf(o, "%s\n {\"network\": \"%s\", \"nodes\": %u, \"membranes\": %u, \"status\": \"%s\"", ni ? "," : "", + nets[ni].name, t.node_count, t.edge_count, res_status_name(st)); + if (st == OMEGA_RES_OK) { + const size_t nl = (size_t)PERF_STEPS * PERF_REPS; + fputs(", \"per_repetition\": [", o); + for (uint32_t rep = 0; rep < PERF_REPS; rep++) { + int64_t *a = lat + (size_t)rep * PERF_STEPS; + qsort(a, PERF_STEPS, sizeof *a, cmp_i64); + fprintf(o, "%s{\"p50_ns\": %lld, \"p95_ns\": %lld, \"p99_ns\": %lld, \"max_ns\": %lld, \"steps_per_s\": %.1f}", + rep ? ", " : "", (long long)pct(a, PERF_STEPS, 0.50), (long long)pct(a, PERF_STEPS, 0.95), + (long long)pct(a, PERF_STEPS, 0.99), (long long)a[PERF_STEPS - 1], PERF_STEPS / rep_wall[rep]); + } + qsort(lat, nl, sizeof *lat, cmp_i64); + double sps = (double)nl / wall; + fprintf(o, "], \"pooled\": {\"p50_ns\": %lld, \"p95_ns\": %lld, \"p99_ns\": %lld, \"max_ns\": %lld}, " + "\"steps_per_s\": %.1f, \"simulated_s_per_wall_s\": %.6g, \"cpu_over_wall\": %.4f}", + (long long)pct(lat, nl, 0.50), (long long)pct(lat, nl, 0.95), (long long)pct(lat, nl, 0.99), + (long long)lat[nl - 1], sps, sps * (double)STEP_S, cpu_s / wall); + } else + rc = 1; + free(sim); + free(tab); + } + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + fprintf(o, "\n ],\n \"peak_rss_kib\": %ld,\n \"energy\": \"NOT_RUN (not instrumented; no efficiency claim)\"\n}\n", + ru.ru_maxrss); + free(lat); + return rc; +} diff --git a/tools/reservoir/res_common.c b/tools/reservoir/res_common.c new file mode 100644 index 000000000..9b5b97edb --- /dev/null +++ b/tools/reservoir/res_common.c @@ -0,0 +1,556 @@ +/* Shared parts of the Gate 2 tool; see res_common.h. */ +#include "res_common.h" + +#include "sha256.h" + +#include +#include +#include + +#define CZ "Codes for Zenodo/" +#define NC "NARMA Final Code/Connected Reservoir/" +#define NP "NARMA Final Code/Parallel Reservoir/" +#define LZ "Lorenz Final Code/" + +const ResPin RES_PINS[] = { + {"code.narma_connected", "src/" CZ NC "HyperParameterTuningOptimized.m", + "620640f002068048ab2c56f5090dc945e7b81595a9bc7f863331659a1850ceb5"}, + {"code.narma_parallel", "src/" CZ NP "ParallelReservoirNARMA.m", + "f120f9150db590e3fcf767cbd1840e0924f513b45d44cf8439be2229be0fb507"}, + {"code.lorenz43", "src/" CZ LZ "Lorenz63SolverCustomRegression.m", + "d291460fffe4efc1b2f013060c04e3a561dcd571de813a9c95277557daafdcac"}, + {"code.lorenz13", "src/" CZ LZ "Lorenz63SolverCustomRegression13Nodes.m", + "c9e2ad2b64832c50c95f9d61e86161496aef40640cc547d1d5ae3a9323eedbf1"}, + {"code.lorenz25", "src/" CZ LZ "Lorenz63SolverCustomRegression25Nodes.m", + "c1b31403cc9a2014c2f3b65056873306ed52174142259b5127b30c803927dece"}, + {"code.lorenz_gen", "src/" CZ LZ "LorenzDataGenerator.m", + "7295d55fa3e1209b74b4804f9de18f4952950020f32d0f318695286c5ccdfa1d"}, + {"narma.length5", "data/raw/" CZ NC "Length5.mat", "dc6e7914d216a21f664adcd4843e9f705616df47511879ba0bbeceb241b9b50a"}, + {"narma.length10", "data/raw/" CZ NC "Length10.mat", "ceca1f6e94f3239b2df072403a488f8929fe00673b5028319cd2094d6eae708e"}, + {"narma.length20", "data/raw/" CZ NC "Length20.mat", "aeb87fcec7655ce72386fdc28f2878b1f7b89097db523ab9fe5812fb6c4d1ee6"}, + {"narma.length50", "data/raw/" CZ NC "Length50.mat", "ff4c9d14abb6f64b1ab9f301072dc67316b7fd59fe61d0b7632ee467a8c2aae3"}, + {"narma.train_signal", "data/raw/" CZ NC "trainSignal.mat", + "48e8e2c775fda4ca85dfc14a3c202319d9c75e2d7db0baf237744ce51a4b02c1"}, + {"narma.test_signal", "data/raw/" CZ NC "testSignal.mat", + "f0e34c5733e2cc20852caf4874b92bcb19fcb95bd4da4ce0eb7f4919cabee8c1"}, + {"narma.results", "data/raw/" CZ NC "HyperParameterOptimizationVariablesToPlot.mat", + "6311b719d47bfa92b76e1c71b3e9fe0e2e30d564d9ee7c7b2f231a03683e66fd"}, + {"narma.parallel_results", "data/raw/" CZ NP "ParallelReservoirDataToPlot.mat", + "ccf13dd5045a50ce5e474915225f4961d6e56b949985ef701bffe3316822f1c6"}, + {"lorenz.data1", "data/raw/" CZ LZ "LorenzData1.mat", "6229d996681ef7e64336ef4f04e7bd82c0a8063e6e18e52667c699251091f6c4"}, + {"lorenz.data2", "data/raw/" CZ LZ "LorenzData2.mat", "d1c0dcccbee809e8880dd5b0e355dd456ab1605d0470dbfa99e1a54b2b51073a"}, + {"lorenz.fig43", "data/raw/" CZ LZ "Figure5_Data.mat", "f6055bc6b79cc686a5c7cca703fdf2e35de50e202e245bfe07f10f91ecad3500"}, + {"lorenz.fig25", "data/raw/" CZ LZ "Figure5_Data25Nodes.mat", + "0d85b0eaef9c6bb4eed07a3fe8f395802afbde0c3a75403ba216b55220754205"}, + {"lorenz.fig13", "data/raw/" CZ LZ "Figure5_Data13Nodes.mat", + "74988e19bd24540b0f623e20295a2813a0206917cdf6072d0dfaf69f8d091ed7"}, + {"lorenz.nrmse43", "data/raw/" CZ LZ "LorenzNormalizedNRMSEs.mat", + "514ba3082a21eb541e0af8a9fbb80596742f9ddafee466391a00842a5d4e5616"}, + {"lorenz.nrmse25", "data/raw/" CZ LZ "LorenzNormalizedNRMSEs25Nodes.mat", + "881e92a0a5cd6b46fb588b41593e83d66ec2af25d16fb7198444fc82c3aaf14d"}, + {"lorenz.nrmse13", "data/raw/" CZ LZ "LorenzNormalizedNRMSEs13Nodes.mat", + "5f2d18b150d5baa9e792aa967d46a541a6031ff2805467ba30b72db745d55733"}, +}; +const unsigned RES_PIN_COUNT = sizeof RES_PINS / sizeof RES_PINS[0]; + +const ResPin *res_pin(const char *key) +{ + for (unsigned i = 0; i < RES_PIN_COUNT; i++) + if (strcmp(RES_PINS[i].key, key) == 0) return &RES_PINS[i]; + return NULL; +} + +static int unhex(const char *h, uint8_t out[32]) +{ + for (int i = 0; i < 32; i++) { + int v = 0; + for (int k = 0; k < 2; k++) { + char c = h[2 * i + k]; + int d = c >= '0' && c <= '9' ? c - '0' : c >= 'a' && c <= 'f' ? c - 'a' + 10 : -1; + if (d < 0) return -1; + v = v * 16 + d; + } + out[i] = (uint8_t)v; + } + return 0; +} + +static int join(const char *root, const char *rel, char *buf, size_t cap) +{ + int n = snprintf(buf, cap, "%s/%s", root, rel); + return n > 0 && (size_t)n < cap ? 0 : -1; +} + +int res_load_pinned(const char *root, const char *key, ResMatFile *f) +{ + const ResPin *p = res_pin(key); + char path[1024]; + uint8_t want[32]; + if (!p || unhex(p->sha256, want) || join(root, p->path, path, sizeof path)) { + fprintf(stderr, "res_qualify: no pin for %s\n", key); + return -1; + } + ResMatStatus s = res_mat_load(path, want, f); + if (s != RES_MAT_OK) { + fprintf(stderr, "res_qualify: %s (%s): %s\n", key, path, res_mat_strerror(s)); + return -1; + } + return 0; +} + +int res_check_pinned(const char *root, const ResPin *p, char got_hex[65]) +{ + char path[1024]; + got_hex[0] = 0; + if (join(root, p->path, path, sizeof path)) return -1; + FILE *fp = fopen(path, "rb"); + if (!fp) return -1; + sha256_ctx c; + sha256_init(&c); + uint8_t buf[65536]; + size_t r; + while ((r = fread(buf, 1, sizeof buf, fp)) > 0) sha256_update(&c, buf, r); + int bad = ferror(fp); + fclose(fp); + if (bad) return -1; + uint8_t d[32]; + sha256_final(&c, d); + res_hex(d, 32, got_hex); + return strcmp(got_hex, p->sha256) == 0 ? 0 : 1; +} + +void res_hex(const uint8_t *d, size_t n, char *out) +{ + static const char H[] = "0123456789abcdef"; + for (size_t i = 0; i < n; i++) { + out[2 * i] = H[d[i] >> 4]; + out[2 * i + 1] = H[d[i] & 15]; + } + out[2 * n] = 0; +} + +void res_json_str(FILE *o, const char *s) +{ + fputc('"', o); + for (; *s; s++) { + unsigned char c = (unsigned char)*s; + if (c == '"' || c == '\\') fprintf(o, "\\%c", c); + else if (c < 0x20) fprintf(o, "\\u%04x", c); + else fputc(c, o); + } + fputc('"', o); +} + +void res_mstats_json(FILE *o, const OmegaResMembraneStats *m) +{ + fprintf(o, + ", \"membranes\": {\"states_observed\": %llu, \"states_implausible\": %llu, \"membranes_implausible\": %u, " + "\"max_membrane_abs_v\": %.9g, \"max_node_abs_v\": %.9g}", + (unsigned long long)m->states_observed, (unsigned long long)m->states_implausible, m->membranes_implausible, + (double)m->max_membrane_abs_v, (double)m->max_node_abs_v); +} + +double res_now_s(void) +{ + struct timespec t; + clock_gettime(CLOCK_MONOTONIC, &t); + return (double)t.tv_sec + 1e-9 * (double)t.tv_nsec; +} + +const char *res_status_name(OmegaResStatus s) +{ + switch (s) { + case OMEGA_RES_OK: return "OK"; + case OMEGA_RES_ERR_NULL: return "ERR_NULL"; + case OMEGA_RES_ERR_TOPOLOGY: return "ERR_TOPOLOGY"; + case OMEGA_RES_ERR_PARAM: return "ERR_PARAM"; + case OMEGA_RES_ERR_NONFINITE: return "ERR_NONFINITE"; + case OMEGA_RES_ERR_RANGE: return "ERR_RANGE"; + case OMEGA_RES_ERR_STIFF: return "ERR_STIFF"; + case OMEGA_RES_ERR_INPUT: return "ERR_INPUT"; + case OMEGA_RES_ERR_MISMATCH: return "ERR_MISMATCH"; + case OMEGA_RES_ERR_FPENV: return "ERR_FPENV"; + case OMEGA_RES_ERR_SINGULAR: return "ERR_SINGULAR"; + case OMEGA_RES_ERR_ALIAS: return "ERR_ALIAS"; + } + return "ERR_UNKNOWN"; +} + +uint64_t res_rng_next(ResRng *r) +{ + uint64_t z = (r->s += 0x9E3779B97F4A7C15ull); + z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9ull; + z = (z ^ (z >> 27)) * 0x94D049BB133111EBull; + return z ^ (z >> 31); +} + +double res_rng_unit(ResRng *r) { return (double)(res_rng_next(r) >> 11) * (1.0 / 9007199254740992.0); } + +/* ----------------------------------------------------------- simulation */ + +OmegaResStatus res_sim_at_steps(ResSim *sim, const OmegaResInput *in, const uint64_t *steps, size_t n, + double *v_out) +{ + const uint32_t L = sim->cfg.topo.node_count; + for (size_t k = 0; k < n; k++) { + if (steps[k] < sim->s.step) return OMEGA_RES_ERR_INPUT; + if (steps[k] > sim->s.step) { + OmegaResStatus st = omega_res_advance_observed(&sim->cfg, in, &sim->ws, &sim->s, steps[k] - sim->s.step, &sim->mstats); + if (st != OMEGA_RES_OK) return st; + } + for (uint32_t i = 0; i < L; i++) v_out[k * L + i] = (double)sim->s.v[i]; + } + return OMEGA_RES_OK; +} + +OmegaResStatus res_sim_at_positions(ResSim *sim, const OmegaResInput *in, const double *pos, size_t n, + uint64_t last_step, double *v_out) +{ + const uint32_t L = sim->cfg.topo.node_count; + uint64_t cached = UINT64_MAX; /* step whose successor is in sim->next */ + for (size_t k = 0; k < n; k++) { + double p = pos[k]; + if (!(p >= 0.0) || p > (double)last_step) return OMEGA_RES_ERR_INPUT; + uint64_t n0 = (uint64_t)p; + double f = p - (double)n0; + if (n0 < sim->s.step) return OMEGA_RES_ERR_INPUT; + if (n0 > sim->s.step) { + OmegaResStatus st = omega_res_advance_observed(&sim->cfg, in, &sim->ws, &sim->s, n0 - sim->s.step, &sim->mstats); + if (st != OMEGA_RES_OK) return st; + } + if (f > 0.0) { + if (cached != n0) { + OmegaResStatus st = omega_res_step(&sim->cfg, in, &sim->ws, &sim->s, &sim->next); + if (st != OMEGA_RES_OK) return st; + cached = n0; + } + for (uint32_t i = 0; i < L; i++) + v_out[k * L + i] = (1.0 - f) * (double)sim->s.v[i] + f * (double)sim->next.v[i]; + } else { + for (uint32_t i = 0; i < L; i++) v_out[k * L + i] = (double)sim->s.v[i]; + } + } + return OMEGA_RES_OK; +} + +/* ----------------------------------------------------------- statistics */ + +double res_sqrt(double x) { return __builtin_sqrt(x); } + +double res_mean(const double *x, size_t n, size_t stride) +{ + double s = 0.0; + for (size_t i = 0; i < n; i++) s += x[i * stride]; + return s / (double)n; +} + +double res_std_pop(const double *x, size_t n, size_t stride) +{ + double m = res_mean(x, n, stride), s = 0.0; + for (size_t i = 0; i < n; i++) { + double d = x[i * stride] - m; + s += d * d; + } + return res_sqrt(s / (double)n); +} + +double res_rms_diff(const double *a, const double *b, size_t n, size_t stride) +{ + double s = 0.0; + for (size_t i = 0; i < n; i++) { + double d = a[i * stride] - b[i * stride]; + s += d * d; + } + return res_sqrt(s / (double)n); +} + +double res_max_abs_diff(const double *a, const double *b, size_t n, size_t stride) +{ + double m = 0.0; + for (size_t i = 0; i < n; i++) { + double d = a[i * stride] - b[i * stride]; + if (d < 0) d = -d; + if (!(d <= m)) m = d; /* NaN propagates as the maximum */ + } + return m; +} + +double res_nrmse(const double *ref, const double *pred, size_t n, size_t stride) +{ + double m = res_mean(ref, n, stride), num = 0.0, den = 0.0; + for (size_t i = 0; i < n; i++) { + double e = ref[i * stride] - pred[i * stride], c = ref[i * stride] - m; + num += e * e; + den += c * c; + } + return res_sqrt(num / den); +} + +void res_narma(const double *u, uint32_t n, uint32_t order, double *y) +{ + const uint32_t P = 20; /* narmaMaxOrder */ + double *Y = calloc((size_t)n + P, sizeof(double)); + double *uP = calloc((size_t)n + P, sizeof(double)); + if (!Y || !uP) { + free(Y); + free(uP); + for (uint32_t i = 0; i < n; i++) y[i] = 0.0 / 0.0; + return; + } + for (uint32_t i = 0; i < n; i++) uP[P + i] = u[i]; + for (uint32_t t = P - 1; t + 1 < n + P; t++) { + double s = 0.0; + for (uint32_t j = t + 1 - order; j <= t; j++) s = s + Y[j]; + Y[t + 1] = ((0.3 * Y[t] + (0.05 * Y[t]) * s) + (1.5 * uP[t + 1 - order]) * uP[t]) + 0.1; + } + for (uint32_t i = 0; i < n; i++) y[i] = Y[P + i]; + free(Y); + free(uP); +} + +/* ------------------------------------------- benchmark ridge readout + CV */ + +/* Heap workspaces (no statics): res_ridge_cv may run in several threads. */ +static OmegaResStatus fit_apply(OmegaResReadoutWorkspace *ws, OmegaResReadout *r, const double *x, const double *y, + uint32_t n, uint32_t nf, uint32_t no, double lambda, const double *xa, uint32_t na, + double *pa) +{ + OmegaResStatus st = omega_res_readout_fit(x, y, n, nf, no, lambda, ws, r); + if (st != OMEGA_RES_OK) return st; + for (uint32_t i = 0; i < na; i++) { + st = omega_res_readout_apply(r, xa + (size_t)i * nf, pa + (size_t)i * no); + if (st != OMEGA_RES_OK) return st; + } + return OMEGA_RES_OK; +} + +ResCvResult res_ridge_cv(const double *xtr, const double *ytr, uint32_t ntr, uint32_t nf, uint32_t no, + const double *xte, uint32_t nte, const double *grid, uint32_t ngrid, uint32_t folds, + double *pred_tr, double *pred_te) +{ + ResCvResult res = {0.0, 0.0, OMEGA_RES_ERR_PARAM}; + if (ntr < 2u * folds || nf < 1u || no < 1u || ngrid < 1u || folds < 2u) return res; + double *mu = calloc(nf, sizeof(double)), *sd = calloc(nf, sizeof(double)); + double *ztr = malloc((size_t)ntr * nf * sizeof(double)); + double *zte = nte ? malloc((size_t)nte * nf * sizeof(double)) : NULL; + double *zfit = malloc((size_t)ntr * nf * sizeof(double)), *yfit = malloc((size_t)ntr * no * sizeof(double)); + double *pv = malloc((size_t)ntr * no * sizeof(double)); + OmegaResReadoutWorkspace *ws = malloc(sizeof *ws); + OmegaResReadout *rd = malloc(sizeof *rd); + res.status = OMEGA_RES_ERR_NULL; + if (!mu || !sd || !ztr || (nte && !zte) || !zfit || !yfit || !pv || !ws || !rd) goto out; + for (uint32_t f = 0; f < nf; f++) { + mu[f] = res_mean(xtr + f, ntr, nf); + sd[f] = res_std_pop(xtr + f, ntr, nf); + if (!(sd[f] > 0.0)) sd[f] = 1.0; + } + for (size_t i = 0; i < (size_t)ntr * nf; i++) ztr[i] = (xtr[i] - mu[i % nf]) / sd[i % nf]; + for (size_t i = 0; i < (size_t)nte * nf; i++) zte[i] = (xte[i] - mu[i % nf]) / sd[i % nf]; + double best = 1.0 / 0.0; + int best_g = -1; + for (uint32_t g = 0; g < ngrid; g++) { + double score = 0.0; + int ok = 1; + for (uint32_t k = 0; k < folds && ok; k++) { + uint32_t v0 = (uint32_t)(((uint64_t)2 * k * ntr + folds) / (2u * folds)); + uint32_t v1 = (uint32_t)(((uint64_t)2 * (k + 1) * ntr + folds) / (2u * folds)); + uint32_t m = 0; + for (uint32_t i = 0; i < ntr; i++) { + if (i >= v0 && i < v1) continue; + memcpy(zfit + (size_t)m * nf, ztr + (size_t)i * nf, nf * sizeof(double)); + memcpy(yfit + (size_t)m * no, ytr + (size_t)i * no, no * sizeof(double)); + m++; + } + if (fit_apply(ws, rd, zfit, yfit, m, nf, no, grid[g], ztr + (size_t)v0 * nf, v1 - v0, pv) != OMEGA_RES_OK) { + ok = 0; + break; + } + double s = 0.0; + for (uint32_t o = 0; o < no; o++) s += res_nrmse(ytr + (size_t)v0 * no + o, pv + o, v1 - v0, no); + score += s / no; + } + if (!ok) continue; + score /= folds; + if (score < best) { + best = score; + best_g = (int)g; + } + } + if (best_g < 0) { + res.status = OMEGA_RES_ERR_SINGULAR; + goto out; + } + res.lambda = grid[best_g]; + res.cv_score = best; + { + /* final fit on all training rows */ + res.status = omega_res_readout_fit(ztr, ytr, ntr, nf, no, res.lambda, ws, rd); + for (uint32_t i = 0; res.status == OMEGA_RES_OK && i < ntr; i++) + res.status = omega_res_readout_apply(rd, ztr + (size_t)i * nf, pred_tr + (size_t)i * no); + for (uint32_t i = 0; res.status == OMEGA_RES_OK && pred_te && i < nte; i++) + res.status = omega_res_readout_apply(rd, zte + (size_t)i * nf, pred_te + (size_t)i * no); + } +out: + free(mu); + free(sd); + free(ztr); + free(zte); + free(zfit); + free(yfit); + free(pv); + free(ws); + free(rd); + return res; +} + +int res_ols_qr(const double *x, const double *y, uint32_t n, uint32_t nf, double *w) +{ + const uint32_t p = nf + 1u; + if (n < p) return -1; + double *A = malloc((size_t)n * p * sizeof(double)), *b = malloc((size_t)n * sizeof(double)); + if (!A || !b) { + free(A); + free(b); + return -1; + } + for (uint32_t i = 0; i < n; i++) { /* column-major copy of [1, x] */ + A[i] = 1.0; + for (uint32_t f = 0; f < nf; f++) A[(size_t)(f + 1) * n + i] = x[(size_t)i * nf + f]; + b[i] = y[i]; + } + /* column equilibration: unit 2-norm columns, so the rank test below is + * relative to each column's own scale; undone on the weights */ + double *sc = malloc((size_t)p * sizeof(double)); + if (!sc) { + free(A); + free(b); + return -1; + } + for (uint32_t j = 0; j < p; j++) { + double s = 0.0, *a = A + (size_t)j * n; + for (uint32_t i = 0; i < n; i++) s += a[i] * a[i]; + sc[j] = res_sqrt(s); + if (sc[j] > 0.0) + for (uint32_t i = 0; i < n; i++) a[i] /= sc[j]; + } + double rmax = 0.0; + int rc = 0; + for (uint32_t j = 0; j < p && !rc; j++) { + double *a = A + (size_t)j * n, s = 0.0; + for (uint32_t i = j; i < n; i++) s += a[i] * a[i]; + double nrm = res_sqrt(s); + if (!(nrm > 0.0)) { + rc = -1; + break; + } + double alpha = a[j] > 0.0 ? -nrm : nrm; + a[j] -= alpha; /* v = a[j..n) */ + double vv = 0.0; + for (uint32_t i = j; i < n; i++) vv += a[i] * a[i]; + for (uint32_t c = j + 1; c <= p; c++) { + double *col = c < p ? A + (size_t)c * n : b, d = 0.0; + for (uint32_t i = j; i < n; i++) d += a[i] * col[i]; + double t = 2.0 * d / vv; + for (uint32_t i = j; i < n; i++) col[i] -= t * a[i]; + } + a[j] = alpha; /* R_jj */ + double ar = alpha < 0 ? -alpha : alpha; + if (ar > rmax) rmax = ar; + } + if (!rc) { + for (uint32_t jj = p; jj-- > 0;) { + double s = b[jj], rjj = A[(size_t)jj * n + jj]; + if (!((rjj < 0 ? -rjj : rjj) > 1e-14 * rmax)) { + rc = -1; + break; + } + for (uint32_t c = jj + 1; c < p; c++) s -= A[(size_t)c * n + jj] * w[c]; + w[jj] = s / rjj; + } + } + if (!rc) + for (uint32_t j = 0; j < p; j++) w[j] /= sc[j]; + free(sc); + free(A); + free(b); + return rc; +} + +/* ------------------------------------------------------------- networks */ + +#include "res_fixtures.h" + +static uint32_t nb_edges(const uint8_t (*nb)[7], uint32_t n, OmegaResEdge *e) +{ + uint32_t m = 0; + for (uint32_t i = 0; i < n; i++) + for (uint32_t k = 1; k <= nb[i][0]; k++) { + uint32_t a = i, b = (uint32_t)nb[i][k] - 1u, lo = a < b ? a : b, hi = a < b ? b : a, dup = 0; + for (uint32_t q = 0; q < m && !dup; q++) dup = e[q].a == lo && e[q].b == hi; + if (!dup && lo != hi) { + e[m].a = (uint16_t)lo; + e[m].b = (uint16_t)hi; + m++; + } + } + return m; +} + +OmegaResStatus res_net_topology(ResNet net, OmegaResTopology *t, uint32_t inputs0[3], uint32_t *ground0) +{ + OmegaResEdge e[OMEGA_RES_MAX_EDGES]; + uint32_t m, n, g; + const uint8_t *in = NULL; + switch (net) { + case RES_NET_HEX13: n = 13; m = nb_edges(RES_FIX_HEX13_NB, n, e); g = RES_FIX_HEX13_GROUND; in = RES_FIX_HEX13_INPUTS; break; + case RES_NET_HEX25: n = 25; m = nb_edges(RES_FIX_HEX25_NB, n, e); g = RES_FIX_HEX25_GROUND; in = RES_FIX_HEX25_INPUTS; break; + case RES_NET_HEX43: n = 43; m = nb_edges(RES_FIX_HEX43_NB, n, e); g = RES_FIX_HEX43_GROUND; in = RES_FIX_HEX43_INPUTS; break; + case RES_NET_CHAIN50: + n = 50; + m = 49; + for (uint32_t k = 0; k < m; k++) { + e[k].a = (uint16_t)(RES_FIX_CHAIN50_EDGES[k][0] - 1u); + e[k].b = (uint16_t)(RES_FIX_CHAIN50_EDGES[k][1] - 1u); + } + g = RES_FIX_CHAIN50_GROUND; + break; + default: return OMEGA_RES_ERR_PARAM; + } + g -= 1u; + if (ground0) *ground0 = g; + if (in && inputs0) + for (int k = 0; k < 3; k++) inputs0[k] = (uint32_t)in[k] - 1u; + return omega_res_topology_build(n, e, m, &g, 1, t); +} + +OmegaResStatus res_net_disconnected(OmegaResReference which, const float *conc, uint32_t nd, OmegaResTopology *t, + OmegaResParams *p) +{ + OmegaResEdge e[OMEGA_RES_MAX_EDGES]; + uint32_t grounds[OMEGA_RES_MAX_NODES], ng = 0, node = nd; + float gconc[OMEGA_RES_MAX_NODES]; + if (nd == 0 || nd >= OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_PARAM; + for (uint32_t k = 0; k < nd; k++) { + uint32_t found = UINT32_MAX; + for (uint32_t q = 0; q < ng; q++) /* a ground of this class with < 6 members */ + if (gconc[q] == conc[k] && t->degree[grounds[q]] < OMEGA_RES_MAX_DEGREE) found = q; + if (found == UINT32_MAX) { + if (node >= OMEGA_RES_MAX_NODES) return OMEGA_RES_ERR_TOPOLOGY; + found = ng; + grounds[ng] = node++; + gconc[ng] = conc[k]; + t->degree[grounds[ng]] = 0; + ng++; + } + e[k].a = (uint16_t)k; + e[k].b = (uint16_t)grounds[found]; + t->degree[grounds[found]]++; /* scratch count, rebuilt below */ + } + OmegaResStatus st = omega_res_topology_build(node, e, nd, grounds, ng, t); + if (st != OMEGA_RES_OK) return st; + st = omega_res_params_reference(which, node, p); + if (st != OMEGA_RES_OK) return st; + for (uint32_t k = 0; k < nd; k++) p->conc_um[k] = conc[k]; + for (uint32_t q = 0; q < ng; q++) p->conc_um[grounds[q]] = gconc[q]; + return OMEGA_RES_OK; +} diff --git a/tools/reservoir/res_common.h b/tools/reservoir/res_common.h new file mode 100644 index 000000000..8beca0d0d --- /dev/null +++ b/tools/reservoir/res_common.h @@ -0,0 +1,124 @@ +/* Shared parts of the omega#440 Gate 2 tool (tools/reservoir/res_qualify): + * pinned archive files, simulation drivers, statistics, the benchmark ridge + * readout with blocked cross-validation, a deterministic generator and JSON + * helpers. Tools may allocate and do I/O; the simulator under src/reservoir + * does neither. Binary64 here unless stated; the simulator is binary32. */ +#ifndef RES_COMMON_H +#define RES_COMMON_H + +#include "omega_reservoir.h" +#include "omega_reservoir_readout.h" +#include "res_mat.h" + +#include +#include + +/* ---------------------------------------------------------- archive pins */ + +/* Files of Zenodo 10.5281/zenodo.17296788 (repo.zip sha256 54582293...a15), + * paths relative to the unpacked project-zenodo-ready_with-paper/. */ +typedef struct { + const char *key; + const char *path; + const char *sha256; +} ResPin; + +extern const ResPin RES_PINS[]; +extern const unsigned RES_PIN_COUNT; +const ResPin *res_pin(const char *key); +/* Loads a pinned .mat, refusing a sha256 mismatch. 0 on success; prints the + * reason to stderr otherwise. */ +int res_load_pinned(const char *root, const char *key, ResMatFile *f); +/* sha256 of a pinned file (any type, never parsed or executed). 0 = match. */ +int res_check_pinned(const char *root, const ResPin *p, char got_hex[65]); + +/* -------------------------------------------------------------- helpers */ + +void res_hex(const uint8_t *d, size_t n, char *out); /* 2n chars + NUL */ +void res_json_str(FILE *o, const char *s); +/* Writes ", \"membranes\": {...}": the physical-plausibility record of a run. */ +void res_mstats_json(FILE *o, const OmegaResMembraneStats *m); +double res_now_s(void); /* CLOCK_MONOTONIC */ +const char *res_status_name(OmegaResStatus s); + +/* splitmix64 (Steele, Lea, Flood 2014): the benchmark's only randomness. */ +typedef struct { + uint64_t s; +} ResRng; +uint64_t res_rng_next(ResRng *r); +double res_rng_unit(ResRng *r); /* [0, 1), 53 bits */ + +/* ----------------------------------------------------------- simulation */ + +typedef struct { + OmegaResConfig cfg; + OmegaResState s, next; + OmegaResWorkspace ws; + OmegaResMembraneStats mstats; /* accepted states since the last omega_res_membrane_stats_init */ +} ResSim; + +/* Runs from the state in sim->s (already initialised) and records the node + * voltages (binary32 widened to binary64) at the integer steps steps[0..n), + * which must be non-decreasing: v_out[k * node_count + i]. */ +OmegaResStatus res_sim_at_steps(ResSim *sim, const OmegaResInput *in, const uint64_t *steps, size_t n, + double *v_out); +/* Same at fractional step positions pos[k] (non-decreasing, >= 0): linear + * interpolation between the states at floor(pos) and floor(pos) + 1. */ +OmegaResStatus res_sim_at_positions(ResSim *sim, const OmegaResInput *in, const double *pos, size_t n, + uint64_t last_step, double *v_out); + +/* ------------------------------------------------------------- networks */ + +typedef enum { RES_NET_HEX13 = 13, RES_NET_HEX25 = 25, RES_NET_HEX43 = 43, RES_NET_CHAIN50 = 50 } ResNet; + +/* The reference topologies of tests/reservoir/res_fixtures.h (0-based). + * inputs0: the three Lorenz injection nodes (lattices only, else unset). */ +OmegaResStatus res_net_topology(ResNet net, OmegaResTopology *t, uint32_t inputs0[3], uint32_t *ground0); + +/* Disconnected ablation of a network: driven nodes 0..nd-1 keep their + * concentration conc[k]; each gets exactly one membrane, to a grounded + * droplet of the same concentration (nodes nd.., one per class per 6 driven + * nodes). A grounded droplet is held at 0 V, so sharing it couples nothing: + * the reduced Laplacian is diagonal. Other parameters as the reference. */ +OmegaResStatus res_net_disconnected(OmegaResReference which, const float *conc, uint32_t nd, OmegaResTopology *t, + OmegaResParams *p); + +/* ----------------------------------------------------------- statistics */ + +double res_mean(const double *x, size_t n, size_t stride); +double res_std_pop(const double *x, size_t n, size_t stride); /* sqrt(mean((x - mean)^2)) */ +double res_rms_diff(const double *a, const double *b, size_t n, size_t stride); +double res_max_abs_diff(const double *a, const double *b, size_t n, size_t stride); +/* NRMSE of Text S6 / goodnessOfFit 'NRMSE' on a strided column. */ +double res_nrmse(const double *ref, const double *pred, size_t n, size_t stride); +double res_sqrt(double x); + +/* NARMA-o targets exactly as HyperParameterTuningOptimized.m:110-142 (zero + * history, y(c) depends on u(c-1), u(c-o) and y(c-1..c-o)); y has n + * entries, 0-based y[c] for the reference's 1-based c + 1. */ +void res_narma(const double *u, uint32_t n, uint32_t order, double *y); + +/* ------------------------------------------- benchmark ridge readout + CV */ + +/* Ridge with unpenalized bias on features standardized with the training + * mean and population std (a constant column is left centred at 0, which the + * penalty keeps nonsingular). lambda is chosen from grid by blocked K-fold + * cross-validation on the training rows (contiguous folds, edges + * round(k * n / K)), score = mean over folds of the mean NRMSE over outputs; + * ties keep the first. Then refit on all training rows. pred_te may be NULL. */ +typedef struct { + double lambda; + double cv_score; + OmegaResStatus status; +} ResCvResult; +ResCvResult res_ridge_cv(const double *xtr, const double *ytr, uint32_t ntr, uint32_t nf, uint32_t no, + const double *xte, uint32_t nte, const double *grid, uint32_t ngrid, uint32_t folds, + double *pred_tr, double *pred_te); + +/* Ordinary least squares with intercept by Householder QR (binary64) on + * unit-norm-equilibrated columns: the method family of MATLAB fitlm. + * Diagnostic only (NARMA comparison). w has nf + 1 entries, w[0] the + * intercept. Returns 0, or -1 if rank deficient (|R_jj| <= 1e-14 max |R_ii|). */ +int res_ols_qr(const double *x, const double *y, uint32_t n, uint32_t nf, double *w); + +#endif /* RES_COMMON_H */ diff --git a/tools/reservoir/res_inflate.c b/tools/reservoir/res_inflate.c new file mode 100644 index 000000000..c8ffeb87c --- /dev/null +++ b/tools/reservoir/res_inflate.c @@ -0,0 +1,313 @@ +/* In-house zlib / DEFLATE decoder (see res_inflate.h). RFC 1950 framing, + * RFC 1951 blocks: stored, fixed Huffman, dynamic Huffman. Bit-serial + * canonical decoding: slow but simple, and fast enough for the ~20 MB the + * Gate 2 tools decode. */ +#include "res_inflate.h" + +#include +#include + +#define MAXBITS 15 +#define MAXLCODES 286 +#define MAXDCODES 30 +#define MAXCODES (MAXLCODES + MAXDCODES) +#define FIXLCODES 288 + +typedef struct { + const uint8_t *in; + size_t in_len, in_pos; + uint32_t bitbuf; /* holds bitcnt (< 8 between calls) unread bits */ + int bitcnt; + uint8_t *out; + size_t out_len, out_cap; +} St; + +typedef struct { + short count[MAXBITS + 1]; /* number of codes of each length */ + short symbol[FIXLCODES]; /* symbols in canonical code order */ +} Huff; + +static int getbits(St *s, int need, uint32_t *val) +{ + uint32_t v = s->bitbuf; + while (s->bitcnt < need) { + if (s->in_pos >= s->in_len) return RES_INF_ERR_TRUNC; + v |= (uint32_t)s->in[s->in_pos++] << s->bitcnt; + s->bitcnt += 8; + } + *val = v & ((1u << need) - 1u); + s->bitbuf = v >> need; + s->bitcnt -= need; + return RES_INF_OK; +} + +static int put(St *s, uint8_t b) +{ + if (s->out_len == s->out_cap) { + if (s->out_cap >= RES_INFLATE_MAX_OUT) return RES_INF_ERR_NOMEM; + size_t cap = s->out_cap ? s->out_cap * 2u : (size_t)65536; + if (cap > RES_INFLATE_MAX_OUT) cap = RES_INFLATE_MAX_OUT; + uint8_t *p = realloc(s->out, cap); + if (!p) return RES_INF_ERR_NOMEM; + s->out = p; + s->out_cap = cap; + } + s->out[s->out_len++] = b; + return RES_INF_OK; +} + +static int stored(St *s) +{ + s->bitbuf = 0; /* the < 8 leftover bits are the rest of the current byte */ + s->bitcnt = 0; + if (s->in_len - s->in_pos < 4) return RES_INF_ERR_TRUNC; + const uint8_t *p = s->in + s->in_pos; + unsigned len = (unsigned)p[0] | ((unsigned)p[1] << 8); + unsigned nlen = (unsigned)p[2] | ((unsigned)p[3] << 8); + if (len != (~nlen & 0xffffu)) return RES_INF_ERR_BLOCK; + s->in_pos += 4; + if (s->in_len - s->in_pos < len) return RES_INF_ERR_TRUNC; + for (unsigned i = 0; i < len; i++) { + int e = put(s, s->in[s->in_pos + i]); + if (e) return e; + } + s->in_pos += len; + return RES_INF_OK; +} + +/* Returns 0 for a complete code, > 0 for an incomplete one, < 0 if + * over-subscribed. */ +static int construct(Huff *h, const short *length, int n) +{ + short offs[MAXBITS + 1]; + for (int len = 0; len <= MAXBITS; len++) h->count[len] = 0; + for (int sym = 0; sym < n; sym++) h->count[length[sym]]++; + if (h->count[0] == n) return 0; + int left = 1; + for (int len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= h->count[len]; + if (left < 0) return left; + } + offs[1] = 0; + for (int len = 1; len < MAXBITS; len++) offs[len + 1] = (short)(offs[len] + h->count[len]); + for (int sym = 0; sym < n; sym++) + if (length[sym] != 0) h->symbol[offs[length[sym]]++] = (short)sym; + return left; +} + +static int decode(St *s, const Huff *h, int *sym) +{ + int code = 0, first = 0, index = 0; + for (int len = 1; len <= MAXBITS; len++) { + uint32_t b; + int e = getbits(s, 1, &b); + if (e) return e; + code |= (int)b; + int count = h->count[len]; + if (code - count < first) { + *sym = h->symbol[index + (code - first)]; + return RES_INF_OK; + } + index += count; + first += count; + first <<= 1; + code <<= 1; + } + return RES_INF_ERR_CODES; +} + +static const short LBASE[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, + 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; +static const short LEXT[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; +static const short DBASE[30] = {1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, + 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; +static const short DEXT[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; + +static int codes(St *s, const Huff *lc, const Huff *dc) +{ + for (;;) { + int sym, e = decode(s, lc, &sym); + if (e) return e; + if (sym < 256) { + e = put(s, (uint8_t)sym); + if (e) return e; + continue; + } + if (sym == 256) return RES_INF_OK; + sym -= 257; + if (sym >= 29) return RES_INF_ERR_SYMBOL; + uint32_t x; + e = getbits(s, LEXT[sym], &x); + if (e) return e; + size_t len = (size_t)LBASE[sym] + x; + int dsym; + e = decode(s, dc, &dsym); + if (e) return e; + if (dsym < 0 || dsym >= 30) return RES_INF_ERR_SYMBOL; + e = getbits(s, DEXT[dsym], &x); + if (e) return e; + size_t dist = (size_t)DBASE[dsym] + x; + if (dist > s->out_len) return RES_INF_ERR_SYMBOL; + for (size_t i = 0; i < len; i++) { + e = put(s, s->out[s->out_len - dist]); + if (e) return e; + } + } +} + +static int fixed(St *s) +{ + static Huff lc, dc; + static int built; + if (!built) { + short lengths[FIXLCODES]; + int sym = 0; + for (; sym < 144; sym++) lengths[sym] = 8; + for (; sym < 256; sym++) lengths[sym] = 9; + for (; sym < 280; sym++) lengths[sym] = 7; + for (; sym < FIXLCODES; sym++) lengths[sym] = 8; + construct(&lc, lengths, FIXLCODES); + for (sym = 0; sym < MAXDCODES; sym++) lengths[sym] = 5; + construct(&dc, lengths, MAXDCODES); + built = 1; + } + return codes(s, &lc, &dc); +} + +static int dynamic(St *s) +{ + static const short ORDER[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + short lengths[MAXCODES]; + Huff lc, dc; + uint32_t v; + int e; + if ((e = getbits(s, 5, &v))) return e; + int nlen = (int)v + 257; + if ((e = getbits(s, 5, &v))) return e; + int ndist = (int)v + 1; + if ((e = getbits(s, 4, &v))) return e; + int ncode = (int)v + 4; + if (nlen > MAXLCODES || ndist > MAXDCODES) return RES_INF_ERR_CODES; + int index; + for (index = 0; index < ncode; index++) { + if ((e = getbits(s, 3, &v))) return e; + lengths[ORDER[index]] = (short)v; + } + for (; index < 19; index++) lengths[ORDER[index]] = 0; + if (construct(&lc, lengths, 19) != 0) return RES_INF_ERR_CODES; + index = 0; + while (index < nlen + ndist) { + int sym; + if ((e = decode(s, &lc, &sym))) return e; + if (sym < 16) { + lengths[index++] = (short)sym; + continue; + } + short len = 0; + int rep; + if (sym == 16) { + if (index == 0) return RES_INF_ERR_CODES; + len = lengths[index - 1]; + if ((e = getbits(s, 2, &v))) return e; + rep = 3 + (int)v; + } else if (sym == 17) { + if ((e = getbits(s, 3, &v))) return e; + rep = 3 + (int)v; + } else { + if ((e = getbits(s, 7, &v))) return e; + rep = 11 + (int)v; + } + if (index + rep > nlen + ndist) return RES_INF_ERR_CODES; + while (rep--) lengths[index++] = len; + } + if (lengths[256] == 0) return RES_INF_ERR_CODES; + e = construct(&lc, lengths, nlen); + if (e && (e < 0 || nlen != lc.count[0] + lc.count[1])) return RES_INF_ERR_CODES; + e = construct(&dc, lengths + nlen, ndist); + if (e && (e < 0 || ndist != dc.count[0] + dc.count[1])) return RES_INF_ERR_CODES; + return codes(s, &lc, &dc); +} + +uint32_t res_adler32(const uint8_t *p, size_t n) +{ + uint32_t a = 1, b = 0; + while (n > 0) { + size_t k = n < 5552u ? n : 5552u; + n -= k; + while (k--) { + a += *p++; + b += a; + } + a %= 65521u; + b %= 65521u; + } + return (b << 16) | a; +} + +ResInflateStatus res_zlib_inflate(const uint8_t *in, size_t in_len, uint8_t **out, size_t *out_len, + size_t *consumed) +{ + if (!in || !out || !out_len || !consumed) return RES_INF_ERR_ARG; + *out = NULL; + *out_len = 0; + *consumed = 0; + if (in_len < 2) return RES_INF_ERR_TRUNC; + unsigned cmf = in[0], flg = in[1]; + if ((cmf & 0x0fu) != 8u || (cmf >> 4) > 7u || ((cmf << 8) | flg) % 31u != 0u) return RES_INF_ERR_HEADER; + if (flg & 0x20u) return RES_INF_ERR_HEADER; + St s; + memset(&s, 0, sizeof s); + s.in = in; + s.in_len = in_len; + s.in_pos = 2; + int e = RES_INF_OK; + uint32_t last = 0, type; + while (!last) { + if ((e = getbits(&s, 1, &last))) break; + if ((e = getbits(&s, 2, &type))) break; + if (type == 0) e = stored(&s); + else if (type == 1) e = fixed(&s); + else if (type == 2) e = dynamic(&s); + else e = RES_INF_ERR_BLOCK; + if (e) break; + } + if (!e) { + s.bitbuf = 0; + s.bitcnt = 0; + if (s.in_len - s.in_pos < 4) e = RES_INF_ERR_TRUNC; + } + if (!e) { + const uint8_t *t = in + s.in_pos; + uint32_t want = ((uint32_t)t[0] << 24) | ((uint32_t)t[1] << 16) | ((uint32_t)t[2] << 8) | (uint32_t)t[3]; + if (res_adler32(s.out, s.out_len) != want) e = RES_INF_ERR_ADLER; + } + if (!e && !s.out) { + s.out = malloc(1); + if (!s.out) e = RES_INF_ERR_NOMEM; + } + if (e) { + free(s.out); + return (ResInflateStatus)e; + } + *out = s.out; + *out_len = s.out_len; + *consumed = s.in_pos + 4; + return RES_INF_OK; +} + +const char *res_inflate_strerror(ResInflateStatus s) +{ + switch (s) { + case RES_INF_OK: return "ok"; + case RES_INF_ERR_HEADER: return "bad zlib header"; + case RES_INF_ERR_TRUNC: return "truncated stream"; + case RES_INF_ERR_BLOCK: return "bad block"; + case RES_INF_ERR_CODES: return "bad Huffman code"; + case RES_INF_ERR_SYMBOL: return "bad symbol or distance"; + case RES_INF_ERR_ADLER: return "Adler-32 mismatch"; + case RES_INF_ERR_NOMEM: return "out of memory or output above cap"; + case RES_INF_ERR_ARG: return "bad argument"; + } + return "unknown"; +} diff --git a/tools/reservoir/res_inflate.h b/tools/reservoir/res_inflate.h new file mode 100644 index 000000000..4df59fcb2 --- /dev/null +++ b/tools/reservoir/res_inflate.h @@ -0,0 +1,41 @@ +/* In-house zlib (RFC 1950) / DEFLATE (RFC 1951) decoder for the omega#440 + * Gate 2 tools: it reads the miCOMPRESSED elements of the authors' MAT v5 + * files. Written here instead of linking system zlib so the qualification + * tools have no dependency outside this repository; the Adler-32 trailer of + * every stream is checked, so a decoding error cannot pass silently. + * + * Input is untrusted: every length, distance and code table is checked, + * output is capped (RES_INFLATE_MAX_OUT) and a preset dictionary is refused. + * Decoder structure follows the canonical-Huffman scheme of RFC 1951 + * section 3.2 (code counts per length, symbols in code order). */ +#ifndef RES_INFLATE_H +#define RES_INFLATE_H + +#include +#include + +#define RES_INFLATE_MAX_OUT ((size_t)1 << 30) /* 1 GiB: refuse anything larger */ + +typedef enum { + RES_INF_OK = 0, + RES_INF_ERR_HEADER = -1, /* not a zlib stream, preset dictionary, bad check bits */ + RES_INF_ERR_TRUNC = -2, /* input ended inside the stream */ + RES_INF_ERR_BLOCK = -3, /* reserved block type, stored length mismatch */ + RES_INF_ERR_CODES = -4, /* bad or over-subscribed Huffman code */ + RES_INF_ERR_SYMBOL = -5, /* invalid length/distance symbol or distance too far */ + RES_INF_ERR_ADLER = -6, /* Adler-32 of the output differs from the trailer */ + RES_INF_ERR_NOMEM = -7, /* allocation failed or output above the cap */ + RES_INF_ERR_ARG = -8 +} ResInflateStatus; + +/* Decodes one zlib stream from in[0..in_len). On success *out is a malloc'd + * buffer of *out_len bytes (caller frees) and *consumed the number of input + * bytes the stream occupied, trailer included. On failure *out is NULL. */ +ResInflateStatus res_zlib_inflate(const uint8_t *in, size_t in_len, uint8_t **out, size_t *out_len, + size_t *consumed); + +uint32_t res_adler32(const uint8_t *p, size_t n); + +const char *res_inflate_strerror(ResInflateStatus s); + +#endif /* RES_INFLATE_H */ diff --git a/tools/reservoir/res_mat.c b/tools/reservoir/res_mat.c new file mode 100644 index 000000000..bfbeec0a3 --- /dev/null +++ b/tools/reservoir/res_mat.c @@ -0,0 +1,363 @@ +/* MAT v5 reader (see res_mat.h). Format reference: MathWorks, "MAT-File + * Format" (version 5 MAT-file: 128-byte header, then data elements with an + * 8-byte tag or a 4-byte small-element tag, 8-byte aligned inside miMATRIX; + * miCOMPRESSED holds one zlib stream that decodes to one element). */ +#include "res_mat.h" + +#include "res_inflate.h" +#include "sha256.h" + +#include +#include +#include + +enum { MI_INT8 = 1, MI_UINT8 = 2, MI_INT16 = 3, MI_UINT16 = 4, MI_INT32 = 5, MI_UINT32 = 6, MI_SINGLE = 7, + MI_DOUBLE = 9, MI_INT64 = 12, MI_UINT64 = 13, MI_MATRIX = 14, MI_COMPRESSED = 15 }; + +#define MAX_NUMEL ((size_t)1 << 31) + +int res_mat_verbose = 1; + +static uint32_t rd32(const uint8_t *p) +{ + return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static uint64_t rd64(const uint8_t *p) { return (uint64_t)rd32(p) | ((uint64_t)rd32(p + 4) << 32); } + +typedef struct { + uint32_t type, nbytes; + size_t data, next; +} Tag; + +/* Tag at p[pos] within n bytes. align: the element is padded to 8 bytes + * (every element inside miMATRIX and a top-level miMATRIX). */ +static ResMatStatus read_tag(const uint8_t *p, size_t n, size_t pos, int align, Tag *t) +{ + if (pos > n || n - pos < 8) return RES_MAT_ERR_FORMAT; + uint32_t w0 = rd32(p + pos); + if (w0 >> 16) { + t->type = w0 & 0xffffu; + t->nbytes = w0 >> 16; + if (t->nbytes > 4) return RES_MAT_ERR_FORMAT; + t->data = pos + 4; + t->next = pos + 8; + return RES_MAT_OK; + } + t->type = w0; + t->nbytes = rd32(p + pos + 4); + t->data = pos + 8; + if (n - t->data < t->nbytes) return RES_MAT_ERR_FORMAT; + size_t end = t->data + t->nbytes; + if (align) { + end = (end + 7u) & ~(size_t)7u; + if (end > n) end = n; /* padding of the last element may be absent */ + } + t->next = end; + return RES_MAT_OK; +} + +static size_t type_size(uint32_t type) +{ + switch (type) { + case MI_INT8: case MI_UINT8: return 1; + case MI_INT16: case MI_UINT16: return 2; + case MI_INT32: case MI_UINT32: case MI_SINGLE: return 4; + case MI_DOUBLE: case MI_INT64: case MI_UINT64: return 8; + default: return 0; + } +} + +static ResMatStatus convert(uint32_t type, const uint8_t *d, size_t nbytes, size_t numel, double *out) +{ + size_t sz = type_size(type); + if (sz == 0 || nbytes != numel * sz) return RES_MAT_ERR_FORMAT; + for (size_t i = 0; i < numel; i++, d += sz) { + switch (type) { + case MI_INT8: out[i] = (double)(int8_t)d[0]; break; + case MI_UINT8: out[i] = (double)d[0]; break; + case MI_INT16: out[i] = (double)(int16_t)(uint16_t)(d[0] | (d[1] << 8)); break; + case MI_UINT16: out[i] = (double)(uint16_t)(d[0] | (d[1] << 8)); break; + case MI_INT32: out[i] = (double)(int32_t)rd32(d); break; + case MI_UINT32: out[i] = (double)rd32(d); break; + case MI_SINGLE: { + uint32_t b = rd32(d); + float f; + memcpy(&f, &b, 4); + out[i] = (double)f; + break; + } + case MI_DOUBLE: { + uint64_t b = rd64(d); + memcpy(&out[i], &b, 8); + break; + } + case MI_INT64: { + int64_t v = (int64_t)rd64(d); + if (v > ((int64_t)1 << 53) || v < -((int64_t)1 << 53)) return RES_MAT_UNSUPPORTED; + out[i] = (double)v; + break; + } + case MI_UINT64: { + uint64_t v = rd64(d); + if (v > ((uint64_t)1 << 53)) return RES_MAT_UNSUPPORTED; + out[i] = (double)v; + break; + } + } + } + return RES_MAT_OK; +} + +static void free_array(ResMatArray *a) +{ + if (a->cell) { + for (size_t i = 0; i < a->numel; i++) free_array(&a->cell[i]); + free(a->cell); + } + free(a->re); + a->cell = NULL; + a->re = NULL; +} + +/* Content (after the miMATRIX tag) of nbytes = n. */ +static ResMatStatus parse_matrix(const uint8_t *p, size_t n, ResMatArray *a, int depth) +{ + memset(a, 0, sizeof *a); + if (n == 0) { /* an empty element: [] */ + a->cls = RES_MX_DOUBLE; + a->ndims = 2; + a->has_data = 1; + return RES_MAT_OK; + } + if (depth > RES_MAT_MAX_DEPTH) return RES_MAT_UNSUPPORTED; + Tag t; + ResMatStatus e = read_tag(p, n, 0, 1, &t); + if (e) return e; + if (t.type != MI_UINT32 || t.nbytes != 8) return RES_MAT_ERR_FORMAT; + uint32_t flags = rd32(p + t.data); + a->cls = (int)(flags & 0xffu); + a->is_complex = (flags & 0x800u) != 0; + a->is_logical = (flags & 0x200u) != 0; + size_t pos = t.next; + if (a->cls == RES_MX_OPAQUE) { /* flags, name, then class metadata: keep the name only */ + if ((e = read_tag(p, n, pos, 1, &t))) return e; + if (t.type != MI_INT8) return RES_MAT_ERR_FORMAT; + size_t nl = t.nbytes < RES_MAT_MAX_NAME - 1u ? t.nbytes : RES_MAT_MAX_NAME - 1u; + memcpy(a->name, p + t.data, nl); + a->name[nl] = 0; + return RES_MAT_OK; + } + if ((e = read_tag(p, n, pos, 1, &t))) return e; + if (t.type != MI_INT32 || t.nbytes % 4u || t.nbytes / 4u < 2u || t.nbytes / 4u > RES_MAT_MAX_DIMS) + return RES_MAT_ERR_FORMAT; + a->ndims = t.nbytes / 4u; + a->numel = 1; + for (uint32_t i = 0; i < a->ndims; i++) { + int32_t d = (int32_t)rd32(p + t.data + 4u * i); + if (d < 0) return RES_MAT_ERR_FORMAT; + a->dims[i] = (uint32_t)d; + if (d != 0 && a->numel > MAX_NUMEL / (size_t)d) return RES_MAT_ERR_FORMAT; + a->numel *= (size_t)d; + } + pos = t.next; + if ((e = read_tag(p, n, pos, 1, &t))) return e; + if (t.type != MI_INT8) return RES_MAT_ERR_FORMAT; + size_t nl = t.nbytes < RES_MAT_MAX_NAME - 1u ? t.nbytes : RES_MAT_MAX_NAME - 1u; + memcpy(a->name, p + t.data, nl); + a->name[nl] = 0; + pos = t.next; + if (a->cls >= RES_MX_DOUBLE && a->cls <= RES_MX_UINT64) { + if (a->is_complex) return RES_MAT_OK; /* recorded, no data */ + if ((e = read_tag(p, n, pos, 1, &t))) return e; + size_t sz = type_size(t.type); /* sizes checked before allocating: dims are untrusted */ + if (sz == 0 || t.nbytes != a->numel * sz) return RES_MAT_ERR_FORMAT; + a->re = malloc(a->numel ? a->numel * sizeof(double) : 1u); + if (!a->re) return RES_MAT_ERR_NOMEM; + if ((e = convert(t.type, p + t.data, t.nbytes, a->numel, a->re))) return e; + a->has_data = 1; + return RES_MAT_OK; + } + if (a->cls == RES_MX_CELL) { + if (pos > n || a->numel > (n - pos) / 8u) return RES_MAT_ERR_FORMAT; /* each element needs a tag */ + a->cell = calloc(a->numel ? a->numel : 1u, sizeof(ResMatArray)); + if (!a->cell) return RES_MAT_ERR_NOMEM; + for (size_t i = 0; i < a->numel; i++) { + if ((e = read_tag(p, n, pos, 1, &t))) return e; + if (t.type != MI_MATRIX) return RES_MAT_ERR_FORMAT; + if ((e = parse_matrix(p + t.data, t.nbytes, &a->cell[i], depth + 1))) return e; + pos = t.next; + } + a->has_data = 1; + return RES_MAT_OK; + } + return RES_MAT_OK; /* char, struct, object, sparse: class and dims only */ +} + +static ResMatStatus add_element(ResMatFile *f, const uint8_t *p, size_t n) +{ + Tag t; + ResMatStatus e = read_tag(p, n, 0, 1, &t); + if (e) return e; + if (t.type != MI_MATRIX) return RES_MAT_ERR_FORMAT; + if (f->var_count >= RES_MAT_MAX_VARS) return RES_MAT_UNSUPPORTED; + ResMatArray *a = &f->var[f->var_count]; + e = parse_matrix(p + t.data, t.nbytes, a, 0); + f->var_count++; /* counted even on failure so res_mat_free releases it */ + return e; +} + +ResMatStatus res_mat_parse(const uint8_t *p, size_t n, ResMatFile *f) +{ + if (!p || !f) return RES_MAT_ERR_FORMAT; + uint8_t keep[32]; + size_t keep_n = f->file_bytes; + memcpy(keep, f->sha256, 32); + memset(f, 0, sizeof *f); + memcpy(f->sha256, keep, 32); + f->file_bytes = keep_n; + if (n < 128) return RES_MAT_ERR_FORMAT; + if (p[126] != 'I' || p[127] != 'M') return RES_MAT_UNSUPPORTED; /* big-endian file */ + if (p[124] != 0x00 || p[125] != 0x01) return RES_MAT_ERR_FORMAT; + if (memcmp(p, "MATLAB 5.0 MAT-file", 19) != 0) return RES_MAT_ERR_FORMAT; + memcpy(f->header_text, p, 116); + f->header_text[116] = 0; + size_t pos = 128; + while (pos < n) { + Tag t; + ResMatStatus e = read_tag(p, n, pos, 0, &t); + if (e) return e; + if (t.type == MI_COMPRESSED) { + uint8_t *buf; + size_t len, used; + ResInflateStatus z = res_zlib_inflate(p + t.data, t.nbytes, &buf, &len, &used); + if (z != RES_INF_OK) { + if (res_mat_verbose) fprintf(stderr, "res_mat: element at byte %zu: %s\n", pos, res_inflate_strerror(z)); + return RES_MAT_ERR_INFLATE; + } + if (used != t.nbytes) { + free(buf); + return RES_MAT_ERR_FORMAT; + } + e = add_element(f, buf, len); + free(buf); + if (e) return e; + pos = t.data + t.nbytes; + } else if (t.type == MI_MATRIX) { + if ((e = add_element(f, p + pos, n - pos))) return e; + pos = (t.data + t.nbytes + 7u) & ~(size_t)7u; + } else { + return RES_MAT_ERR_FORMAT; + } + } + return RES_MAT_OK; +} + +ResMatStatus res_mat_load(const char *path, const uint8_t *want_sha256, ResMatFile *out) +{ + if (!path || !out) return RES_MAT_ERR_IO; + memset(out, 0, sizeof *out); + FILE *fp = fopen(path, "rb"); + if (!fp) return RES_MAT_ERR_IO; + size_t cap = 1u << 20, n = 0; + uint8_t *buf = malloc(cap); + if (!buf) { + fclose(fp); + return RES_MAT_ERR_NOMEM; + } + for (;;) { + if (n == cap) { + if (cap >= ((size_t)1 << 30)) { + free(buf); + fclose(fp); + return RES_MAT_ERR_NOMEM; + } + uint8_t *q = realloc(buf, cap * 2u); + if (!q) { + free(buf); + fclose(fp); + return RES_MAT_ERR_NOMEM; + } + buf = q; + cap *= 2u; + } + size_t r = fread(buf + n, 1, cap - n, fp); + n += r; + if (r == 0) break; + } + int bad = ferror(fp); + fclose(fp); + if (bad) { + free(buf); + return RES_MAT_ERR_IO; + } + sha256_hash(buf, n, out->sha256); + out->file_bytes = n; + if (want_sha256 && memcmp(out->sha256, want_sha256, 32) != 0) { + free(buf); + return RES_MAT_ERR_DIGEST; + } + ResMatStatus e = res_mat_parse(buf, n, out); + free(buf); + if (e) res_mat_free(out); + return e; +} + +void res_mat_free(ResMatFile *f) +{ + if (!f) return; + for (uint32_t i = 0; i < f->var_count; i++) free_array(&f->var[i]); + f->var_count = 0; +} + +const ResMatArray *res_mat_find(const ResMatFile *f, const char *name) +{ + for (uint32_t i = 0; f && i < f->var_count; i++) + if (strcmp(f->var[i].name, name) == 0) return &f->var[i]; + return NULL; +} + +const ResMatArray *res_mat_cell_at(const ResMatArray *c, const uint32_t *sub, uint32_t count) +{ + if (!c || c->cls != RES_MX_CELL || !c->cell || count != c->ndims) return NULL; + size_t idx = 0, stride = 1; + for (uint32_t i = 0; i < count; i++) { + if (sub[i] >= c->dims[i]) return NULL; + idx += (size_t)sub[i] * stride; + stride *= c->dims[i]; + } + return &c->cell[idx]; +} + +ResMatStatus res_mat_values(const ResMatArray *a, size_t want_numel, const double **values) +{ + if (!a) return RES_MAT_ERR_NOTFOUND; + if (!(a->cls >= RES_MX_DOUBLE && a->cls <= RES_MX_UINT64) || !a->has_data || !a->re) return RES_MAT_UNSUPPORTED; + if (want_numel && a->numel != want_numel) return RES_MAT_ERR_SHAPE; + *values = a->re; + return RES_MAT_OK; +} + +const char *res_mat_strerror(ResMatStatus s) +{ + switch (s) { + case RES_MAT_OK: return "ok"; + case RES_MAT_ERR_IO: return "cannot read file"; + case RES_MAT_ERR_FORMAT: return "not a valid MAT v5 file"; + case RES_MAT_ERR_INFLATE: return "compressed element failed to decode"; + case RES_MAT_ERR_NOMEM: return "out of memory"; + case RES_MAT_ERR_DIGEST: return "sha256 differs from the pinned value"; + case RES_MAT_ERR_NOTFOUND: return "variable not found"; + case RES_MAT_UNSUPPORTED: return "unsupported MAT content"; + case RES_MAT_ERR_SHAPE: return "unexpected shape"; + } + return "unknown"; +} + +const char *res_mat_class_name(int cls) +{ + static const char *const N[] = {"?", "cell", "struct", "object", "char", "sparse", "double", "single", + "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}; + if (cls == RES_MX_OPAQUE) return "opaque"; + return (cls >= 0 && cls <= 15) ? N[cls] : "?"; +} diff --git a/tools/reservoir/res_mat.h b/tools/reservoir/res_mat.h new file mode 100644 index 000000000..dc2ef795d --- /dev/null +++ b/tools/reservoir/res_mat.h @@ -0,0 +1,85 @@ +/* Minimal reader for MATLAB MAT-file version 5 (little-endian), the format + * of the 19 archived .mat files of Zenodo 10.5281/zenodo.17296788 + * (docs/reservoir/RESERVOIR_REFERENCE.md section 1). Reads what the + * omega#440 Gate 2 tools need and refuses the rest by name: + * - top-level elements miMATRIX (14) or miCOMPRESSED (15, decoded by the + * in-house res_zlib_inflate with its Adler-32 check); + * - numeric classes double, single, int8..uint64 and logical, stored in any + * numeric MAT data type; values are converted to binary64 (exact for + * every stored type except 64-bit integers above 2^53, which refuse); + * - cell arrays (recursively); + * - char, struct, object, sparse and complex arrays are recorded with + * their class and dimensions but carry no data (RES_MAT_UNSUPPORTED if + * their values are requested). + * Input is untrusted: every size is checked against the bytes present. + * Data is column-major, as MATLAB stores it. */ +#ifndef RES_MAT_H +#define RES_MAT_H + +#include +#include + +#define RES_MAT_MAX_DIMS 8u +#define RES_MAT_MAX_NAME 64u +#define RES_MAT_MAX_VARS 64u +#define RES_MAT_MAX_DEPTH 4 + +enum { /* mxClassID */ + RES_MX_CELL = 1, RES_MX_STRUCT = 2, RES_MX_OBJECT = 3, RES_MX_CHAR = 4, RES_MX_SPARSE = 5, + RES_MX_DOUBLE = 6, RES_MX_SINGLE = 7, RES_MX_INT8 = 8, RES_MX_UINT8 = 9, RES_MX_INT16 = 10, + RES_MX_UINT16 = 11, RES_MX_INT32 = 12, RES_MX_UINT32 = 13, RES_MX_INT64 = 14, RES_MX_UINT64 = 15, + RES_MX_OPAQUE = 17 /* MATLAB class objects (MCOS); name only, no dims, no data */ +}; + +typedef enum { + RES_MAT_OK = 0, + RES_MAT_ERR_IO = -1, + RES_MAT_ERR_FORMAT = -2, /* header, tag, size or type not as the format requires */ + RES_MAT_ERR_INFLATE = -3, /* a compressed element failed to decode */ + RES_MAT_ERR_NOMEM = -4, + RES_MAT_ERR_DIGEST = -5, /* file sha256 differs from the pinned value */ + RES_MAT_ERR_NOTFOUND = -6, + RES_MAT_UNSUPPORTED = -7, + RES_MAT_ERR_SHAPE = -8 +} ResMatStatus; + +typedef struct ResMatArray { + char name[RES_MAT_MAX_NAME]; + int cls; /* RES_MX_* */ + int is_complex, is_logical, has_data; + uint32_t ndims; + uint32_t dims[RES_MAT_MAX_DIMS]; + size_t numel; + double *re; /* numeric: numel values, column-major (else NULL) */ + struct ResMatArray *cell; /* cell: numel arrays, column-major (else NULL) */ +} ResMatArray; + +typedef struct { + char header_text[117]; + uint8_t sha256[32]; /* of the whole file as read */ + size_t file_bytes; + uint32_t var_count; + ResMatArray var[RES_MAT_MAX_VARS]; +} ResMatFile; + +/* Reads path. If want_sha256 is not NULL, the file's SHA-256 must equal it + * (RES_MAT_ERR_DIGEST otherwise, nothing parsed). */ +ResMatStatus res_mat_load(const char *path, const uint8_t *want_sha256, ResMatFile *out); +/* Same, from bytes already in memory. */ +ResMatStatus res_mat_parse(const uint8_t *bytes, size_t n, ResMatFile *out); +void res_mat_free(ResMatFile *f); +/* Nonzero (the default): a failed compressed element is described on stderr. */ +extern int res_mat_verbose; + +const ResMatArray *res_mat_find(const ResMatFile *f, const char *name); +/* Element of a cell array by 0-based column-major subscripts (count must + * equal the cell's ndims). NULL if out of range or not a cell. */ +const ResMatArray *res_mat_cell_at(const ResMatArray *c, const uint32_t *sub, uint32_t count); +/* A numeric array's values, refusing anything else (and shape mismatch when + * want_numel != 0). */ +ResMatStatus res_mat_values(const ResMatArray *a, size_t want_numel, const double **values); + +const char *res_mat_strerror(ResMatStatus s); +const char *res_mat_class_name(int cls); + +#endif /* RES_MAT_H */ diff --git a/tools/reservoir/res_qualify.c b/tools/reservoir/res_qualify.c new file mode 100644 index 000000000..c5881a420 --- /dev/null +++ b/tools/reservoir/res_qualify.c @@ -0,0 +1,853 @@ +/* res_qualify: omega#440 Gate 2 tool. Contract and protocol: + * docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1 and 10. + * + * res_qualify pins sha256 of every pinned file + * res_qualify g2-narma + * res_qualify g2-narma N1b-v2 + * res_qualify g2-lorenz <13|25|43> [NC-L] + * res_qualify bench-narma [seed..] (res_bench.c; default seeds 1-5) + * res_qualify bench-lorenz [seed..] (res_bench.c; default seeds 1-5) + * res_qualify perf (res_bench.c) + * res_qualify config the declared constants + * + * is the unpacked project-zenodo-ready_with-paper/ directory of + * Zenodo 10.5281/zenodo.17296788. Its files are data: read, hashed and + * parsed by the in-house MAT reader, never executed. Each subcommand writes + * one JSON document to stdout and exits 0 when its verdict is PASS (or, for + * pins and the benchmarks, when it ran), 1 on FAIL, 2 on a usage or input + * error. */ +#include "res_common.h" + +#include +#include + +int res_bench_narma(int argc, char **argv, FILE *o); +int res_bench_lorenz(int argc, char **argv, FILE *o); +int res_perf(FILE *o); + +/* Declared before any run (section 7, 7.1). */ +#define TOL_TARGET_ABS 1e-12 +#define TOL_PRED_REL 0.01 +#define TOL_NRMSE_ABS 0.005 +#define TOL_NRMSE_REL 0.05 +#define TOL_METRIC_REL 1e-9 +#define STEP_S 1.0e-5f +#define STEPS_PER_KNOT 10u + +/* Zenodo record 20277956 (version 2), src/Codes for Zenodo/NARMA Final Code/ + * Connected Reservoir/HyperParameterOptimizationVariablesToPlot.mat, 14,525,399 + * bytes (section 1.1, item 10 of section 7.1). */ +static const uint8_t V2_RESULTS_SHA256[32] = { + 0x31, 0x7a, 0xf7, 0xa7, 0x60, 0x51, 0xe6, 0xc3, 0x0a, 0xa0, 0x47, 0x6a, 0x61, 0x2c, 0x29, 0xe4, + 0x17, 0xb1, 0x99, 0xc9, 0xef, 0x22, 0x6f, 0x4f, 0x00, 0xd7, 0xf7, 0x50, 0x55, 0x12, 0xfc, 0x92}; + +static void jd(FILE *o, double v) /* JSON number or null */ +{ + if (v == v && v - v == 0.0) fprintf(o, "%.17g", v); + else fputs("null", o); +} + +static void jhex(FILE *o, const uint8_t *d) +{ + char h[65]; + res_hex(d, 32, h); + fprintf(o, "\"%s\"", h); +} + +static void receipt_json(FILE *o, const char *split, OmegaResStatus st, const OmegaResRunReceipt *r, + const OmegaResMembraneStats *ms) +{ + fprintf(o, "{\"split\": \"%s\", \"status\": \"%s\"", split, res_status_name(st)); + if (st == OMEGA_RES_OK) { + fputs(", \"config_id\": ", o); + jhex(o, r->config_id); + fputs(", \"input_digest\": ", o); + jhex(o, r->input_digest); + fputs(", \"final_state_digest\": ", o); + jhex(o, r->final_state_digest); + fprintf(o, ", \"steps\": %llu, \"run_id\": ", (unsigned long long)r->steps); + jhex(o, r->run_id); + } + res_mstats_json(o, ms); + fputc('}', o); +} + +static int nrmse_ok(double got, double ref) +{ + double d = got - ref, tol = TOL_NRMSE_REL * ref; + if (d < 0) d = -d; + if (tol < TOL_NRMSE_ABS) tol = TOL_NRMSE_ABS; + return d <= tol; +} + +static int rel_ok(double got, double ref, double rel) +{ + double d = got - ref, s = ref < 0 ? -ref : ref; + if (d < 0) d = -d; + return d <= rel * s; +} + +/* ---------------------------------------------------------------- pins */ + +static int cmd_pins(const char *root, FILE *o) +{ + int bad = 0; + fputs("{\n \"schema\": \"omega-reservoir-pins/1\",\n \"record\": \"10.5281/zenodo.17296788\",\n \"files\": [", o); + for (unsigned i = 0; i < RES_PIN_COUNT; i++) { + char got[65]; + int r = res_check_pinned(root, &RES_PINS[i], got); + bad |= r != 0; + fprintf(o, "%s\n {\"key\": \"%s\", \"path\": ", i ? "," : "", RES_PINS[i].key); + res_json_str(o, RES_PINS[i].path); + fprintf(o, ", \"sha256\": \"%s\", \"match\": %s}", got[0] ? got : "missing", r == 0 ? "true" : "false"); + } + fprintf(o, "\n ],\n \"verdict\": \"%s\"\n}\n", bad ? "FAIL" : "PASS"); + return bad ? 1 : 0; +} + +/* ------------------------------------------------------------- G2-N1 */ + +/* Collinearity of the design [1, x] (n x nf row-major): LDL^T of its Gram + * matrix in binary64 without refusal; returns min_j d_j / G_jj, the squared + * sine of the angle between column j and the span of the columns before it + * (scale-free). omega_res_readout_fit refuses when this is <= 1e-13. */ +static double design_min_pivot_ratio(const double *x, uint32_t n, uint32_t nf, uint32_t *argmin) +{ + const uint32_t p = nf + 1u; + double *G = calloc((size_t)p * p, sizeof(double)), best = 1.0 / 0.0; + if (!G) return 0.0 / 0.0; + for (uint32_t r = 0; r < n; r++) + for (uint32_t i = 0; i < p; i++) { + double xi = i ? x[(size_t)r * nf + i - 1u] : 1.0; + for (uint32_t j = 0; j <= i; j++) G[(size_t)i * p + j] += xi * (j ? x[(size_t)r * nf + j - 1u] : 1.0); + } + *argmin = 0; + for (uint32_t j = 0; j < p; j++) { /* in place: L below the diagonal, D on it */ + double gjj = G[(size_t)j * p + j], d = gjj; + for (uint32_t k = 0; k < j; k++) d -= G[(size_t)j * p + k] * G[(size_t)j * p + k] * G[(size_t)k * p + k]; + double ratio = gjj > 0.0 ? d / gjj : 0.0; + if (ratio < best) { + best = ratio; + *argmin = j; + } + G[(size_t)j * p + j] = d; + for (uint32_t i = j + 1u; i < p; i++) { + double s = G[(size_t)i * p + j]; + for (uint32_t k = 0; k < j; k++) s -= G[(size_t)i * p + k] * G[(size_t)j * p + k] * G[(size_t)k * p + k]; + G[(size_t)i * p + j] = d != 0.0 ? s / d : 0.0; + } + } + free(G); + return best; +} + +/* Sensitivity of the least-squares predictions to a relative perturbation + * rel of every feature value (deterministic: splitmix64 seed 1, uniform in + * [-1, 1)): RMS change of the fitted predictions over the fit rows, divided + * by the target std. A diagnostic of how well any integrator with that + * relative state error could reproduce the predictions. -1 if refused. */ +static double qr_sensitivity(const double *x, const double *y, uint32_t n, uint32_t nf, double rel) +{ + double *xp = malloc((size_t)n * nf * sizeof(double)), *w0 = malloc((nf + 1u) * sizeof(double)), + *w1 = malloc((nf + 1u) * sizeof(double)), acc = 0.0; + ResRng rng = {1}; + int ok = xp && w0 && w1; + if (ok) { + for (size_t k = 0; k < (size_t)n * nf; k++) xp[k] = x[k] * (1.0 + rel * (2.0 * res_rng_unit(&rng) - 1.0)); + ok = res_ols_qr(x, y, n, nf, w0) == 0 && res_ols_qr(xp, y, n, nf, w1) == 0; + } + for (uint32_t r = 0; ok && r < n; r++) { + double a = w0[0], b = w1[0]; + for (uint32_t c = 0; c < nf; c++) { + a += x[(size_t)r * nf + c] * w0[c + 1u]; + b += xp[(size_t)r * nf + c] * w1[c + 1u]; + } + acc += (a - b) * (a - b); + } + double sd = res_std_pop(y, n, 1), out = ok ? res_sqrt(acc / n) / sd : -1.0; + free(xp); + free(w0); + free(w1); + return out; +} + +typedef struct { + const double *u, *I, *tm; /* u: 1000, I: knots x L column-major, tm: knots */ + uint32_t n, knots; +} NarmaSignal; + +static int narma_signal(const ResMatFile *f, const char *un, const char *in, const char *tn, uint32_t L, + NarmaSignal *s) +{ + const ResMatArray *u = res_mat_find(f, un), *I = res_mat_find(f, in), *t = res_mat_find(f, tn); + if (!u || !I || !t || res_mat_values(u, 0, &s->u) || res_mat_values(I, 0, &s->I) || res_mat_values(t, 0, &s->tm)) + return -1; + s->n = (uint32_t)u->numel; + s->knots = I->dims[0]; + if (I->dims[1] != L || t->numel != s->knots) return -1; + return 0; +} + +static int cmd_g2_narma(const char *root, const char *variant, const char *v2_results, FILE *o) +{ + const int v2 = strcmp(variant, "N1b-v2") == 0, squares = v2 || strcmp(variant, "N1b") == 0, + control = strcmp(variant, "NC-N") == 0; + if (!squares && !control && strcmp(variant, "N1a") != 0) return 2; + if (v2 != (v2_results != NULL)) return 2; + static ResMatFile flen, ftr, fte, fres; + if (res_load_pinned(root, "narma.length5", &flen) || res_load_pinned(root, "narma.train_signal", &ftr) || + res_load_pinned(root, "narma.test_signal", &fte)) + return 2; + if (v2) { + ResMatStatus ms = res_mat_load(v2_results, V2_RESULTS_SHA256, &fres); + if (ms != RES_MAT_OK) { + fprintf(stderr, "res_qualify: v2 results %s: %s\n", v2_results, res_mat_strerror(ms)); + return 2; + } + } else if (res_load_pinned(root, "narma.results", &fres)) + return 2; + const ResMatArray *cm = res_mat_find(&flen, "conmat"), *gr = res_mat_find(&flen, "ground"), + *ix = res_mat_find(&flen, "inex"); + const double *conmat, *ground, *inex, *spatial, *cur, *mask; + if (res_mat_values(cm, 25, &conmat) || res_mat_values(gr, 1, &ground) || res_mat_values(ix, 25, &inex) || + res_mat_values(res_mat_find(&fres, "spatialNodeOptions"), 4, &spatial) || + res_mat_values(res_mat_find(&fres, "currentUpperSelectionValues"), 4, &cur) || + res_mat_values(res_mat_find(&fres, "maskLengthOptions"), 4, &mask)) { + fprintf(stderr, "res_qualify: archived NARMA variables missing\n"); + return 2; + } + const uint32_t L = 5, M = (uint32_t)mask[0], PW = 100; /* 1 ms = 100 steps */ + const double hi = cur[0]; + /* topology from the archived conmat */ + OmegaResEdge e[OMEGA_RES_MAX_EDGES]; + uint32_t m = 0, sym = 1, inex_all1 = 1; + for (uint32_t j = 0; j < L; j++) + for (uint32_t i = 0; i < L; i++) { + double a = conmat[i + L * j]; + if (a != conmat[j + L * i]) sym = 0; + if (inex[i + L * j] != 1.0) inex_all1 = 0; + if (i < j && a != 0.0) { + e[m].a = (uint16_t)i; + e[m].b = (uint16_t)j; + m++; + } + } + uint32_t g = (uint32_t)ground[0] - 1u; + OmegaResTopology topo, chain; + OmegaResParams par; + OmegaResIntegrator integ = {STEP_S, STEPS_PER_KNOT}; + ResSim *sim = calloc(1, sizeof *sim); + OmegaResConfig *ccfg = calloc(1, sizeof *ccfg); + if (!sim || !ccfg) return 2; + OmegaResStatus st = omega_res_topology_build(L, e, m, &g, 1, &topo); + if (st == OMEGA_RES_OK) st = omega_res_params_reference(OMEGA_RES_REF_NARMA, L, &par); + if (control) par.eps_f_per_m = par.eps_f_per_m * 2.1f; + if (st == OMEGA_RES_OK) st = omega_res_config_build(&topo, &par, &integ, &sim->cfg); + int chain_same = 0; + if (st == OMEGA_RES_OK && omega_res_topology_chain(L, L - 1u, &chain) == OMEGA_RES_OK && + omega_res_config_build(&chain, &par, &integ, ccfg) == OMEGA_RES_OK) + chain_same = memcmp(ccfg->id, sim->cfg.id, 32) == 0; + if (st != OMEGA_RES_OK) { + fprintf(stderr, "res_qualify: config refused: %s\n", res_status_name(st)); + return 2; + } + NarmaSignal sig[2]; + if (narma_signal(&ftr, "uTrain", "Itrain", "trainsignaltime", L, &sig[0]) || + narma_signal(&fte, "uTest", "Itest", "testsignaltime", L, &sig[1]) || sig[0].n != 1000 || sig[1].n != 1000 || + sig[0].knots != sig[0].n * M * 10u || sig[1].knots != sig[1].n * M * 10u) { + fprintf(stderr, "res_qualify: archived NARMA signals have unexpected shapes\n"); + return 2; + } + const uint32_t N = sig[0].n, KN = sig[0].knots; + const uint32_t nsc = L * M * (squares ? 2u : 1u), ncol = nsc + 1u, nrow = N + 1u; + const uint32_t r0 = 99, r1 = 995, nfit = r1 - r0; /* 1-based rows 100..995 */ + double *feat[2], *ys[2][11]; + float *tab = malloc((size_t)KN * L * sizeof(float)); + uint64_t *steps = malloc((size_t)N * M * sizeof(uint64_t)); + double *vs = malloc((size_t)N * M * L * sizeof(double)); + if (!tab || !steps || !vs) return 2; + double max_round = 0.0, max_tdev = 0.0; + uint32_t mask_bits[2][5][8] = {{{0}}}, mask_incons[2] = {0, 0}; + double isum_lo = 1.0 / 0.0, isum_hi = -1.0 / 0.0; /* total current into the non-ground nodes */ + OmegaResRunReceipt rc[2]; + OmegaResStatus rst[2]; + OmegaResMembraneStats ms[2]; + for (int sp = 0; sp < 2; sp++) { + const NarmaSignal *s = &sig[sp]; + feat[sp] = calloc((size_t)nrow * ncol, sizeof(double)); + if (!feat[sp]) return 2; + for (uint32_t k = 0; k < KN; k++) { + double dev = s->tm[k] - (double)k / 10000.0; + if (dev < 0) dev = -dev; + if (dev > max_tdev) max_tdev = dev; + double isum = 0.0; + for (uint32_t i = 0; i < L; i++) + if (i != g) isum += s->I[k + (size_t)KN * i]; + if (isum < isum_lo) isum_lo = isum; + if (isum > isum_hi) isum_hi = isum; + for (uint32_t i = 0; i < L; i++) { + double x = s->I[k + (size_t)KN * i]; + float f = (float)x; + tab[(size_t)k * L + i] = f; + double r = x != 0.0 ? ((double)f - x) / x : 0.0; + if (r < 0) r = -r; + if (r > max_round) max_round = r; + } + } + /* mask bits read back from the archived currents (informational) */ + for (uint32_t i = 0; i < L; i++) + for (uint32_t mi = 0; mi < M; mi++) { + uint32_t ones = 0; + for (uint32_t c = 0; c < N; c++) { + double x = s->I[(size_t)(c * M * 10u + mi * 10u) + (size_t)KN * i], seq = s->u[c] * hi / 0.5; + double d1 = x - seq, d0 = x - (hi - seq); + if (d1 < 0) d1 = -d1; + if (d0 < 0) d0 = -d0; + ones += d1 <= d0; + } + mask_bits[sp][i][mi] = ones * 2u > N; + if (ones != 0 && ones != N) mask_incons[sp]++; + } + OmegaResInput in = {L, KN, tab}; + const uint64_t last = (uint64_t)(KN - 1u) * STEPS_PER_KNOT; + uint32_t ns = 0, nvalid = 0; + for (uint32_t i = 1; i <= N; i++) { /* reference row i: t = i*pw*M + k*pw */ + uint64_t top = ((uint64_t)i * M + M) * PW; + if (top > last) break; + for (uint32_t k = 1; k <= M; k++) steps[ns++] = ((uint64_t)i * M + k) * PW; + nvalid++; + } + omega_res_membrane_stats_init(&sim->mstats); + rst[sp] = omega_res_state_init(&sim->cfg, OMEGA_RES_INIT_N0, 0.0f, &sim->s); + if (rst[sp] == OMEGA_RES_OK) rst[sp] = res_sim_at_steps(sim, &in, steps, ns, vs); + if (rst[sp] == OMEGA_RES_OK && sim->s.step < last) + rst[sp] = omega_res_advance_observed(&sim->cfg, &in, &sim->ws, &sim->s, last - sim->s.step, &sim->mstats); + if (rst[sp] == OMEGA_RES_OK) rst[sp] = omega_res_run_receipt(&sim->cfg, &in, &sim->s, &rc[sp]); + ms[sp] = sim->mstats; + /* features: row 0 zeros; row r >= 1 = reference sample row r (1-based), node-major */ + for (uint32_t r = 1; r <= nvalid; r++) + for (uint32_t node = 0; node < L; node++) + for (uint32_t k = 0; k < M; k++) { + double v = vs[((size_t)(r - 1) * M + k) * L + node]; + feat[sp][(size_t)r * ncol + node * M + k] = v; + if (squares) feat[sp][(size_t)r * ncol + L * M + node * M + k] = v * v; + } + for (uint32_t r = 1; r <= N; r++) feat[sp][(size_t)r * ncol + nsc] = s->u[r - 1]; + for (uint32_t ord = 2; ord <= 10; ord++) { + ys[sp][ord] = malloc((size_t)N * sizeof(double)); + if (!ys[sp][ord]) return 2; + res_narma(s->u, N, ord, ys[sp][ord]); + } + } + /* drop columns identically zero over the training fit rows */ + uint32_t keep[64], nk = 0, dropped[64], nd = 0; + for (uint32_t c = 0; c < ncol; c++) { + int zero = 1; + for (uint32_t r = r0; r < r1 && zero; r++) zero = feat[0][(size_t)r * ncol + c] == 0.0; + if (zero) dropped[nd++] = c; + else keep[nk++] = c; + } + double *xf[2]; + for (int sp = 0; sp < 2; sp++) { + xf[sp] = malloc((size_t)nfit * nk * sizeof(double)); + if (!xf[sp]) return 2; + for (uint32_t r = 0; r < nfit; r++) + for (uint32_t c = 0; c < nk; c++) xf[sp][(size_t)r * nk + c] = feat[sp][(size_t)(r0 + r) * ncol + keep[c]]; + } + const ResMatArray *cells[4] = {res_mat_find(&fres, "yTrainCell"), res_mat_find(&fres, "yTestCell"), + res_mat_find(&fres, "predictionTrainCell"), res_mat_find(&fres, "predictionTestCell")}; + const double *nr_ref[2]; + if (res_mat_values(res_mat_find(&fres, "NRMSEtrain"), 640, &nr_ref[0]) || + res_mat_values(res_mat_find(&fres, "NRMSEtest"), 640, &nr_ref[1]) || !cells[0] || !cells[1] || !cells[2] || + !cells[3]) + return 2; + static OmegaResReadoutWorkspace rws; + static OmegaResReadout ro; + double *pred = malloc((size_t)nfit * sizeof(double)), *pqr = malloc((size_t)nfit * sizeof(double)); + double *w = malloc((size_t)(nk + 1u) * sizeof(double)); + if (!pred || !pqr || !w) return 2; + int all_pass = rst[0] == OMEGA_RES_OK && rst[1] == OMEGA_RES_OK && sym && inex_all1; + + fprintf(o, "{\n \"schema\": \"omega-reservoir-g2/1\",\n \"case\": \"G2-N1\",\n \"variant\": \"%s\",\n", variant); + fprintf(o, " \"negative_control\": %s,\n", control ? "\"NC-N: permittivity x 2.1\"" : "false"); + fprintf(o, " \"reference_results\": \"%s\",\n", + v2 ? "Zenodo record 20277956 (version 2), sha256 317af7a7...fc92" : "Zenodo record 17296788 (version 1, pinned)"); + fprintf(o, " \"grid_cell\": {\"nodes\": %u, \"current_hi_a\": ", L); + jd(o, hi); + fprintf(o, ", \"mask_length\": %u, \"spatial_option0\": ", M); + jd(o, spatial[0]); + fprintf(o, ", \"condition\": 7},\n \"features\": \"%s\",\n", + squares ? "v2 code: [V, V^2, u] (node-major, M per node)" : "v1 code: [V, u] (node-major, M per node)"); + fprintf(o, " \"topology\": {\"edges\": %u, \"ground_1based\": %u, \"symmetric\": %s, \"inex_all_1\": %s, " + "\"same_config_id_as_omega_chain\": %s},\n", + m, g + 1u, sym ? "true" : "false", inex_all1 ? "true" : "false", chain_same ? "true" : "false"); + fprintf(o, " \"step_s\": %.9g, \"steps_per_knot\": %u, \"permittivity_f_per_m\": %.9g,\n", (double)STEP_S, + STEPS_PER_KNOT, (double)par.eps_f_per_m); + fprintf(o, " \"inputs\": {\"knots\": %u, \"knot_spacing_s\": 1e-4, \"max_rel_binary32_rounding\": ", KN); + jd(o, max_round); + fputs(", \"max_time_grid_deviation_s\": ", o); + jd(o, max_tdev); + fputs(", \"total_nonground_current_min_a\": ", o); + jd(o, isum_lo); + fputs(", \"total_nonground_current_max_a\": ", o); + jd(o, isum_hi); + fputs(", \"mask_bits_train\": [", o); + for (uint32_t i = 0; i < L; i++) { + fprintf(o, "%s[", i ? ", " : ""); + for (uint32_t k = 0; k < M; k++) fprintf(o, "%s%u", k ? ", " : "", mask_bits[0][i][k]); + fputc(']', o); + } + fputs("], \"mask_bits_test\": [", o); + for (uint32_t i = 0; i < L; i++) { + fprintf(o, "%s[", i ? ", " : ""); + for (uint32_t k = 0; k < M; k++) fprintf(o, "%s%u", k ? ", " : "", mask_bits[1][i][k]); + fputc(']', o); + } + fprintf(o, "], \"mask_inconsistent_slots\": [%u, %u], \"masks_equal_train_test\": %s},\n", mask_incons[0], + mask_incons[1], memcmp(mask_bits[0], mask_bits[1], sizeof mask_bits[0]) == 0 ? "true" : "false"); + fputs(" \"runs\": [", o); + receipt_json(o, "train", rst[0], &rc[0], &ms[0]); + fputs(", ", o); + receipt_json(o, "test", rst[1], &rc[1], &ms[1]); + fprintf(o, "],\n \"fit\": {\"rows_1based\": [100, 995], \"columns\": %u, \"columns_dropped_zero\": [", ncol); + for (uint32_t k = 0; k < nd; k++) fprintf(o, "%s%u", k ? ", " : "", dropped[k]); + uint32_t argp = 0; + double mpr = design_min_pivot_ratio(xf[0], nfit, nk, &argp); + fputs("], \"column_rms\": [", o); + for (uint32_t c = 0; c < nk; c++) { + double s = 0.0; + for (uint32_t r = 0; r < nfit; r++) s += xf[0][(size_t)r * nk + c] * xf[0][(size_t)r * nk + c]; + fputs(c ? ", " : "", o); + jd(o, res_sqrt(s / nfit)); + } + fputs("], \"node_last_minus_first_subpulse_rms\": [", o); + for (uint32_t node = 0; node < L; node++) { /* the information between the M samples of a node */ + double s = 0.0; + for (uint32_t r = r0; r < r1; r++) { + double d = feat[0][(size_t)r * ncol + node * M + M - 1u] - feat[0][(size_t)r * ncol + node * M]; + s += d * d; + } + fputs(node ? ", " : "", o); + jd(o, res_sqrt(s / nfit)); + } + fputs("], \"design_min_pivot_ratio\": ", o); + jd(o, mpr); + fprintf(o, ", \"design_min_pivot_column\": %u, \"readout_refuses_at_or_below\": 1e-13", argp); + fprintf(o, ", \"solver\": \"omega_res_readout_fit lambda=0\"},\n"); + fprintf(o, " \"tolerances\": {\"target_max_abs\": %g, \"prediction_rms_over_target_std\": %g, " + "\"nrmse_abs\": %g, \"nrmse_rel\": %g, \"metric_recompute_rel\": %g},\n", + TOL_TARGET_ABS, TOL_PRED_REL, TOL_NRMSE_ABS, TOL_NRMSE_REL, TOL_METRIC_REL); + fputs(" \"orders\": [", o); + int fit_failed = 0; + for (uint32_t ord = 2; ord <= 10; ord++) { + uint32_t sub[4] = {0, 0, 0, ord - 1u}; + const double *ya[2], *pa[2]; + int ok = 1; + for (int sp = 0; sp < 2; sp++) { + const ResMatArray *yc = res_mat_cell_at(cells[sp], sub, 4), *pc = res_mat_cell_at(cells[2 + sp], sub, 4); + if (res_mat_values(yc, nfit, &ya[sp]) || res_mat_values(pc, nfit, &pa[sp])) ok = 0; + } + if (!ok) return 2; + const double *yfit = ys[0][ord] + r0; + st = omega_res_readout_fit(xf[0], yfit, nfit, nk, 1, 0.0, &rws, &ro); + int qr = res_ols_qr(xf[0], yfit, nfit, nk, w); + fprintf(o, "%s\n {\"order\": %u, \"fit_status\": \"%s\", \"qr_rank_ok\": %s", ord > 2 ? "," : "", ord, + res_status_name(st), qr == 0 ? "true" : "false"); + fputs(", \"qr_sensitivity_rel_1e-6\": ", o); + jd(o, qr_sensitivity(xf[0], yfit, nfit, nk, 1e-6)); + int pa_ok = 1, pb_ok = 1, pc_ok = 1, pm_ok = 1; + for (int sp = 0; sp < 2; sp++) { + const char *nm = sp ? "test" : "train"; + const double *y = ys[sp][ord] + r0; + double tdiff = res_max_abs_diff(y, ya[sp], nfit, 1), sd = res_std_pop(ya[sp], nfit, 1); + double prel = 1.0 / 0.0, nr = 1.0 / 0.0, qdiff = 1.0 / 0.0, qprel = 1.0 / 0.0, qnr = 1.0 / 0.0; + for (uint32_t r = 0; r < nfit; r++) { + if (st != OMEGA_RES_OK || omega_res_readout_apply(&ro, xf[sp] + (size_t)r * nk, &pred[r]) != OMEGA_RES_OK) + pred[r] = 0.0 / 0.0; + double q = w[0]; + for (uint32_t c = 0; c < nk; c++) q += xf[sp][(size_t)r * nk + c] * w[c + 1u]; + pqr[r] = q; + } + if (st == OMEGA_RES_OK) { + prel = res_rms_diff(pred, pa[sp], nfit, 1) / sd; + nr = res_nrmse(y, pred, nfit, 1); + if (qr == 0) qdiff = res_max_abs_diff(pred, pqr, nfit, 1) / sd; + } + if (qr == 0) { /* diagnostic only (section 7.1 item 3) */ + qprel = res_rms_diff(pqr, pa[sp], nfit, 1) / sd; + qnr = res_nrmse(y, pqr, nfit, 1); + } + double nref = nr_ref[sp][64u * (ord - 1u)], narch = res_nrmse(ya[sp], pa[sp], nfit, 1); + int a = tdiff <= TOL_TARGET_ABS, b = prel <= TOL_PRED_REL, c = nrmse_ok(nr, nref), + pm = rel_ok(narch, nref, TOL_METRIC_REL); + pa_ok &= a; + pb_ok &= b; + pc_ok &= c; + pm_ok &= pm; + fprintf(o, ", \"%s\": {\"target_max_abs_diff\": ", nm); + jd(o, tdiff); + fputs(", \"prediction_rms_diff_over_target_std\": ", o); + jd(o, prel); + fputs(", \"nrmse_omega\": ", o); + jd(o, nr); + fputs(", \"nrmse_reference\": ", o); + jd(o, nref); + fputs(", \"nrmse_recomputed_from_archived_predictions\": ", o); + jd(o, narch); + fputs(", \"qr_minus_ldl_max_abs_over_target_std\": ", o); + jd(o, qdiff); + fputs(", \"qr_diagnostic\": {\"prediction_rms_diff_over_target_std\": ", o); + jd(o, qprel); + fputs(", \"nrmse_omega\": ", o); + jd(o, qnr); + fprintf(o, ", \"b\": %s, \"c\": %s}", qprel <= TOL_PRED_REL ? "true" : "false", nrmse_ok(qnr, nref) ? "true" : "false"); + fprintf(o, ", \"a\": %s, \"b\": %s, \"c\": %s, \"metric_control\": %s}", a ? "true" : "false", + b ? "true" : "false", c ? "true" : "false", pm ? "true" : "false"); + } + int pass = st == OMEGA_RES_OK && pa_ok && pb_ok && pc_ok; + if (st != OMEGA_RES_OK) fit_failed = 1; + if (!pm_ok) all_pass = 0; /* the metric itself would be in doubt */ + all_pass &= pass; + fprintf(o, ", \"pass\": %s}", pass ? "true" : "false"); + } + const char *verdict = all_pass ? "PASS" : "FAIL"; + fprintf(o, "\n ],\n \"fit_refused\": %s,\n \"verdict\": \"%s\"\n}\n", fit_failed ? "true" : "false", verdict); + return all_pass ? 0 : 1; +} + +/* ------------------------------------------------------------- G2-L1 */ + +typedef struct { + const double *X, *t; + uint32_t n; +} LorenzData; + +static int lorenz_data(const ResMatFile *f, LorenzData *d) +{ + const ResMatArray *X = res_mat_find(f, "X"), *t = res_mat_find(f, "t"); + if (!X || !t || res_mat_values(X, 0, &d->X) || res_mat_values(t, 0, &d->t) || X->dims[1] != 3 || + t->numel != X->dims[0]) + return -1; + d->n = X->dims[0]; + for (uint32_t j = 1; j < d->n; j++) + if (!(d->t[j] > d->t[j - 1])) return -1; + return 0; +} + +/* Current of channel c at data point j, exactly as Lorenz63SolverCustomRegression.m:46-49. */ +static double lorenz_current(const LorenzData *d, uint32_t j, int c) +{ + double x = d->X[j + (size_t)d->n * c]; + if (c < 2) return (x * 1.05e-10 + 1e-9) / 10.0; + return (x * 1e-10 * 2.05) / 10.0; +} + +static double interp_col(const LorenzData *d, const double *col, double t, uint32_t *hint) +{ + uint32_t j = *hint; + if (j + 1u >= d->n) j = d->n - 2u; + while (j > 0 && d->t[j] > t) j--; + while (j + 2u < d->n && d->t[j + 1u] < t) j++; + *hint = j; + double t0 = d->t[j], t1 = d->t[j + 1u]; + return col[j] + (t - t0) * (col[j + 1u] - col[j]) / (t1 - t0); +} + +static int cmd_g2_lorenz(const char *root, int nodes, int control, FILE *o) +{ + const char *fig = nodes == 43 ? "lorenz.fig43" : nodes == 25 ? "lorenz.fig25" : "lorenz.fig13"; + const char *nrk = nodes == 43 ? "lorenz.nrmse43" : nodes == 25 ? "lorenz.nrmse25" : "lorenz.nrmse13"; + static ResMatFile fd1, fd2, ff, fn; + if (res_load_pinned(root, "lorenz.data1", &fd1) || res_load_pinned(root, "lorenz.data2", &fd2) || + res_load_pinned(root, fig, &ff) || res_load_pinned(root, nrk, &fn)) + return 2; + LorenzData D[2]; + if (lorenz_data(&fd1, &D[0]) || lorenz_data(&fd2, &D[1])) { + fprintf(stderr, "res_qualify: Lorenz data malformed\n"); + return 2; + } + static const char *tsn[2] = {"timeSolutionTrain", "timeSolutionTest"}; + static const char *pn[2][3] = {{"predictedX", "predictedY", "predictedZ"}, + {"predictedXTest", "predictedYTest", "predictedZTest"}}; + static const char *nrn[2] = {"nrmseTraining", "nrmseTest"}, *yn[2] = {"Ytrain", "Ytest"}; + const double *ts[2], *pa[2][3], *nref[2], *nref2[2], *yarch[2]; + uint32_t nts[2]; + for (int sp = 0; sp < 2; sp++) { + const ResMatArray *a = res_mat_find(&ff, tsn[sp]); + if (!a || res_mat_values(a, 0, &ts[sp])) return 2; + nts[sp] = (uint32_t)a->numel; + for (int c = 0; c < 3; c++) + if (res_mat_values(res_mat_find(&ff, pn[sp][c]), nts[sp], &pa[sp][c])) return 2; + if (res_mat_values(res_mat_find(&ff, nrn[sp]), 3, &nref[sp]) || + res_mat_values(res_mat_find(&fn, nrn[sp]), 3, &nref2[sp]) || + res_mat_values(res_mat_find(&ff, yn[sp]), (size_t)D[sp].n * 3u, &yarch[sp])) + return 2; + } + OmegaResTopology topo; + OmegaResParams par; + OmegaResIntegrator integ = {STEP_S, STEPS_PER_KNOT}; + uint32_t inp[3], g; + ResSim *sim = calloc(1, sizeof *sim); + if (!sim) return 2; + OmegaResStatus st = res_net_topology((ResNet)nodes, &topo, inp, &g); + if (st == OMEGA_RES_OK) st = omega_res_params_reference(OMEGA_RES_REF_LORENZ, (uint32_t)nodes, &par); + if (control) par.eps_f_per_m = 8.85e-12f; + if (st == OMEGA_RES_OK) st = omega_res_config_build(&topo, &par, &integ, &sim->cfg); + if (st != OMEGA_RES_OK) { + fprintf(stderr, "res_qualify: config refused: %s\n", res_status_name(st)); + return 2; + } + const uint32_t L = (uint32_t)nodes, KN = 400001u; + const uint64_t last = (uint64_t)(KN - 1u) * STEPS_PER_KNOT; + float *tab = calloc((size_t)KN * L, sizeof(float)); + double *V[2], *T[2], *cur = malloc((size_t)(D[0].n > D[1].n ? D[0].n : D[1].n) * sizeof(double)); + if (!tab || !cur) return 2; + double max_err[3] = {0, 0, 0}, max_i[3] = {0, 0, 0}; + int yeq[2], t_ok = 1; + OmegaResRunReceipt rc[2]; + OmegaResStatus rst[2]; + OmegaResMembraneStats ms[2]; + for (int sp = 0; sp < 2; sp++) { + const LorenzData *d = &D[sp]; + if (d->t[0] != 0.0 || d->t[d->n - 1u] != 40.0) t_ok = 0; + yeq[sp] = memcmp(yarch[sp], d->X, (size_t)d->n * 3u * sizeof(double)) == 0; + for (int c = 0; c < 3; c++) { + for (uint32_t j = 0; j < d->n; j++) cur[j] = lorenz_current(d, j, c); + uint32_t hint = 0; + for (uint32_t k = 0; k < KN; k++) { + double tk = (double)k / 10000.0, I = interp_col(d, cur, tk, &hint); + float f = (float)I; + tab[(size_t)k * L + inp[c]] = f; + double er = (double)f - I, ai = I < 0 ? -I : I; + if (er < 0) er = -er; + if (er > max_err[c]) max_err[c] = er; + if (ai > max_i[c]) max_i[c] = ai; + } + for (uint32_t j = 0; j < d->n; j++) { /* the Omega input at each data breakpoint */ + double x = d->t[j] * 10000.0; + uint32_t kk = (uint32_t)x; + if (kk >= KN - 1u) kk = KN - 2u; + double f = d->t[j] * 10000.0 - (double)kk; + double a = tab[(size_t)kk * L + inp[c]], b = tab[(size_t)(kk + 1u) * L + inp[c]]; + double er = (a + f * (b - a)) - cur[j]; + if (er < 0) er = -er; + if (er > max_err[c]) max_err[c] = er; + } + } + OmegaResInput in = {L, KN, tab}; + double *pos = malloc((size_t)nts[sp] * sizeof(double)); + V[sp] = malloc((size_t)nts[sp] * L * sizeof(double)); + T[sp] = malloc((size_t)nts[sp] * 3u * sizeof(double)); + if (!pos || !V[sp] || !T[sp]) return 2; + for (uint32_t k = 0; k < nts[sp]; k++) pos[k] = ts[sp][k] * 1e5; + omega_res_membrane_stats_init(&sim->mstats); + rst[sp] = omega_res_state_init(&sim->cfg, OMEGA_RES_INIT_CONST, 1.0f, &sim->s); + if (rst[sp] == OMEGA_RES_OK) rst[sp] = res_sim_at_positions(sim, &in, pos, nts[sp], last, V[sp]); + if (rst[sp] == OMEGA_RES_OK && sim->s.step < last) + rst[sp] = omega_res_advance_observed(&sim->cfg, &in, &sim->ws, &sim->s, last - sim->s.step, &sim->mstats); + if (rst[sp] == OMEGA_RES_OK) rst[sp] = omega_res_run_receipt(&sim->cfg, &in, &sim->s, &rc[sp]); + ms[sp] = sim->mstats; + for (int c = 0; c < 3; c++) { /* targets: interp1(t, X, timeSolution) */ + uint32_t hint = 0; + for (uint32_t k = 0; k < nts[sp]; k++) + T[sp][(size_t)k * 3u + c] = interp_col(d, d->X + (size_t)d->n * c, ts[sp][k], &hint); + } + for (uint32_t k = 0; k < nts[sp]; k++) V[sp][(size_t)k * L + g] = 0.0; /* ground pinned, as L:98 */ + free(pos); + for (uint32_t k = 0; k < KN; k++) + for (int c = 0; c < 3; c++) tab[(size_t)k * L + inp[c]] = 0.0f; + } + int all_pass = rst[0] == OMEGA_RES_OK && rst[1] == OMEGA_RES_OK && t_ok && yeq[0] && yeq[1]; + /* range scaling with training min/max (L:344-360) */ + double mn[64], rg[64]; + const uint32_t n0 = nts[0]; + for (uint32_t i = 0; i < L; i++) { + double lo = V[0][i], hi = V[0][i]; + for (uint32_t k = 1; k < n0; k++) { + double v = V[0][(size_t)k * L + i]; + if (v < lo) lo = v; + if (v > hi) hi = v; + } + mn[i] = lo; + rg[i] = hi - lo == 0.0 ? 1.0 : hi - lo; + } + for (int sp = 0; sp < 2; sp++) + for (size_t k = 0; k < (size_t)nts[sp] * L; k++) V[sp][k] = (V[sp][k] - mn[k % L]) / rg[k % L]; + /* lambda by 5-fold blocked CV over linspace(0.033, 0.035, 101) (L:121-123, 371-405) */ + static OmegaResReadoutWorkspace rws; + static OmegaResReadout ro; + double *xb = malloc((size_t)n0 * L * sizeof(double)), *yb = malloc((size_t)n0 * 3u * sizeof(double)); + double *pv = malloc((size_t)n0 * 3u * sizeof(double)); + if (!xb || !yb || !pv) return 2; + uint32_t edges[6]; + for (uint32_t k = 0; k <= 5; k++) edges[k] = (uint32_t)(((uint64_t)2 * k * n0 + 5u) / 10u); + double best = 1.0 / 0.0, best_l = 0.0; + int best_i = -1, cv_refusals = 0; + double t_cv0 = res_now_s(); + for (int li = 0; li <= 100 && rst[0] == OMEGA_RES_OK; li++) { + double lam = 0.033 + (double)li * ((0.035 - 0.033) / 100.0), score = 0.0; + int ok = 1; + for (uint32_t f = 0; f < 5 && ok; f++) { + uint32_t m = 0; + for (uint32_t k = 0; k < n0; k++) { + if (k >= edges[f] && k < edges[f + 1u]) continue; + memcpy(xb + (size_t)m * L, V[0] + (size_t)k * L, L * sizeof(double)); + memcpy(yb + (size_t)m * 3u, T[0] + (size_t)k * 3u, 3u * sizeof(double)); + m++; + } + if (omega_res_readout_fit(xb, yb, m, L, 3, lam, &rws, &ro) != OMEGA_RES_OK) { + ok = 0; + cv_refusals++; + break; + } + uint32_t nv = edges[f + 1u] - edges[f]; + for (uint32_t k = 0; k < nv; k++) + omega_res_readout_apply(&ro, V[0] + (size_t)(edges[f] + k) * L, pv + (size_t)k * 3u); + double s = 0.0; + for (int c = 0; c < 3; c++) s += res_nrmse(T[0] + (size_t)edges[f] * 3u + c, pv + c, nv, 3); + score += s / 3.0; + } + if (!ok) continue; + score /= 5.0; + if (score < best) { + best = score; + best_l = lam; + best_i = li; + } + } + double t_cv = res_now_s() - t_cv0; + st = best_i >= 0 ? omega_res_readout_fit(V[0], T[0], n0, L, 3, best_l, &rws, &ro) : OMEGA_RES_ERR_SINGULAR; + if (st != OMEGA_RES_OK) all_pass = 0; + + fprintf(o, "{\n \"schema\": \"omega-reservoir-g2/1\",\n \"case\": \"G2-L1\",\n \"nodes\": %d,\n", nodes); + fprintf(o, " \"negative_control\": %s,\n", control ? "\"NC-L: NARMA permittivity 8.85e-12\"" : "false"); + fprintf(o, " \"topology\": {\"edges\": %u, \"ground_1based\": %u, \"inputs_1based\": [%u, %u, %u]},\n", + topo.edge_count, g + 1u, inp[0] + 1u, inp[1] + 1u, inp[2] + 1u); + fprintf(o, " \"step_s\": %.9g, \"steps_per_knot\": %u, \"permittivity_f_per_m\": %.9g,\n", (double)STEP_S, + STEPS_PER_KNOT, (double)par.eps_f_per_m); + fprintf(o, " \"archive_checks\": {\"t_from_0_to_40\": %s, \"Ytrain_equals_LorenzData1_X\": %s, " + "\"Ytest_equals_LorenzData2_X\": %s, \"figure_nrmse_equals_nrmse_file\": %s},\n", + t_ok ? "true" : "false", yeq[0] ? "true" : "false", yeq[1] ? "true" : "false", + memcmp(nref[0], nref2[0], 24) == 0 && memcmp(nref[1], nref2[1], 24) == 0 ? "true" : "false"); + fprintf(o, " \"inputs\": {\"knots\": %u, \"knot_spacing_s\": 1e-4, \"resampling_and_rounding_max_abs_a\": [", KN); + for (int c = 0; c < 3; c++) { + fputs(c ? ", " : "", o); + jd(o, max_err[c]); + } + fputs("], \"relative_to_max_abs_current\": [", o); + for (int c = 0; c < 3; c++) { + fputs(c ? ", " : "", o); + jd(o, max_err[c] / max_i[c]); + } + fputs("]},\n \"runs\": [", o); + receipt_json(o, "train", rst[0], &rc[0], &ms[0]); + fputs(", ", o); + receipt_json(o, "test", rst[1], &rc[1], &ms[1]); + fprintf(o, "],\n \"samples\": [%u, %u],\n \"cv\": {\"grid\": \"linspace(0.033, 0.035, 101)\", \"folds\": 5, " + "\"chosen_lambda\": ", nts[0], nts[1]); + jd(o, best_l); + fprintf(o, ", \"chosen_index\": %d, \"score\": ", best_i); + jd(o, best); + fprintf(o, ", \"refusals\": %d, \"seconds\": %.1f},\n \"final_fit_status\": \"%s\",\n", cv_refusals, t_cv, + res_status_name(st)); + fprintf(o, " \"tolerances\": {\"prediction_rms_over_target_std\": %g, \"nrmse_abs\": %g, \"nrmse_rel\": %g, " + "\"metric_recompute_rel\": %g},\n", + TOL_PRED_REL, TOL_NRMSE_ABS, TOL_NRMSE_REL, TOL_METRIC_REL); + fputs(" \"splits\": [", o); + static const char *vn[3] = {"x", "y", "z"}; + for (int sp = 0; sp < 2; sp++) { + double *P = malloc((size_t)nts[sp] * 3u * sizeof(double)); + if (!P) return 2; + for (uint32_t k = 0; k < nts[sp]; k++) { + if (st != OMEGA_RES_OK || + omega_res_readout_apply(&ro, V[sp] + (size_t)k * L, P + (size_t)k * 3u) != OMEGA_RES_OK) + P[k * 3u] = P[k * 3u + 1u] = P[k * 3u + 2u] = 0.0 / 0.0; + } + fprintf(o, "%s\n {\"split\": \"%s\", \"variables\": [", sp ? "," : "", sp ? "test" : "train"); + for (int c = 0; c < 3; c++) { + double *pac = malloc((size_t)nts[sp] * 3u * sizeof(double)); + if (!pac) return 2; + for (uint32_t k = 0; k < nts[sp]; k++) pac[(size_t)k * 3u + c] = pa[sp][c][k]; + double sd = res_std_pop(T[sp] + c, nts[sp], 3), prel = res_rms_diff(P + c, pac + c, nts[sp], 3) / sd; + double nr = res_nrmse(T[sp] + c, P + c, nts[sp], 3), narch = res_nrmse(T[sp] + c, pac + c, nts[sp], 3); + int b = prel <= TOL_PRED_REL, cc = nrmse_ok(nr, nref[sp][c]), pm = rel_ok(narch, nref[sp][c], TOL_METRIC_REL); + all_pass &= b && cc && pm; + fprintf(o, "%s{\"var\": \"%s\", \"prediction_rms_diff_over_target_std\": ", c ? ", " : "", vn[c]); + jd(o, prel); + fputs(", \"nrmse_omega\": ", o); + jd(o, nr); + fputs(", \"nrmse_reference\": ", o); + jd(o, nref[sp][c]); + fputs(", \"nrmse_recomputed_from_archived_predictions\": ", o); + jd(o, narch); + fprintf(o, ", \"b\": %s, \"c\": %s, \"metric_control\": %s}", b ? "true" : "false", cc ? "true" : "false", + pm ? "true" : "false"); + free(pac); + } + fputs("]}", o); + free(P); + } + fprintf(o, "\n ],\n \"verdict\": \"%s\"\n}\n", all_pass ? "PASS" : "FAIL"); + return all_pass ? 0 : 1; +} + +/* -------------------------------------------------------------- config */ + +static int cmd_config(FILE *o) +{ + fprintf(o, "{\n \"schema\": \"omega-reservoir-gate2-config/1\",\n" + " \"doc\": \"docs/reservoir/RESERVOIR_REFERENCE.md sections 7, 7.1, 10, 10.1, 12\",\n" + " \"reference_record\": \"10.5281/zenodo.17296788\",\n" + " \"reference_zip_sha256\": \"54582293dff8e9327b9187d3e5526b0e0cdcc41ca7ac87c762850bdb342dea15\",\n" + " \"simulator\": {\"step_s\": %.9g, \"steps_per_knot\": %u, \"numeric_policy\": ", + (double)STEP_S, STEPS_PER_KNOT); + res_json_str(o, OMEGA_RES_NUMERIC_POLICY); + fprintf(o, ", \"refused_membrane_abs_v_above\": %.9g, \"implausible_membrane_abs_v_above\": %.9g, " + "\"node_voltage_bound\": \"finite only\"", + (double)OMEGA_RES_VM_LIMIT, (double)OMEGA_RES_VM_PLAUSIBLE); + fprintf(o, "},\n \"g2_narma\": {\"grid_cell\": {\"nodes\": 5, \"current_hi_a\": 1e-10, \"mask_length\": 2}, " + "\"variants\": [\"N1a\", \"N1b\", \"N1b-v2\"], \"v2_results_sha256\": \"317af7a76051e6c30aa0476a612c29e417b199c9ef226f4f00d7f7505512fc92\", \"negative_control\": \"NC-N\", \"fit_rows_1based\": [100, 995], " + "\"orders\": [2, 10]},\n"); + fprintf(o, " \"g2_lorenz\": {\"nodes\": [13, 25, 43], \"negative_control\": \"NC-L (13 nodes)\", " + "\"knots\": 400001, \"lambda_grid\": \"linspace(0.033, 0.035, 101)\", \"folds\": 5},\n"); + fprintf(o, " \"tolerances\": {\"target_max_abs\": %g, \"prediction_rms_over_target_std\": %g, \"nrmse_abs\": %g, " + "\"nrmse_rel\": %g, \"metric_recompute_rel\": %g},\n", + TOL_TARGET_ABS, TOL_PRED_REL, TOL_NRMSE_ABS, TOL_NRMSE_REL, TOL_METRIC_REL); + fprintf(o, " \"benchmark\": {\"seeds\": [1, 2, 3, 4, 5], \"generator\": \"splitmix64\", " + "\"lambda_grid\": [1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1, 10, 100], \"folds\": 5,\n" + " \"narma\": {\"orders\": [2, 5, 10], \"train\": 2000, \"test\": 1000, \"washout\": 100, " + "\"mask_length\": 3, \"current_hi_a\": 1e-10, \"networks\": [\"Length50 chain (declared)\", \"Length5 chain (post hoc, section 10.1)\"], \"delay_line\": 12},\n" + " \"lorenz\": {\"dt\": 1e-4, \"transient_s\": 20, \"record_s\": 20, \"sample_s\": 0.01, " + "\"washout_samples\": 200, \"rows\": [200, 1975], \"horizons_samples\": [0, 1, 25], " + "\"network\": \"hex43\", \"delay_line\": 5}},\n"); + fprintf(o, " \"performance\": {\"warmup_steps\": 10000, \"timed_steps\": 40000, \"repetitions\": 5, " + "\"networks\": [\"chain5 NARMA\", \"chain50 NARMA\", \"hex43 Lorenz\"]},\n" + " \"energy\": \"NOT_RUN (not instrumented)\"\n}\n"); + return 0; +} + +static int usage(void) +{ + fprintf(stderr, "usage: res_qualify pins|g2-narma|g2-lorenz|bench-narma|bench-lorenz|perf|config ...\n"); + return 2; +} + +int main(int argc, char **argv) +{ + if (argc < 2) return usage(); + const char *c = argv[1]; + if (!strcmp(c, "pins") && argc == 3) return cmd_pins(argv[2], stdout); + if (!strcmp(c, "g2-narma") && (argc == 4 || argc == 5)) + return cmd_g2_narma(argv[2], argv[3], argc == 5 ? argv[4] : NULL, stdout); + if (!strcmp(c, "g2-lorenz") && (argc == 4 || argc == 5)) { + int n = atoi(argv[3]); + if (n != 13 && n != 25 && n != 43) return usage(); + if (argc == 5 && strcmp(argv[4], "NC-L")) return usage(); + return cmd_g2_lorenz(argv[2], n, argc == 5, stdout); + } + if (!strcmp(c, "bench-narma")) return res_bench_narma(argc - 2, argv + 2, stdout); + if (!strcmp(c, "bench-lorenz")) return res_bench_lorenz(argc - 2, argv + 2, stdout); + if (!strcmp(c, "perf") && argc == 2) return res_perf(stdout); + if (!strcmp(c, "config") && argc == 2) return cmd_config(stdout); + return usage(); +}