Skip to content

Commit

Permalink
removes old calc_W!
Browse files Browse the repository at this point in the history
  • Loading branch information
kanav99 committed Aug 18, 2019
1 parent 8cd811f commit d7960b8
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/derivative_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,34 +414,7 @@ function calc_W!(nlsolver, integrator, cache::OrdinaryDiffEqMutableCache, dtgamm
new_W && (integrator.destats.nw += 1)
return nothing
end
function calc_W!(integrator, cache::OrdinaryDiffEqConstantCache, dtgamma, repeat_step, W_transform=false)
@unpack t,uprev,p,f = integrator
@unpack uf = cache
mass_matrix = integrator.f.mass_matrix
isarray = typeof(uprev) <: AbstractArray
# calculate W
uf.t = t
is_compos = typeof(integrator.alg) <: CompositeAlgorithm
if (f isa ODEFunction && islinear(f.f)) || (f isa SplitFunction && islinear(f.f1.f))
J = f.f1.f
W = WOperator(mass_matrix, dtgamma, J, false; transform=W_transform)
elseif DiffEqBase.has_jac(f)
J = f.jac(uprev, p, t)
if !isa(J, DiffEqBase.AbstractDiffEqLinearOperator)
J = DiffEqArrayOperator(J)
end
W = WOperator(mass_matrix, dtgamma, J, false; transform=W_transform)
integrator.destats.nw += 1
else
integrator.destats.nw += 1
J = calc_J(integrator, cache, is_compos)
W_full = W_transform ? -mass_matrix*inv(dtgamma) + J :
-mass_matrix + dtgamma*J
W = W_full isa Number ? W_full : lu(W_full)
end
is_compos && (integrator.eigen_est = isarray ? opnorm(J, Inf) : abs(J))
W
end

function calc_W!(nlsolver, integrator, cache::OrdinaryDiffEqConstantCache, dtgamma, repeat_step, W_transform=false)
@unpack t,uprev,p,f = integrator
@unpack uf = nlsolver
Expand Down

0 comments on commit d7960b8

Please sign in to comment.