Skip to content

Commit 525f0fe

Browse files
committed
fixup calc_W!
1 parent 0b0ba2e commit 525f0fe

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,12 +704,19 @@ function calc_W!(W, integrator, nlsolver::Union{Nothing, AbstractNLSolver}, cach
704704
else
705705
update_coefficients!(W, uprev, p, t; transform = W_transform, dtgamma)
706706
end
707-
if W.J !== nothing && !(W.J isa AbstractSciMLOperator)
707+
if W.J !== nothing && (W.J isa MatrixOperator || !(W.J isa AbstractSciMLOperator))
708708
islin, isode = islinearfunction(integrator)
709-
islin ? (J = isode ? f.f : f.f1.f) :
710-
(new_jac && (calc_J!(W.J, integrator, lcache, next_step)))
711-
new_W && !isdae &&
709+
if islin
710+
J = isode ? f.f : f.f1.f
711+
elseif new_jac
712+
calc_J!(W.J, integrator, lcache, next_step)
713+
end
714+
if W.J isa MatrixOperator
715+
J = J.A
716+
end
717+
if new_W && !isdae
712718
jacobian2W!(W._concrete_form, mass_matrix, dtgamma, J, W_transform)
719+
end
713720
end
714721
elseif W isa AbstractSciMLOperator && !(W isa StaticWOperator)
715722
update_coefficients!(W, uprev, p, t; transform = W_transform, dtgamma)

test/interface/linear_solver_split_ode_test.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ using Test
22
using OrdinaryDiffEq
33
using LinearAlgebra, LinearSolve
44

5-
import OrdinaryDiffEqCore.dolinsolve
6-
75
n = 8
86
dt = 1 / 1000
97
u0 = ones(n)

0 commit comments

Comments
 (0)