@@ -7,6 +7,7 @@ export state, jacobian, isinplace, dimension, statetype, state
77export set_state!, set_parameter!, TangentEvolver, ParallelEvolver
88export set_tangent!
99export evolve, evolve!
10+ export trajectory
1011
1112abstract 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 )
206211end
207212
208213# Expand methods
@@ -313,7 +318,7 @@ trajectory(ds::DynamicalSystem, T; kwargs...) -> dataset
313318```
314319Return a dataset what will contain the trajectory of the sytem,
315320after 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
318323For 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)
357362end
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 #
0 commit comments