core/core-rs/src
Shay 82b031d158 perf(adr-0244): D2 mechanical sympathy — Rust f64 GP fast-path + eigh memoization
Cohesion directive Mandates 1+2 (ADR-0244 §2.6 / §2.8).

Mandate 1 — Rust f64 geometric_product fast-path:
- core-rs/src/lib.rs: export a geometric_product_f64 PyO3 wrapper (mirrors the
  f32 one; delegates to cl41::geometric_product_f64, itself a term-for-term
  mirror of the pure-Python f64 kernel — same i-major scatter order, no FMA).
- algebra/backend.py: f64 branch in geometric_product, gated on CORE_BACKEND=rust
  + core_rs present (default stays pure-Python; older builds fall through on
  AttributeError). The directive's f32 gate was already built; the real gap was f64.
- Contract is BIT-IDENTICAL, not tol-matched: a 1-ULP divergence would move the
  f64 wave-field residual bytes and break I-02 replay under CORE_BACKEND=rust.
  Verified: test_geometric_product_f64_parity N=10000 Rust-vs-Python bit-for-bit
  + CORE_BACKEND=rust subprocess hex match (core_rs built).
- Measured M1 speedup (sixth acceptance criterion): dense f64 GP ~120x
  (Rust 4.3 us/call vs Python 520 us/call) with parity holding.

Mandate 2 — eigh memoization:
- cognitive_lifecycle.py: relax_to_ground's dense-branch np.linalg.eigh routed
  through _cached_eigh (functools.lru_cache, keyed on the frozen hamiltonian_id +
  matrix bytes), returning frozen read-only (evals, evecs) so a cache hit can
  never be mutated — every hit is bit-identical. The diagonal (propositional)
  fast path is untouched.

tests: test_adr_0244_mechanical_sympathy pins cached-eigh == fresh eigh,
read-only arrays, hit-returns-identical-objects, and relaxation determinism
through the cache; D9 extended with the N=10000 bit-identity gate and its
now-stale "f64 is Python-only" pins updated.

[Verification]: D9 22 passed (incl. bit-identity N=10000, core_rs built) +
mechanical-sympathy + cognitive_lifecycle green; smoke + fast lane below.
2026-07-17 13:58:17 -07:00
..
cga.rs fix(core): lock python and extend rust cga surface (#925) 2026-07-02 15:32:08 -07:00
cl41.rs chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
diffusion.rs chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
lib.rs perf(adr-0244): D2 mechanical sympathy — Rust f64 GP fast-path + eigh memoization 2026-07-17 13:58:17 -07:00
vault.rs chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00
versor.rs chore: Refactor CLI and Governance Anchors (#926) 2026-07-03 12:34:56 -07:00