@@ -305,11 +305,11 @@ function __construct_nlproblem(cache::MIRKCache{iip}, y, loss_bc::BC, loss_collo
305
305
jac = if iip
306
306
(J, u, p) -> __mirk_mpoint_jacobian! (J, u, p, jac_alg. bc_diffmode,
307
307
jac_alg. nonbc_diffmode, cache_bc, cache_collocation, loss_bcₚ,
308
- loss_collocationₚ, resid_bc, resid_collocation, cache. M)
308
+ loss_collocationₚ, resid_bc, resid_collocation, cache. M, L )
309
309
else
310
310
(u, p) -> __mirk_mpoint_jacobian (u, p, jac_prototype, jac_alg. bc_diffmode,
311
311
jac_alg. nonbc_diffmode, cache_bc, cache_collocation, loss_bcₚ,
312
- loss_collocationₚ, cache. M)
312
+ loss_collocationₚ, cache. M, L )
313
313
end
314
314
315
315
nlf = NonlinearFunction {iip} (loss; resid_prototype = vcat (resid_bc, resid_collocation),
@@ -319,17 +319,17 @@ end
319
319
320
320
function __mirk_mpoint_jacobian! (J, x, p, bc_diffmode, nonbc_diffmode, bc_diffcache,
321
321
nonbc_diffcache, loss_bc:: BC , loss_collocation:: C , resid_bc, resid_collocation,
322
- M:: Int ) where {BC, C}
323
- sparse_jacobian! (@view (J[1 : M , :]), bc_diffmode, bc_diffcache, loss_bc, resid_bc, x)
324
- sparse_jacobian! (@view (J[(M + 1 ): end , :]), nonbc_diffmode, nonbc_diffcache,
322
+ M:: Int , L :: Int ) where {BC, C}
323
+ sparse_jacobian! (@view (J[1 : L , :]), bc_diffmode, bc_diffcache, loss_bc, resid_bc, x)
324
+ sparse_jacobian! (@view (J[(L + 1 ): end , :]), nonbc_diffmode, nonbc_diffcache,
325
325
loss_collocation, resid_collocation, x)
326
326
return nothing
327
327
end
328
328
329
329
function __mirk_mpoint_jacobian (x, p, J, bc_diffmode, nonbc_diffmode, bc_diffcache,
330
- nonbc_diffcache, loss_bc:: BC , loss_collocation:: C , M:: Int ) where {BC, C}
331
- sparse_jacobian! (@view (J[1 : M , :]), bc_diffmode, bc_diffcache, loss_bc, x)
332
- sparse_jacobian! (@view (J[(M + 1 ): end , :]), nonbc_diffmode, nonbc_diffcache,
330
+ nonbc_diffcache, loss_bc:: BC , loss_collocation:: C , M:: Int , L :: Int ) where {BC, C}
331
+ sparse_jacobian! (@view (J[1 : L , :]), bc_diffmode, bc_diffcache, loss_bc, x)
332
+ sparse_jacobian! (@view (J[(L + 1 ): end , :]), nonbc_diffmode, nonbc_diffcache,
333
333
loss_collocation, x)
334
334
return J
335
335
end
@@ -341,9 +341,9 @@ function __construct_nlproblem(cache::MIRKCache{iip}, y, loss_bc::BC, loss_collo
341
341
342
342
lossₚ = iip ? ((du, u) -> loss (du, u, cache. p)) : (u -> loss (u, cache. p))
343
343
344
- resid = vcat (cache. bcresid_prototype[1 : prod (cache. resid_size[1 ])],
344
+ resid = vcat (@view ( cache. bcresid_prototype[1 : prod (cache. resid_size[1 ])]) ,
345
345
similar (y, cache. M * (N - 1 )),
346
- cache. bcresid_prototype[(prod (cache. resid_size[1 ]) + 1 ): end ])
346
+ @view ( cache. bcresid_prototype[(prod (cache. resid_size[1 ]) + 1 ): end ]) )
347
347
L = length (cache. bcresid_prototype)
348
348
349
349
sd = if jac_alg. diffmode isa AbstractSparseADType
0 commit comments