Skip to content

Remove dead normalization machinery left by the orthonormal refactor - #31

Merged
subhk merged 1 commit into
mainfrom
fix/normalization-convention-and-correctness-audit
Aug 9, 2026
Merged

Remove dead normalization machinery left by the orthonormal refactor#31
subhk merged 1 commit into
mainfrom
fix/normalization-convention-and-correctness-audit

Conversation

@subhk

@subhk subhk commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Follow-up to #29, which merged before this landed.

With no code path converting normalization any more, several helpers and struct fields became unreachable:

  • SHTPlan.norm_tmp1 / norm_tmp2 — two (lmax+1)×(mmax+1) ComplexF64 buffers allocated per plan that nothing reads
  • DistTransposePlan.need_norm / Mloc / alm_scratch, plus _scale_alm_to_internal! and _scale_alm_to_cfg!need_norm was hardcoded false, so the whole machinery was inert
  • _scale_cotangent — in both AD extensions, no call sites left

The DistTransposePlan docstring still listed the removed fields and declared that "coefficients crossing this plan's API are in cfg's convention" — the opposite of what the code does. Rewritten to state the orthonormal contract.

Verification

Serial 67278/67278; 8 MPI suites at 4 ranks; 56 custom assertions at 8 ranks. Cross-API equality unchanged at machine precision, and still identical across :orthonormal / :schmidt / :fourpi:

Check Value
QST roundtrip 1.2e-15
SHTPlan sphtor == non-plan 4.4e-16
SHqst_to_point == its grid 2.2e-16
packed_cplx == dense synthesis 0.0e+00

⚠️ Review gap worth knowing about

The adversarial review I ran against #29's final commit (f19a2bcb, a 241-line bulk-regex deletion) did not actually complete — 4 of its 5 agents died on an API session limit, so it produced zero candidates and reported "no findings" vacuously. That commit merged without an independent review pass.

That matters because one regex in that commit had already silently deleted live code (analysis_qst lost its transform calls; caught only by an UndefVarError in the suite). The test suite is green and I checked the obvious failure modes by hand, but a proper review of f19a2bcb is still owed.

🤖 Generated with Claude Code

With no path converting normalization any more, several helpers and struct
fields became unreachable:

  SHTPlan.norm_tmp1 / norm_tmp2  -- two (lmax+1)x(mmax+1) ComplexF64 buffers
                                    allocated per plan that nothing reads
  DistTransposePlan.need_norm / Mloc / alm_scratch, plus _scale_alm_to_internal!
                                    and _scale_alm_to_cfg! -- need_norm was
                                    hardcoded false, so the machinery was inert
  _scale_cotangent               -- in BOTH AD extensions, no call sites left

The DistTransposePlan docstring still described the removed fields and declared
that "coefficients crossing this plan's API are in cfg's convention", which had
become the opposite of what the code does. Rewritten to state the orthonormal
contract.

Serial 67278/67278; 8 MPI suites at 4 ranks; 56 custom assertions at 8 ranks;
cross-API equality unchanged at machine precision.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
ext/ParallelTransposeTransforms.jl 0.00% <ø> (ø)
ext/SHTnsKitAdvancedADExt.jl 20.70% <ø> (+0.30%) ⬆️
ext/SHTnsKitParallelADExt.jl 0.00% <ø> (ø)
src/plan.jl 86.83% <ø> (-0.11%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@subhk
subhk merged commit db13d57 into main Aug 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant