@@ -66,9 +66,17 @@ function __solve(prob::BVProblem, _alg::MultipleShooting; odesolve_kwargs = (;),
66
66
end
67
67
end
68
68
69
+ if prob. problem_type isa TwoPointBVProblem
70
+ diffmode_shooting = __get_non_sparse_ad (alg. jac_alg. diffmode)
71
+ else
72
+ diffmode_shooting = __get_non_sparse_ad (alg. jac_alg. bc_diffmode)
73
+ end
74
+ shooting_alg = Shooting (alg. ode_alg, alg. nlsolve,
75
+ BVPJacobianAlgorithm (diffmode_shooting))
76
+
69
77
single_shooting_prob = remake (prob; u0 = reshape (u_at_nodes[1 : N], u0_size))
70
- return __solve (single_shooting_prob, Shooting (alg . ode_alg; alg . nlsolve);
71
- odesolve_kwargs, nlsolve_kwargs, verbose, kwargs... )
78
+ return __solve (single_shooting_prob, shooting_alg; odesolve_kwargs, nlsolve_kwargs,
79
+ verbose, kwargs... )
72
80
end
73
81
74
82
# TODO : We can save even more memory by hoisting the preallocated caches for the ODEs
@@ -150,10 +158,8 @@ function __solve_nlproblem!(::StandardBVProblem, alg::MultipleShooting, bcresid_
150
158
internal_ode_kwargs... )
151
159
152
160
# BC Part
153
- if alg. jac_alg. bc_diffmode isa AbstractSparseADType
154
- error (" Multiple Shooting doesn't support sparse AD for Boundary Conditions yet!" )
155
- end
156
- sd_bc = NoSparsityDetection ()
161
+ sd_bc = alg. jac_alg. bc_diffmode isa AbstractSparseADType ?
162
+ SymbolicsSparsityDetection () : NoSparsityDetection ()
157
163
bc_jac_cache = sparse_jacobian_cache (alg. jac_alg. bc_diffmode,
158
164
sd_bc, nothing , similar (bcresid_prototype), u_at_nodes)
159
165
ode_cache_bc_jac_fn = __multiple_shooting_init_jacobian_odecache (ensemblealg, prob,
0 commit comments