Skip to content

Commit ca9b6fd

Browse files
author
dd
committed
unnecessary allocation
1 parent 0244545 commit ca9b6fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/systems/callbacks.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@ function compile_affect(eqs::Vector{Equation}, sys, dvs, ps; outputidxs = nothin
316316
alleq = all(isequal(isparameter(first(update_vars))),
317317
Iterators.map(isparameter, update_vars))
318318
if !isparameter(first(lhss)) && alleq
319-
stateind = Dict(map(a -> reverse(a), enumerate(dvs)))
319+
stateind = Dict(reverse(en) for en in enumerate(dvs))
320320
update_inds = map(sym -> stateind[sym], update_vars)
321321
elseif isparameter(first(lhss)) && alleq
322-
psind = Dict(map(a -> reverse(a), enumerate(ps)))
322+
psind = Dict(reverse(en) for en in enumerate(ps))
323323
update_inds = map(sym -> psind[sym], update_vars)
324324
outvar = :p
325325
else
@@ -411,10 +411,10 @@ function generate_rootfinding_callback(cbs, sys::AbstractODESystem, dvs = states
411411
end
412412

413413
function compile_user_affect(affect::FunctionalAffect, sys, dvs, ps; kwargs...)
414-
dvs_ind = Dict(map(a -> reverse(a), enumerate(dvs)))
414+
dvs_ind = Dict(reverse(en) for en in enumerate(dvs))
415415
v_inds = map(sym -> dvs_ind[sym], states(affect))
416416

417-
ps_ind = Dict(map(a -> reverse(a), enumerate(ps)))
417+
ps_ind = Dict(reverse(en) for en in enumerate(ps))
418418
p_inds = map(sym -> ps_ind[sym], parameters(affect))
419419

420420
# HACK: filter out eliminated symbols. Not clear this is the right thing to do

0 commit comments

Comments
 (0)