/* @file Realization.hpp */ #pragma once #include "StochasticProcess.hpp" //#include "time/Time.hpp" //#include #include #include namespace xo { namespace process { // realization of a stochastic process. // interface designed to allow for lazy evaluation. // // since a process connects a family of random variables, // a single process can have a generally unbounded number of distinct realizations. // // implications: // - can only realize (or observe) a finite set of instants. // - given process evolves continuously, // want ability to revisit intervals that may already contain some realized instants. // - achieve this by allowing for caching behavior // template class Realization : public ref::Refcount { public: using utc_nanos = xo::time::utc_nanos; using KnownMap = std::map; using KnownIterator = typename KnownMap::const_iterator; //using KnownRange = boost::iterator_range; using KnownRange = decltype(std::views::all(KnownMap())); public: static ref::rp make(ref::brw> p) { return new Realization(p); } /*make*/ ref::brw> process() const { return process_; } utc_nanos t0() const { return process_->t0(); } size_t n_known() const { return this->known_map_.size(); } /* require: .n_known() > 0 */ utc_nanos lo_tm() const { return this->known_map_.begin().first(); } utc_nanos hi_tm() const { return this->known_map_.rbegin().first(); } //KnownRange known_range() const { return boost::make_iterator_range(this->known_map_); } KnownRange known_range() const { return std::views::all(this->known_map_); } // concept: // realized_range() -> iterator_range private: Realization(ref::brw> p) : process_{p} {} private: /* stochastic process from which this realization is sampled */ ref::rp> process_; /* process value (for this realization) has been established (sampled) * at each time t in {.known_map[].first} */ KnownMap known_map_; }; /*Realization*/ } /*namespace process*/ } /*namespace xo*/ /* end Realization.hpp */