Skip to content

Commit

Permalink
more approxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jul 15, 2018
1 parent d0a7c60 commit 8c8885d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ function build_solution_array(integrator::DDEIntegrator)
n = integrator.opts.save_everystep ? length(integrator.sol.t) : 2
n += saveat_length
integrator.opts.save_start || (n -= 1)
t = Vector{typeof(integrator.t)}(n)
t = Vector{typeof(integrator.t)}(undef,n)
if typeof(integrator.opts.save_idxs) <: Nothing
u = Vector{typeof(integrator.u)}(n)
u = Vector{typeof(integrator.u)}(undef,n)
else
u = Vector{typeof(integrator.u[integrator.opts.save_idxs])}(n)
u = Vector{typeof(integrator.u[integrator.opts.save_idxs])}(undef,n)
end

# output initial time point if desired
Expand Down
10 changes: 5 additions & 5 deletions test/save_idxs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
@test sol.t == sol2.t && sol.u == sol2.u

## interpolation
@test sol(25:100, idxs=2) == sol2(25:100, idxs=2)
@test sol(25:100, idxs=[2]) == sol2(25:100, idxs=[2])
@test sol(25:100, idxs=2) sol2(25:100, idxs=2)
@test sol(25:100, idxs=[2]) sol2(25:100, idxs=[2])
end
end

Expand All @@ -76,8 +76,8 @@

## interpolation of solution equals second component of
## interpolation of complete solution
@test sol(25:100, idxs=2) == sol2(25:100, idxs=1)
@test sol(25:100, idxs=[2]) == sol2(25:100, idxs=[1])
@test sol(25:100, idxs=2) sol2(25:100, idxs=1)
@test sol(25:100, idxs=[2]) sol2(25:100, idxs=[1])
end

# scalar index
Expand All @@ -93,7 +93,7 @@
@test length(dde_int2.sol.u[1]) == 2

## solution equals second component of complete solution
@test sol.t == sol2.t && sol[2, :] == sol2.u
@test sol.t sol2.t && sol[2, :] sol2.u

## interpolation of solution equals second component of
## interpolation of complete solution
Expand Down

0 comments on commit 8c8885d

Please sign in to comment.