Skip to content

Commit 9d7db3d

Browse files
committed
optimize combination of the threaded sensitivity results into one solution object
1 parent ab05f95 commit 9d7db3d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/ThreadedSensitivities.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,8 @@ Combine ODE solutions into a sensitivity solution
161161
function generatesenssolution(sol, sensdict, sensprob)
162162
ts = sol.t
163163
ordkeys = sort([x for x in keys(sensdict)])
164-
u = deepcopy(sol.u)
165-
for k in ordkeys
166-
for i in 1:length(u)
167-
u[i] = vcat(u[i], sensdict[k](ts[i]))
168-
end
169-
end
170164
bigsol = build_solution(sensprob, sol.alg, ts, u;
171165
interp=LinearInterpolation(ts, u), retcode=sol.retcode)
166+
u = [vcat(sol.u[i],(sensdict[k](ts[i]) for k in ordkeys)...) for i in 1:length(sol.u)]
172167
return bigsol
173168
end

0 commit comments

Comments
 (0)