Skip to content
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
10 changes: 5 additions & 5 deletions jl/ode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@ const ode45 = ode45_dp
# ODEFUN(T,X) must return a column vector corresponding to f(t,x). Each
# row in the solution array X corresponds to a time returned in the
# column vector T.
function ode4(F::Function, tspan::AbstractVector, x0::AbstractVector)
function ode4{T}(F::Function, tspan::AbstractVector, x0::AbstractVector{T})
h = diff(tspan)
x = Array(Float64, (length(tspan), length(x0)))
x = Array(T, (length(tspan), length(x0)))
x[1,:] = x0'

midxdot = Array(Float64, (4, length(x0)))
midxdot = Array(T, (4, length(x0)))
for i = 1:(length(tspan)-1)
# Compute midstep derivatives
midxdot[1,:] = F(tspan[i], x[i,:]')
Expand All @@ -392,9 +392,9 @@ function ode4(F::Function, tspan::AbstractVector, x0::AbstractVector)
end

# ODE_MS Fixed-step, fixed-order multi-step numerical method with Adams-Bashforth-Moulton coefficients
function ode_ms(F::Function, tspan::AbstractVector, x0::AbstractVector, order::Integer)
function ode_ms{T}(F::Function, tspan::AbstractVector, x0::AbstractVector{T}, order::Integer)
h = diff(tspan)
x = zeros(length(tspan), length(x0))
x = zeros(T,(length(tspan), length(x0)))
x[1,:] = x0

if 1 <= order <= 4
Expand Down