Skip to content

Commit dd3e5cf

Browse files
committed
all tests pass
1 parent 8c90a3d commit dd3e5cf

File tree

10 files changed

+45
-351
lines changed

10 files changed

+45
-351
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All systems now have the parameter container as the third argument, and
44
mandatory as well.
55
* Complete overhaul of Discrete Systems: all systems are now one, there is
6-
no longer `DiscreteDS` and `BigDiscreteDS`. Everything is `DDS`!
6+
no longer `DDS` and `BigDDS`. Everything is `DDS`!
77
* `variational_integrator` renamed to `tangent_integrator`.
88
## Non-breaking
99
* Massive performance boost of up to 8x in system evolution.

deps/build.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# Notice that the same changes happened for
1313
# discrete systems as well. For example, the
14-
# e.o.m. for `DiscreteDS` are now expected
14+
# e.o.m. for `DDS` are now expected
1515
# in the form `eom(x, p)`.
1616
#
1717
# Please see the documentation strings of the system types you are using!

src/discrete.jl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export state, jacobian, isinplace, dimension, statetype, state
77
export set_state!, set_parameter!, TangentEvolver, ParallelEvolver
88
export set_tangent!
99
export evolve, evolve!
10+
export trajectory
1011

1112
abstract type DynamicalSystem end
1213

@@ -201,8 +202,12 @@ function DiscreteDynamicalSystem(s::S, eom::F, p::P) where {S, F, P}
201202
J = jacob(s, prob.p)
202203
end
203204
end
204-
205-
return DiscreteDynamicalSystem(prob, jacob, dum, J, true)
205+
IIP = isinplace(prob)
206+
T = eltype(prob)
207+
M = typeof(J)
208+
X = typeof(state(prob))
209+
JA = typeof(jacob)
210+
return DiscreteDynamicalSystem{IIP, D, T, X, F, P, JA, M}(prob, jacob, dum, J, true)
206211
end
207212

208213
# Expand methods
@@ -313,7 +318,7 @@ trajectory(ds::DynamicalSystem, T; kwargs...) -> dataset
313318
```
314319
Return a dataset what will contain the trajectory of the sytem,
315320
after evolving it for time `T`. See [`Dataset`](@ref) for info on how to
316-
manipulate this object.
321+
manipulate this object (for 1D systems a `Vector` is returned).
317322
318323
For the discrete case, `T` is an integer and a `T×D` dataset is returned
319324
(`D` is the system dimensionality). For the
@@ -356,6 +361,18 @@ function trajectory(ds::DDS{false}, N::Int, st = state(ds))
356361
return Dataset(ts)
357362
end
358363

364+
function trajectory(ds::DDS{false, 1}, N::Int, st = state(ds))
365+
T = eltype(ds)
366+
ts = Vector{T}(N)
367+
ts[1] = st
368+
f = ds.prob.f
369+
for i in 2:N
370+
st = f(st, ds.prob.p)
371+
ts[i] = st
372+
end
373+
return ts
374+
end
375+
359376

360377
#####################################################################################
361378
# Parallel/Tangent Evolvers #

src/discrete_old.jl

Lines changed: 0 additions & 327 deletions
This file was deleted.

0 commit comments

Comments
 (0)