Skip to content

test(applied): value-pin mat_f64::determinant at n = 0..4; CI f64-rig lane (#296) - #366

Merged
tsondru merged 3 commits into
mainfrom
audit/G3-T4
Aug 26, 2026
Merged

test(applied): value-pin mat_f64::determinant at n = 0..4; CI f64-rig lane (#296)#366
tsondru merged 3 commits into
mainfrom
audit/G3-T4

Conversation

@tsondru

@tsondru tsondru commented Aug 26, 2026

Copy link
Copy Markdown
Member

Closes #296. Taskmap G3-T4 — closes G3.

Measured at 625ecb1: determinant returning constant Some(1.0) passed 45/45 applied test binaries (--features f64-rig --no-fail-fast); tests/mat_f64.rs 8/8 green. No CI lane compiles tests/mat_f64.rs (rg 'f64-rig' .github/workflows/ empty).

Shipped (production diff 0 lines; src/mat_f64.rs change is rustdoc only):

  • tests/mat_f64.rs: check_determinants helper (collects every mismatch, reports measured values) + #[should_panic] self-test; value pins at n = 0 (→1), 1 (7, −7), 2 (6, 0, −1), 3 (58, −1), 4 (4, −1, 0). Expected values hand-derived before running; the reviewer re-derived all independently (block-diag measured 4.000000000000011, LU error 1.1e-14).
  • src/mat_f64.rs, examples/mat_operations.rs: every "LU" attribution deleted — nalgebra 0.35 determinant is closed-form for n ≤ 3 and try_inverse for n ≤ 4 (src/linalg/{determinant,inverse}.rs); rg LU over both files is empty.
  • ci.yml: cargo test -p catgraph-applied --features f64-rig + clippy --all-targets -D warnings. Unscoped, matching the serde lane at :122 (226 lib + 448 integration + 7 doc tests).
  • CHANGELOG bullet.

Falsification (--test mat_f64, 13 tests):

perturbation red message values
Some(1.0) 1x1_and_3x3, 2x2, 4x4 7→1, 58→1, 6→1, 0→1, 4→1, −1→1, 0→1
Some(det.abs()) 1x1_and_3x3, 2x2, 4x4 −7→7, −1→1 (I₃), −1→1 (2×2), −1→1 (I₄)
product of diagonal 1x1_and_3x3, 2x2, 4x4 58→18, 0→4, 4→160, −1→0
Some(-det) all five value tests + identity 1→−1, 7→−7, 58→−58, 6→−6, 4→−4, −1→1
guard !=== all five + non_square None on every square fixture
helper assert! dropped check_determinants_reports_a_mismatch "did not panic"
Some(f64::NAN) all five value tests + identity + self-test every fixture "measured NaN" (before 683e1cc the four check_determinants tests were green; only the identity pin and the self-test caught it)

Nulls: transpose-then-det (det Aᵀ = det A); tolerance >=> (no fixture on the boundary); row1 = 2·row0 under abs() and diagonal-product (0 → 0); determinant_0x0_is_1 under constant-1 and diagonal-product (empty product = 1). Pre-existing determinant_of_identity_is_1 is green under constant, abs, and diagonal-product — the hole this closes.

Reviews: r1 executing adversarial (0 blocking / 3 important / 6 minor) → r2 executing delta on the applied edits (2 important / 1 minor: NaN-unsafe predicate, a surviving LU gloss on the inverse) → r3 executing on the fix commit 683e1cc (0/0/3 minor). All findings applied except one note-only item: the should_panic substring measured 7 would also accept 7.5; the fixture is an exact 1×1, so no reachable value does.

Out of scope, recorded: examples/mat_operations.rs is self-checking (asserts det 58) but never run in CI — its later sections exceed 600 s in debug; try_inverse already has a value oracle (inverse_matmul_original_is_identity), not widened; #269 sequenced behind this PR.

🤖 Generated with Claude Code

tsondru and others added 3 commits August 26, 2026 15:41
… lane (#296)

Closes #296.

A constant `Some(1.0)` passed every applied test binary at 625ecb1 (45/45).
Pins now cover nalgebra's closed-form arms (n = 0, 1, 2, 3) and the LU arm
(n = 4), each with a sign fixture, plus singular and block-diagonal cases;
a `#[should_panic]` self-test pins the mismatch helper. The rustdoc and
`examples/mat_operations.rs` lose the "via LU decomposition" claim, which
nalgebra 0.35 does not satisfy below n = 4. CI gains the `f64-rig` test +
clippy lane; `tests/mat_f64.rs` compiled to nothing in every existing lane.

Production diff: 0 lines (rustdoc only in src/).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rse's LU gloss (#296)

Delta-review findings: `(det - expected).abs() >= 1e-12` is false for NaN,
so a NaN determinant passed every value pin (measured: 4/4 green); the
predicate now records `diff.is_nan() || diff >= 1e-12` (NaN → 6/13 red).
`examples/mat_operations.rs` still attributed the 3×3 inverse's error to LU;
nalgebra 0.35 inverts n ≤ 4 in closed form. `should_panic` substring narrowed
to the mismatch clause.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tsondru
tsondru merged commit d7fc283 into main Aug 26, 2026
9 checks passed
@tsondru
tsondru deleted the audit/G3-T4 branch August 26, 2026 21:55
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.

applied: mat_f64 determinant value-pinned only at det(I)=1 — a constant Some(1.0) passes

1 participant