30 virtual Index size()
const = 0;
31 virtual std::pair<Index,Index> shape()
const = 0;
32 virtual bool is_empty()
const = 0;
33 virtual Interval tdomain()
const = 0;
34 virtual void truncate_tdomain(
const Interval& new_tdomain) = 0;
35 virtual typename Wrapper<T>::Domain codomain()
const = 0;
36 virtual T operator()(
double t)
const = 0;
37 virtual typename Wrapper<T>::Domain operator()(
const Interval& t)
const = 0;
39 auto nan_value()
const
41 if constexpr(std::is_same_v<T,double> || std::is_same_v<typename ValueType<T>::Type,ScalarType>)
42 return std::numeric_limits<double>::quiet_NaN();
45 return T((*
this)(tdomain().lb()))
46 .init(std::numeric_limits<double>::quiet_NaN());
49 virtual SampledTraj<T> sampled(
double dt)
const
51 assert_release(dt > 0.);
52 assert_release(!is_empty());
54 auto tdom = tdomain();
56 for(
double t = tdom.lb() ; t < tdom.ub() ; t+=dt)
57 straj.set(t, (*
this)(t));
58 straj.set(tdom.ub(), (*
this)(tdom.ub()));
63 SampledTraj<T> sampled_as(
const SampledTraj<Q>& x)
const
65 assert_release(x.tdomain().is_subset(this->tdomain()));
68 for(
const auto& [ti,dump] : x)
69 straj.set(ti, (*
this)(ti));
73 SampledTraj<T> primitive(
const T& y0,
double dt)
const
75 assert_release(dt > 0.);
76 assert_release(!is_empty());
79 double t = tdomain().lb(), last_t = t;
80 p.set(t, y0); t += dt;
83 while(t < tdomain().ub())
85 y += ((*this)(last_t)+(*this)(t))*dt/2.;
92 y += ((*this)(last_t)+(*this)(t))*(t-last_t)/2.;
99 AnalyticFunction<typename ValueType<T>::Type> as_function()
const;