Skip to content

Commit

Permalink
fixup calc_W!
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Sep 9, 2024
1 parent 0b0ba2e commit 525f0fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 11 additions & 4 deletions lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,19 @@ function calc_W!(W, integrator, nlsolver::Union{Nothing, AbstractNLSolver}, cach
else
update_coefficients!(W, uprev, p, t; transform = W_transform, dtgamma)
end
if W.J !== nothing && !(W.J isa AbstractSciMLOperator)
if W.J !== nothing && (W.J isa MatrixOperator || !(W.J isa AbstractSciMLOperator))
islin, isode = islinearfunction(integrator)
islin ? (J = isode ? f.f : f.f1.f) :
(new_jac && (calc_J!(W.J, integrator, lcache, next_step)))
new_W && !isdae &&
if islin
J = isode ? f.f : f.f1.f
elseif new_jac
calc_J!(W.J, integrator, lcache, next_step)
end
if W.J isa MatrixOperator
J = J.A
end
if new_W && !isdae
jacobian2W!(W._concrete_form, mass_matrix, dtgamma, J, W_transform)
end
end
elseif W isa AbstractSciMLOperator && !(W isa StaticWOperator)
update_coefficients!(W, uprev, p, t; transform = W_transform, dtgamma)
Expand Down
2 changes: 0 additions & 2 deletions test/interface/linear_solver_split_ode_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ using Test
using OrdinaryDiffEq
using LinearAlgebra, LinearSolve

import OrdinaryDiffEqCore.dolinsolve

n = 8
dt = 1 / 1000
u0 = ones(n)
Expand Down

0 comments on commit 525f0fe

Please sign in to comment.