Commit 11589a2
committed
Wrap Jacobian with both dense and sparse FunctionWrapper signatures
When an ODEFunction has a sparse sparsity pattern but no jac_prototype,
the solver's build_J_W may create a SparseMatrixCSC J from the sparsity
pattern (when using AutoSparse). The previous code only wrapped the
Jacobian with a dense Matrix{Float64} signature, causing "No matching
function wrapper was found!" at solve time.
Now detects non-dense sparsity patterns and creates a FunctionWrappersWrapper
with both dense and sparse matrix signatures so the Jacobian call works
regardless of which matrix type the solver allocates.
Uses Base.promote_op to compute the sparse matrix type without allocating.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>1 parent 92bfd6b commit 11589a2
1 file changed
+25
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
814 | 817 | | |
815 | 818 | | |
816 | | - | |
817 | | - | |
818 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
819 | 840 | | |
820 | 841 | | |
821 | 842 | | |
| |||
0 commit comments