Skip to content

Commit

Permalink
Merge pull request #621 from JuliaDiffEq/recursivecopy
Browse files Browse the repository at this point in the history
Use recursivecopy for numbers as well
  • Loading branch information
devmotion committed Jan 21, 2019
2 parents 0c23d5b + ac7f617 commit 2967bd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Parameters 0.10.0
ForwardDiff 0.7.0
GenericSVD 0.0.2
NLsolve 0.14.1
RecursiveArrayTools 0.13.0
RecursiveArrayTools 0.18.6
DiffEqDiffTools 0.4.0
Reexport
MuladdMacro 0.2.1
Expand Down
20 changes: 4 additions & 16 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,10 @@ function DiffEqBase.__init(

# Get the control variables

if typeof(prob.u0) <: Array
u = recursivecopy(prob.u0)
elseif typeof(prob.u0) <: Number
u = prob.u0
elseif typeof(prob.u0) <: Tuple
if typeof(prob.u0) <: Tuple
u = ArrayPartition(prob.u0,Val{true})
else
u = deepcopy(prob.u0)
u = recursivecopy(prob.u0)
end

uType = typeof(u)
Expand Down Expand Up @@ -215,17 +211,9 @@ function DiffEqBase.__init(

k = rateType[]

if uType <: Array
uprev = copy(u)
else
uprev = deepcopy(u)
end
uprev = recursivecopy(u)
if allow_extrapolation
if uType <: Array
uprev2 = copy(u)
else
uprev2 = deepcopy(u)
end
uprev2 = recursivecopy(u)
else
uprev2 = uprev
end
Expand Down

0 comments on commit 2967bd1

Please sign in to comment.