Skip to content

Set strict to false in shooting when prepare jacobian #329

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

Merged
merged 2 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Hwloc = "3.3"
InteractiveUtils = "<0.0.1, 1"
JET = "0.9.18"
LinearAlgebra = "1.10"
LinearSolve = "3.9"
LinearSolve = "3.12"
NonlinearSolveFirstOrder = "1.3"
ODEInterface = "0.5"
OrdinaryDiffEqLowOrderRK = "1.2"
Expand Down
9 changes: 5 additions & 4 deletions lib/BoundaryValueDiffEqShooting/src/multiple_shooting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ function __solve_nlproblem!(
end

resid_prototype_cached = similar(resid_prototype)
jac_cache = DI.prepare_jacobian(nothing, resid_prototype_cached, diffmode, u_at_nodes)
jac_cache = DI.prepare_jacobian(
nothing, resid_prototype_cached, diffmode, u_at_nodes; strict = Val(false))

ode_cache_jac_fn = __multiple_shooting_init_jacobian_odecache(
ensemblealg, prob, jac_cache, diffmode, alg.ode_alg,
Expand Down Expand Up @@ -161,8 +162,8 @@ function __solve_nlproblem!(::StandardBVProblem, alg::MultipleShooting, bcresid_
else
alg.jac_alg.nonbc_diffmode
end
ode_jac_cache = DI.prepare_jacobian(
nothing, similar(u_at_nodes, cur_nshoot * N), nonbc_diffmode, u_at_nodes)
ode_jac_cache = DI.prepare_jacobian(nothing, similar(u_at_nodes, cur_nshoot * N),
nonbc_diffmode, u_at_nodes; strict = Val(false))
ode_cache_ode_jac_fn = __multiple_shooting_init_jacobian_odecache(
ensemblealg, prob, ode_jac_cache, nonbc_diffmode,
alg.ode_alg, cur_nshoot, u0; internal_ode_kwargs...)
Expand All @@ -175,7 +176,7 @@ function __solve_nlproblem!(::StandardBVProblem, alg::MultipleShooting, bcresid_
bc_diffmode
end
bc_jac_cache = DI.prepare_jacobian(
nothing, similar(bcresid_prototype), bc_diffmode, u_at_nodes)
nothing, similar(bcresid_prototype), bc_diffmode, u_at_nodes; strict = Val(false))
ode_cache_bc_jac_fn = __multiple_shooting_init_jacobian_odecache(
ensemblealg, prob, bc_jac_cache, bc_diffmode,
alg.ode_alg, cur_nshoot, u0; internal_ode_kwargs...)
Expand Down
4 changes: 2 additions & 2 deletions lib/BoundaryValueDiffEqShooting/src/single_shooting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function SciMLBase.__solve(prob::BVProblem, alg_::Shooting; odesolve_kwargs = (;
y_ = similar(resid_prototype)

jac_cache = if iip
DI.prepare_jacobian(nothing, y_, diffmode, vec(u0))
DI.prepare_jacobian(nothing, y_, diffmode, vec(u0); strict = Val(false))
else
DI.prepare_jacobian(nothing, diffmode, vec(u0))
DI.prepare_jacobian(nothing, diffmode, vec(u0); strict = Val(false))
end

ode_cache_jac_fn = __single_shooting_jacobian_ode_cache(
Expand Down
Loading