Skip to content

Commit b74d6da

Browse files
Merge pull request #820 from SciML/os/split-W_prototype-improvements
SplitFunction W_prototype fixes
2 parents c214b16 + 480c1d8 commit b74d6da

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/scimlfunctions.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ SplitFunction{iip,specialize}(f1,f2;
455455
jvp = __has_jvp(f1) ? f1.jvp : nothing,
456456
vjp = __has_vjp(f1) ? f1.vjp : nothing,
457457
jac_prototype = __has_jac_prototype(f1) ? f1.jac_prototype : nothing,
458+
W_prototype = __has_W_prototype(f1) ? f1.W_prototype : nothing,
458459
sparsity = __has_sparsity(f1) ? f1.sparsity : jac_prototype,
459460
paramjac = __has_paramjac(f1) ? f1.paramjac : nothing,
460461
colorvec = __has_colorvec(f1) ? f1.colorvec : nothing,
@@ -484,6 +485,11 @@ the usage of the `SplitFunction`. These include:
484485
as the prototype and integrators will specialize on this structure where possible. Non-structured
485486
sparsity patterns should use a `SparseMatrixCSC` with a correct sparsity pattern for the Jacobian.
486487
The default is `nothing`, which means a dense Jacobian.
488+
- `W_prototype`: a prototype matrix matching the type that matches the W matrix. For example,
489+
if the Jacobian is tridiagonal, and the mass_matrix is diagonal, then an appropriately sized `Tridiagonal`
490+
matrix can be used as the prototype and integrators will specialize on this structure where possible. Non-structured
491+
sparsity patterns should use a `SparseMatrixCSC` with a correct sparsity pattern for the W matrix.
492+
The default is `nothing`, which means a W of appropriate type for the jacobian and linear solver
487493
- `paramjac(pJ,u,p,t)`: returns the parameter Jacobian ``\frac{df_1}{dp}``.
488494
- `colorvec`: a color vector according to the SparseDiffTools.jl definition for the sparsity
489495
pattern of the `jac_prototype`. This specializes the Jacobian construction when using
@@ -3080,7 +3086,7 @@ SDEFunction(f::SDEFunction; kwargs...) = f
30803086

30813087
@add_kwonly function SplitSDEFunction(f1, f2, g, mass_matrix, cache, analytic, tgrad, jac,
30823088
jvp, vjp,
3083-
jac_prototype, Wfact, Wfact_t, paramjac, observed,
3089+
jac_prototype, W_prototype, Wfact, Wfact_t, paramjac, observed,
30843090
colorvec, sys)
30853091
f1 = f1 isa AbstractSciMLOperator ? f1 : SDEFunction(f1)
30863092
f2 = SDEFunction(f2)
@@ -3091,7 +3097,7 @@ SDEFunction(f::SDEFunction; kwargs...) = f
30913097
typeof(Wfact), typeof(Wfact_t), typeof(paramjac), typeof(observed),
30923098
typeof(colorvec),
30933099
typeof(sys)}(f1, f2, mass_matrix, cache, analytic, tgrad, jac,
3094-
jac_prototype, Wfact, Wfact_t, paramjac, observed, colorvec, sys)
3100+
jac_prototype, W_prototype, Wfact, Wfact_t, paramjac, observed, colorvec, sys)
30953101
end
30963102

30973103
function SplitSDEFunction{iip, specialize}(f1, f2, g;

0 commit comments

Comments
 (0)