LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
loos::TimeSeries< T > Class Template Reference

Time Series Class. More...

#include <TimeSeries.hpp>

Public Types

typedef std::vector< T >::iterator iterator
 
typedef std::vector< T >::const_iterator const_iterator
 
typedef const T & const_reference
 
typedef T & reference
 
typedefvalue_type
 

Public Member Functions

 TimeSeries (const std::vector< T > &inp)
 
 TimeSeries (const uint size, const T *array)
 
 TimeSeries (const TimeSeries< T > &inp)
 
 TimeSeries (const uint n)
 
 TimeSeries (const uint n, const T val)
 
void resize (const uint n, const T val=(T) 0.0)
 Resize the TimeSeries by calling the underlying vector's resize.
 
 TimeSeries (const std::string &filename, const int col=2)
 
void init (void)
 
void zero (void)
 
T & operator[] (const unsigned int i)
 
const T & operator[] (const unsigned int i) const
 
unsigned int size (void) const
 
TimeSeries< T > operator+= (const T val)
 
TimeSeries< T > operator+= (const TimeSeries< T > &rhs)
 
TimeSeries< T > operator+ (const T val) const
 
TimeSeries< T > operator+ (const TimeSeries< T > &rhs) const
 
TimeSeries< T > operator-= (const T val)
 
TimeSeries< T > operator-= (const TimeSeries< T > &rhs)
 
TimeSeries< T > operator- (const T val) const
 
TimeSeries< T > operator- (const TimeSeries< T > &rhs) const
 
TimeSeries< T > operator- () const
 
TimeSeries< T > operator*= (const T val)
 
TimeSeries< T > operator* (const T val) const
 
TimeSeries< T > operator*= (const TimeSeries< T > &rhs)
 
TimeSeries< T > operator* (const TimeSeries< T > &rhs) const
 
TimeSeries< T > operator/= (const T val)
 
TimeSeries< T > operator/ (const T val) const
 
TimeSeries< T > operator/= (const TimeSeries< T > &rhs)
 
TimeSeries< T > operator/ (const TimeSeries< T > &rhs) const
 
TimeSeries< T > copy (void) const
 
void set_skip (unsigned int num_points)
 
average (void) const
 Return average of time series.
 
weighted_average (const std::vector< double > &w) const
 Return weighted average.
 
variance (void) const
 Return variance of time series.
 
weighted_variance (const std::vector< double > &w) const
 Return weighted variance.
 
stdev (void) const
 Return standard deviation of time series.
 
stdev (const std::vector< double > &w) const
 Return weighted standard deviation of time series.
 
sterr (void) const
 
TimeSeries< T > running_average (void) const
 
TimeSeries< T > windowed_average (const uint window) const
 
block_var (const int num_blocks) const
 
TimeSeries< T > correl (const int max_time, const int interval=1, const bool normalize=true, T tol=1.0e-8) const
 
void push_back (const T &x)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Friends

TimeSeries< T > operator+ (const T lhs, const TimeSeries< T > &rhs)
 
TimeSeries< T > operator- (const T lhs, const TimeSeries< T > &rhs)
 
TimeSeries< T > operator* (const T lhs, const TimeSeries< T > &rhs)
 
TimeSeries< T > operator/ (const T lhs, const TimeSeries< T > &rhs)
 

Detailed Description

template<class T>
class loos::TimeSeries< T >

Time Series Class.

This class provides basic operations on a time series, such as averaging, standard deviation, etc

One can do standard arimethic operations on time series combined with scalars or other timeseries (as long as the two time series are the same length).

Constructor & Destructor Documentation

◆ TimeSeries()

template<class T >
loos::TimeSeries< T >::TimeSeries ( const std::string & filename,
const int col = 2 )
inline

Read a simple text file and create a timeseries The file is assumed to be simple columnated data. Blank lines and lines starting with "#" are ignored.

Member Function Documentation

◆ block_var()

template<class T >
T loos::TimeSeries< T >::block_var ( const int num_blocks) const
inline

Return the variance of the block average for the time series. Divides the timeseries into num_blocks equally sized blocks (discarding the remaining blocks at the end), computes the average for each block, and returns the variance of the averages. This is useful for doing Flyvjberg and Petersen-style block averaging. Flyvbjerg, H. & Petersen, H. G. J. Chem. Phys., 1989, 91, 461-466

◆ running_average()

template<class T >
TimeSeries< T > loos::TimeSeries< T >::running_average ( void ) const
inline

Return a new timeseries of the same size as the current one, containing the running average of the time series

◆ set_skip()

template<class T >
void loos::TimeSeries< T >::set_skip ( unsigned int num_points)
inline

Remove num_points from the front of the time series, as you would to eliminate the equilibration time

◆ sterr()

template<class T >
T loos::TimeSeries< T >::sterr ( void ) const
inline

Return standard error of time series. This assumes all points are statistically independent Otherwise, needs to be multiplied by the square root of the correlation time, in units of the step interval for the time series

◆ windowed_average()

template<class T >
TimeSeries< T > loos::TimeSeries< T >::windowed_average ( const uint window) const
inline

Return a new timeseries containing the windowed average. ith value of the new time series = 1/window * sum(data[i:i+window]). NOTE: The present algorithm is relatively fast, but can be prone to roundoff.


The documentation for this class was generated from the following file: