Skip to content

Floor serialized variances at compute boundaries - #72

Merged
lenzo-ka merged 1 commit into
masterfrom
kal-variance-floor-consumers
Aug 17, 2026
Merged

lenzo-ka merged 1 commit into
masterfrom
kal-variance-floor-consumers

Conversation

@lenzo-ka

Copy link
Copy Markdown
Contributor

Defect

One-pass float32 variance estimates can serialize as zero or slightly negative. Direct serialized-array readers bypass the positive variance invariant established by gauden_t model loading, so KD-tree geometry, density splitting, MAP priors, and MMIE updates can produce non-finite results.

Fix

Add shared diagonal and full-covariance array floor helpers and apply them after affected computational reads. map_adapt honors -varfloor; other consumers use the existing 1e-4 evaluation floor. Raw serialized artifacts and copy/passthrough paths remain lossless. Add a CTest regression.

libclust/kdtree.c remains unchanged because its caller now establishes the invariant before log() and sqrt() computations.

Reader audit

Routed: inc_comp, kdtree, map_adapt, and MMIE norm.

Already protected locally: libmodinv/mod_inv.c, mllr_solve, bldtree, and make_quests.

Display/copy/initialization/template reads left lossless: printp, cp_parm, init_mixw, and the other norm rereads. The remaining mllr_transform and init_gau sites read means.

Verification

  • cmake -S . -B build
  • cmake --build build
  • ctest --test-dir build --output-on-failure (1/1 passed)

This ports the landed boundary and consumer routing from pstrain PR #134.

@lenzo-ka
lenzo-ka merged commit 1683f0f into master Aug 17, 2026
8 checks passed
@lenzo-ka
lenzo-ka deleted the kal-variance-floor-consumers branch August 17, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant