Commit ace82be
Fix resize, algorithm-switch, and OOP W-caching for Jacobian reuse
Three robustness fixes for Rosenbrock-W Jacobian reuse:
1. Resize detection: Track last_u_length in JacReuseState. After a
callback resize!, u_modified is cleared before perform_step! runs,
so we check length(u) directly to detect dimension changes.
2. CompositeAlgorithm switch detection: Track last_step_iter to detect
gaps in integrator.iter, which indicate another algorithm (e.g.,
Vern8) ran between Rosenbrock steps. Forces J recomputation on
switch-back to avoid using a stale Jacobian.
3. OOP W caching: Honor the new_W=false flag by caching and reusing
the factorized W (LU), matching IIP behavior. Previously the OOP
path always rebuilt W from stale J, which masked inaccuracy and
prevented the self-correcting rejection feedback loop. This fixes
AutoVern8(Rosenbrock23()) OOP hitting MaxIters on stiff problems.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ef15360 commit ace82be
File tree
3 files changed
+50
-9
lines changed- lib
- OrdinaryDiffEqDifferentiation/src
- OrdinaryDiffEqRosenbrock
- src
- test
3 files changed
+50
-9
lines changedLines changed: 43 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
71 | 86 | | |
72 | 87 | | |
73 | 88 | | |
| |||
792 | 807 | | |
793 | 808 | | |
794 | 809 | | |
795 | | - | |
796 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
797 | 816 | | |
798 | 817 | | |
799 | 818 | | |
| |||
829 | 848 | | |
830 | 849 | | |
831 | 850 | | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
832 | 854 | | |
833 | 855 | | |
834 | 856 | | |
| |||
841 | 863 | | |
842 | 864 | | |
843 | 865 | | |
844 | | - | |
| 866 | + | |
845 | 867 | | |
846 | 868 | | |
847 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
848 | 874 | | |
849 | 875 | | |
850 | 876 | | |
| |||
864 | 890 | | |
865 | 891 | | |
866 | 892 | | |
| 893 | + | |
867 | 894 | | |
868 | 895 | | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
873 | 909 | | |
874 | | - | |
875 | 910 | | |
876 | 911 | | |
877 | 912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
0 commit comments