Commit 3533027
Add ChainRulesCore support for SCCNonlinearProblem (#757)
This enables automatic differentiation through SCCNonlinearProblem solves
by adding a ChainRulesCore extension that hooks into SciMLSensitivity's
adjoint machinery.
Changes:
- Add `scc_solve_up` internal function that can be hooked by ChainRulesCore
- Route public `solve` through `scc_solve_up` → `_scc_solve`
- Add ChainRulesCore weak dependency and extension
- Extension defines rrule for `scc_solve_up` that calls `_concrete_solve_adjoint`
This is needed to fix zero gradients when differentiating through MTK v10
initialization which uses SCCNonlinearProblem.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: ChrisRackauckas <[email protected]>
Co-authored-by: Claude <[email protected]>1 parent 517270a commit 3533027
File tree
3 files changed
+52
-5
lines changed- lib/SCCNonlinearSolve
- ext
- src
3 files changed
+52
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| |||
60 | 77 | | |
61 | 78 | | |
62 | 79 | | |
63 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
64 | 85 | | |
65 | 86 | | |
66 | 87 | | |
| |||
79 | 100 | | |
80 | 101 | | |
81 | 102 | | |
| 103 | + | |
| 104 | + | |
82 | 105 | | |
0 commit comments