30 virtual Index size()
const = 0;
31 virtual bool is_empty()
const = 0;
32 virtual Interval tdomain()
const = 0;
33 virtual void truncate_tdomain(
const Interval& new_tdomain) = 0;
34 virtual typename Wrapper<T>::Domain codomain()
const = 0;
35 virtual T operator()(
double t)
const = 0;
36 virtual typename Wrapper<T>::Domain operator()(
const Interval& t)
const = 0;
38 auto nan_value()
const
40 if constexpr(std::is_same_v<T,double> || std::is_same_v<typename ValueType<T>::Type,ScalarType>)
41 return std::numeric_limits<double>::quiet_NaN();
44 return T((*
this)(tdomain().lb()))
45 .init(std::numeric_limits<double>::quiet_NaN());
48 virtual SampledTraj<T> sampled(
double dt)
const
50 assert_release(dt > 0.);
51 assert_release(!is_empty());
53 auto tdom = tdomain();
55 for(
double t = tdom.lb() ; t < tdom.ub() ; t+=dt)
56 straj.set(t, (*
this)(t));
57 straj.set(tdom.ub(), (*
this)(tdom.ub()));
62 SampledTraj<T> sampled_as(
const SampledTraj<Q>& x)
const
64 assert_release(x.tdomain().is_subset(this->tdomain()));
67 for(
const auto& [ti,dump] : x)
68 straj.set(ti, (*
this)(ti));
72 SampledTraj<T> primitive(
const T& y0,
double dt)
const
74 assert_release(dt > 0.);
75 assert_release(!is_empty());
78 double t = tdomain().lb(), last_t = t;
79 p.set(t, y0); t += dt;
82 while(t < tdomain().ub())
84 y += ((*this)(last_t)+(*this)(t))*dt/2.;
91 y += ((*this)(last_t)+(*this)(t))*(t-last_t)/2.;
98 AnalyticFunction<typename ValueType<T>::Type> as_function()
const;