Skip to content

test: enable the value check on the symmetric weak Hessian - #21

Merged
wardjm merged 1 commit into
mainfrom
hessian-sym-weak-value-check
Jul 11, 2026
Merged

wardjm merged 1 commit into
mainfrom
hessian-sym-weak-value-check

Conversation

@wardjm

@wardjm wardjm commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Closes #13.

hessian_02_sym_weak was the one weak-operator builder whose values nothing verified — upstream's test_hessian_02_sym_weak_matrix assembles a manual expectation and then comments out the assertion against it (NOTE: Disabling strict value check), and the port reproduced that shape-only test as-is.

What turned out to be wrong

The builder is correct; the expectation it was being compared against is not. The symmetric basis element for j₁ ≠ j₂ is dx_{j₁} ⊗ dx_{j₂} + dx_{j₂} ⊗ dx_{j₁}, so pairing the (symmetric) Hessian against it picks up both entries — that is the ×2 hessian_02_sym_weak applies to off-diagonal rows and that upstream's manual assembly omits. gamma_02_sym carries the matching per-index ×2 on its rows and columns, so the operator and the Gram agree. Comparing the builder against an expectation missing the factor fails on exactly the off-diagonal rows, so the assertion was disabled rather than the expectation fixed.

What this PR does

  • Enables the check in test/test_pysrc.jl → hessian → hessian_02_sym_weak matrix, with the multiplicity factor restored. Passes at d = 1..4.
  • Adds a second, port-original test that pins the convention without reference to the symmetric basis: expanding the strong symmetric coefficients into the full (0,2) basis and pairing them with the full Gram must reproduce hessian_02_weak, whose ⟨H(φ_I), φ_i dx_j ⊗ dx_k⟩ entries involve no basis choice at all. Without it, the first test only re-encodes the builder's own weight rule; with it, deleting the ×2 from the builder fails both tests.
  • Catalogues the defect as §5 of docs/upstream-bugs.md, marked as a test defect (shipped code right, coverage absent) with no parity fixture to guard it — unlike the other four entries.

Worth upstreaming to the Python suite as a follow-up.

Full suite: 2389 passing.

Upstream's test_hessian_02_sym_weak_matrix builds a manual expectation and
then comments out the assertion against it ("NOTE: Disabling strict value
check"), leaving hessian_02_sym_weak as the one weak-operator builder whose
values nothing verifies on either side of the port.

The builder is right and the expectation is wrong: the symmetric basis element
for j1 != j2 is dx_j1 (x) dx_j2 + dx_j2 (x) dx_j1, so pairing the symmetric
Hessian against it picks up both entries, which is the x2 the builder applies
and upstream's manual assembly omits. gamma_02_sym carries the matching
weighting, so the two conventions agree.

Enable the check with the factor restored, and pin the convention itself with
a second, port-added test that routes through the full (0,2) basis, where no
symmetric-basis choice enters: expanding the strong symmetric coefficients and
pairing them with the full Gram reproduces hessian_02_weak. Both pass at
d = 1..4. Catalogued as upstream bug 5.

Closes #13
@wardjm
wardjm merged commit 9d0acc9 into main Jul 11, 2026
2 checks passed
@wardjm
wardjm deleted the hessian-sym-weak-value-check branch July 15, 2026 16:52
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.

The symmetric Hessian weak matrix has no value check on either side of the port

1 participant