Skip to content

Commit

Permalink
Fix the classic solver init
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Oct 19, 2023
1 parent 93bbfe6 commit 7ba42a5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/initialization/classicsolverinit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ function initial_update!(integ, cache, ::ClassicSolverInit)
# Initialize on u0; taking special care for DynamicalODEProblems
is_secondorder = integ.f isa DynamicalODEFunction
_u = is_secondorder ? view(u.x[2], :) : view(u, :)
init_condition_on!(x, Proj(0), _u, cache)
E0 = x.Σ.R isa IsoKroneckerProduct ? Proj(0) : Matrix(Proj(0))
init_condition_on!(x, E0, _u, cache)
is_secondorder ? f.f1(du, u.x[1], u.x[2], p, t) : f(du, u, p, t)
integ.stats.nf += 1
init_condition_on!(x, Proj(1), view(du, :), cache)
E1 = x.Σ.R isa IsoKroneckerProduct ? Proj(1) : Matrix(Proj(1))
init_condition_on!(x, E1, view(du, :), cache)

if q < 2
return
Expand All @@ -39,7 +41,8 @@ function initial_update!(integ, cache, ::ClassicSolverInit)
ForwardDiff.jacobian!(ddu, (du, u) -> _f(du, u, p, t), du, u)
end
ddfddu = ddu * view(du, :) + view(dfdt, :)
init_condition_on!(x, Proj(2), ddfddu, cache)
E2 = x.Σ.R isa IsoKroneckerProduct ? Proj(2) : Matrix(Proj(2))
init_condition_on!(x, E2, ddfddu, cache)
if q < 3
return
end
Expand Down

0 comments on commit 7ba42a5

Please sign in to comment.