Skip to content

Commit e9544c2

Browse files
committed
Merge pull request #584 from JonasRauch/ode45_k_init
initialization of temp array in ode45_*
2 parents 3eaf953 + cd118bc commit e9544c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jl/ode.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function ode45_dp(F::Function, tspan::AbstractVector, x0::AbstractVector)
208208

209209
# k_ needs to be initialized as an Nx7 matrix where N=number of rows in x
210210
# (just for speed so octave doesn't need to allocate more memory at each stage value)
211-
k_ = zeros(length(x),7)
211+
k_ = zeros(eltype(x), (length(x),7))
212212

213213
# Compute the first stage prior to the main loop. This is part of the Dormand-Prince pair caveat
214214
# Normally, during the main loop the last stage for x[k] is the first stage for computing x[k+1].
@@ -310,7 +310,7 @@ function ode45_fb(F::Function, tspan::AbstractVector, x0::AbstractVector)
310310

311311
# k_ needs to be initialized as an Nx6 matrix where N=number of rows in x
312312
# (just for speed so octave doesn't need to allocate more memory at each stage value)
313-
k_ = zeros(length(x),6)
313+
k_ = zeros(eltype(x), (length(x),6))
314314

315315
while (t < tfinal) & (h >= hmin)
316316
if t + h > tfinal; h = tfinal - t; end

0 commit comments

Comments
 (0)