Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initializeprob to splitfunction #737

Merged
merged 5 commits into from
Jul 21, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions src/scimlfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ information on generating the SplitFunction from this symbolic engine.
struct SplitFunction{
iip, specialize, F1, F2, TMM, C, Ta, Tt, TJ, JVP, VJP, JP, SP, TW, TWt,
TPJ, O,
TCV, SYS} <: AbstractODEFunction{iip}
TCV, SYS, IProb, IProbMap} <: AbstractODEFunction{iip}
f1::F1
f2::F2
mass_matrix::TMM
Expand All @@ -536,6 +536,8 @@ struct SplitFunction{
observed::O
colorvec::TCV
sys::SYS
initializeprob::IProb
initializeprobmap::IProbMap
end

@doc doc"""
Expand Down Expand Up @@ -2599,7 +2601,7 @@ end

@add_kwonly function SplitFunction(f1, f2, mass_matrix, cache, analytic, tgrad, jac, jvp,
vjp, jac_prototype, sparsity, Wfact, Wfact_t, paramjac,
observed, colorvec, sys)
observed, colorvec, sys, initializeprob, initializeprobmap)
f1 = ODEFunction(f1)
f2 = ODEFunction(f2)

Expand All @@ -2613,8 +2615,10 @@ end
typeof(cache), typeof(analytic), typeof(tgrad), typeof(jac), typeof(jvp),
typeof(vjp), typeof(jac_prototype), typeof(sparsity),
typeof(Wfact), typeof(Wfact_t), typeof(paramjac), typeof(observed), typeof(colorvec),
typeof(sys)}(f1, f2, mass_matrix, cache, analytic, tgrad, jac, jvp, vjp,
jac_prototype, sparsity, Wfact, Wfact_t, paramjac, observed, colorvec, sys)
typeof(sys), typeof(initializeprob), typeof(initializeprobmap}(f1, f2, mass_matrix,
ChrisRackauckas marked this conversation as resolved.
Show resolved Hide resolved
cache, analytic, tgrad, jac, jvp, vjp,
jac_prototype, sparsity, Wfact, Wfact_t, paramjac, observed, colorvec, sys,
initializeprob, initializeprobmap)
end
function SplitFunction{iip, specialize}(f1, f2;
mass_matrix = __has_mass_matrix(f1) ?
Expand Down Expand Up @@ -2642,28 +2646,36 @@ function SplitFunction{iip, specialize}(f1, f2;
DEFAULT_OBSERVED,
colorvec = __has_colorvec(f1) ? f1.colorvec :
nothing,
sys = __has_sys(f1) ? f1.sys : nothing) where {iip,
sys = __has_sys(f1) ? f1.sys : nothing,
initializeprob = __has_initializeprob(f1) ? f1.initializeprob : nothing,
initializeprobmap = __has_initializeprobmap(f1) ? f1.initializeprobmap : nothing
) where {iip,
specialize
}
sys = sys_or_symbolcache(sys, syms, paramsyms, indepsym)
@assert typeof(initializeprob) <:
Union{Nothing, NonlinearProblem, NonlinearLeastSquaresProblem}

if specialize === NoSpecialize
SplitFunction{iip, specialize, Any, Any, Any, Any, Any, Any, Any, Any, Any,
Any, Any, Any, Any, Any,
Any, Any, Any}(f1, f2, mass_matrix, _func_cache,
Any, Any, Any, Any, Any}(f1, f2, mass_matrix, _func_cache,
analytic,
tgrad, jac, jvp, vjp, jac_prototype,
sparsity, Wfact, Wfact_t, paramjac,
observed, colorvec, sys)
observed, colorvec, sys, initializeprob, initializeprobmap)
else
SplitFunction{iip, specialize, typeof(f1), typeof(f2), typeof(mass_matrix),
typeof(_func_cache), typeof(analytic),
typeof(tgrad), typeof(jac), typeof(jvp), typeof(vjp),
typeof(jac_prototype), typeof(sparsity),
typeof(Wfact), typeof(Wfact_t), typeof(paramjac), typeof(observed),
typeof(colorvec),
typeof(sys)}(f1, f2, mass_matrix, _func_cache, analytic, tgrad, jac,
typeof(sys), typeof(initializeprob), typeof(initializeprobmap)}(f1, f2,
mass_matrix, _func_cache, analytic, tgrad, jac,
jvp, vjp, jac_prototype,
sparsity, Wfact, Wfact_t, paramjac, observed, colorvec, sys)
sparsity, Wfact, Wfact_t, paramjac, observed, colorvec, sys,
initializeprob, initializeprobmap)
end
end

Expand Down
Loading