You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
numpy_impl share_comps applies a shared column's A-update twice #242
Found during the #241 review. Distinct from #240 (NaN mu/beta), same area: numpy_impl's share_comps path is structurally further from Fortran than the nd ordering issue #219 addressed.
Fortran
A single dAk is built as a gm-weighted average across contributing models, divided by zeta = sum_h gm[h], then applied once (amica15.f90:1749-1761 build, DAXPY at :1807/:1814). A column shared by two models receives one averaged update.
numpy_impl
The A-update is a separate per-model loop (numpy_impl/core.py:1377-1381):
No gm weighting, no zeta division, and no A-freeze guard — grep finds no _a_frozen equivalent in the file. identify_shared_components (numpy_impl/utils.py:103-166) genuinely can place one column index in comp_list[:, h] for two different h, so that column is updated twice in sequence, the second time against an already-updated self.A.
That is a different operation from Fortran's single weighted average, not a rounding difference.
Contrast with the PyTorch backend
AMICATorchNG builds the gm-weighted dAk, divides by zeta, applies it once, and freezes A for ~6 iterations after a merge (issue #60). The two backends therefore do not implement the same algorithm under share_comps.
Scope
Default (disjoint comp_list) is unaffected: each column belongs to one model, so the loop applies exactly one update and there is nothing to average.
Only reachable with share_comps=Trueand an actual merge.
Work
Port the gm-weighted single-application A-update to numpy_impl, matching Fortran and the PyTorch backend
Port the post-merge A-freeze, or state why it is unnecessary here
Cross-backend test that a shared column receives the same update in both (.rules/backend_parity.md)
Related: #240 (NaN mixture parameters on the same path), #219 (the nd ordering, fixed in #241). Part of #231.
Activity
Fix numpy_impl share_comps A-update and NaN mixture parameters (#257)