Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialization of temp array in ode45_* #584

Merged
merged 1 commit into from
Mar 14, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jl/ode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function ode45_dp(F::Function, tspan::AbstractVector, x0::AbstractVector)

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

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

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

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