github.com/RhysU/ar
Autoregressive process modeling tools in header-only C++
Public Types | Public Member Functions | Public Attributes | List of all members
ar::predictor< Value, Index > Class Template Reference

Simulate an autoregressive model process with an InputIterator interface. More...

#include <ar.hpp>

Public Types

typedef std::input_iterator_tag iterator_category
 
typedef Value value_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

 predictor (Index n=0)
 Singular instance marking prediction index n.
 
template<class RandomAccessIterator >
 predictor (RandomAccessIterator params_first, RandomAccessIterator params_last)
 Iterate on the process \(x_n + a_1 x_{n - 1} + \dots + a_p x_{n - p} = 0\). More...
 
template<class RandomAccessIterator , class NoiseGenerator >
 predictor (RandomAccessIterator params_first, RandomAccessIterator params_last, NoiseGenerator generator)
 Iterate on the process \(x_n + a_1 x_{n - 1} + \dots + a_p x_{n - p} = \epsilon_n\) given zero initial conditions. More...
 
 predictor (const predictor &other)
 Copy constructor.
 
predictoroperator= (const predictor &other)
 Assignment operator.
 
 ~predictor ()
 Destructor.
 
template<class InputIterator >
predictorinitial_conditions (InputIterator initial_first, const Value x0adjust=0)
 Specify process initial conditions \(x_{n-1}, \dots, x_{n-p}\) where \(p\) is the process order fixed by the constructor. More...
 
predictoroperator++ ()
 Prefix increment.
 
predictor operator++ (int)
 Postfix increment.
 
reference operator* () const
 Obtain the process prediction \(x_n\).
 
bool operator== (const predictor &other) const
 Check if two iterators represent the same simulation time.
 
bool operator!= (const predictor &other) const
 Check if two iterators represent different simulation times.
 

Public Attributes

const typedef Value * pointer
 
const typedef Value & reference
 

Detailed Description

template<typename Value, typename Index = std::size_t>
class ar::predictor< Value, Index >

Simulate an autoregressive model process with an InputIterator interface.

Definition at line 823 of file ar.hpp.

Constructor & Destructor Documentation

◆ predictor() [1/2]

template<typename Value , typename Index = std::size_t>
template<class RandomAccessIterator >
ar::predictor< Value, Index >::predictor ( RandomAccessIterator  params_first,
RandomAccessIterator  params_last 
)
inline

Iterate on the process \(x_n + a_1 x_{n - 1} + \dots + a_p x_{n - p} = 0\).

Presumably initial_conditions will be used to specify some initial state as otherwise the process is identically zero. The process order \(p\) is set by std::distance(params_first, params_last).

Parameters
params_firstBeginning of the process parameter range starting with \(a_1\).
params_lastEnd of the process parameter range.

Definition at line 854 of file ar.hpp.

◆ predictor() [2/2]

template<typename Value , typename Index = std::size_t>
template<class RandomAccessIterator , class NoiseGenerator >
ar::predictor< Value, Index >::predictor ( RandomAccessIterator  params_first,
RandomAccessIterator  params_last,
NoiseGenerator  generator 
)
inline

Iterate on the process \(x_n + a_1 x_{n - 1} + \dots + a_p x_{n - p} = \epsilon_n\) given zero initial conditions.

The process order \(p\) is set by std::distance(params_first,params_last). The class std::tr1::variate_generator may be helpful in constructing normally distributed input.

Parameters
params_firstBeginning of the process parameter range starting with \(a_1\).
params_lastEnd of the process parameter range.
generatorA nullary callback for generating \(\epsilon_n\). For example, a random number generator distributed like \(N\left(0, \sigma^2_\epsilon\right)\).

Definition at line 885 of file ar.hpp.

Member Function Documentation

◆ initial_conditions()

template<typename Value , typename Index = std::size_t>
template<class InputIterator >
predictor& ar::predictor< Value, Index >::initial_conditions ( InputIterator  initial_first,
const Value  x0adjust = 0 
)
inline

Specify process initial conditions \(x_{n-1}, \dots, x_{n-p}\) where \(p\) is the process order fixed by the constructor.

The simulation index \(n\) is reset to zero and, optionally, \(x_0\) is additively adjusted by x0adjust.

Parameters
initial_firstBeginning of the initial condition range \(x_{n-1}, \dots, x_{n-p}\) which must contain \(p\) values.
x0adjustAn additive adjustment made to \(\epsilon_0\).

Definition at line 951 of file ar.hpp.


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