Skip to content

Add ForwardDiff regression test for invquad/quad (issue #99)#240

Open
devmotion wants to merge 1 commit into
masterfrom
dmw/invquad-ad-test
Open

Add ForwardDiff regression test for invquad/quad (issue #99)#240
devmotion wants to merge 1 commit into
masterfrom
dmw/invquad-ad-test

Conversation

@devmotion

Copy link
Copy Markdown
Member

Adds a regression test for the invquad/quad performance regression reported in #99.

The regression (accessing M.chol.L/.U, which copies the Cholesky factor, O(n²)) was fixed by switching to the lazy chol_lower/chol_upper factors. This test pins both halves of that fix:

  • Correctness of the partials∇ invquad(A, x) = 2 A⁻¹x and ∇ quad(A, x) = 2 A x via ForwardDiff.gradient.
  • Allocation — with a Dual{p} input the work stays O(n·#partials) (a single result vector), rather than copying/promoting the factor to Dual (O(n²·#partials)).

🤖 Generated with Claude Code

Pins both halves of the fix for the invquad/quad performance regression
reported in #99: the partials are differentiated
correctly, and the allocation stays O(n * #partials) instead of copying or
promoting the Cholesky factor to `Dual` (which was O(n^2 * #partials)).

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

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.84%. Comparing base (6371e0c) to head (12ca102).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #240      +/-   ##
==========================================
+ Coverage   94.78%   94.84%   +0.05%     
==========================================
  Files          11       11              
  Lines         805      814       +9     
==========================================
+ Hits          763      772       +9     
  Misses         42       42              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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