TimeSeries

template<class T>
struct TimeSeries

Stores time series data and implements operators over it.

TimeSeries contains two members: time and value, that have the same shape. Both are std::vectors of eigen arrays.

Each element of the vector is intended to represent one person / sample. The values in that element (an Eigen array) are observations of value at time t.

Template Parameters:

T – the scalar type of the underlying values.

Public Types

using Scalar = T
using EntryType = Eigen::Array<T, Dynamic, 1>
using ValType = std::vector<EntryType>
using TimeType = std::vector<Eigen::ArrayXi>

Public Functions

TimeSeries() = default

Wraps time and value slices to matrices TODO: define begin() and end() iterators? figure out how to handle operators that just use values versus time

inline TimeSeries(const TimeType &t, const ValType &v)
template<typename U, typename V>
inline TimeSeries operator()(const U &idx, const V &idx2 = Eigen::all) const

return a slice of the data using indices idx

inline size_t size() const
inline size_t rows() const
inline size_t cols(int i = 0) const
inline ValType::iterator begin()
inline ValType::iterator end()
inline auto cbegin() const
inline auto cend() const
inline TimeType::iterator tbegin()
inline TimeType::iterator tend()
inline auto ctbegin() const
inline auto ctend() const
template<typename ET = EntryType>
inline auto transform(std::function<ET(EntryType)> op) const
template<typename R = T>
inline auto reduce(const auto &op) const
template<typename C>
inline auto cast() const
inline auto abs() const
inline auto pow() const
inline auto log() const
inline auto logabs() const
inline auto log1p() const
inline auto ceil() const
inline auto floor() const
inline auto exp() const
inline auto sin() const
inline auto cos() const
inline auto tan() const
inline auto asin() const
inline auto acos() const
inline auto atan() const
inline auto sinh() const
inline auto cosh() const
inline auto tanh() const
inline auto sqrt() const
inline auto sqrtabs() const
inline auto square() const
inline auto median() const
inline auto mean() const
inline auto std() const
inline auto max() const
inline auto min() const
inline auto sum() const
inline auto count() const
inline auto prod() const
template<typename T2>
inline auto operator*(T2 v)
template<typename T2>
inline auto before(const TimeSeries<T2> &t2) const
template<typename T2>
inline auto after(const TimeSeries<T2> &t2) const
template<typename T2>
inline auto during(const TimeSeries<T2> &t2) const
inline std::string print() const

Public Members

TimeType time
ValType value

Public Static Attributes

static const size_t NumDimensions = 2