Relacs Numerics Library  0.9.8
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
SampleData< T > Class Template Reference

#include <sampledata.h>

Inheritance diagram for SampleData< T >:
Inheritance graph
[legend]
Collaboration diagram for SampleData< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 
typedef T * pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef int size_type
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef double range_type
 
typedef LinearRange::const_iterator const_range_iterator
 
- Public Types inherited from Array< T >
typedef T value_type
 
typedef T * pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef int size_type
 
typedef T * iterator
 
typedef const T * const_iterator
 

Public Member Functions

 SampleData (void)
 
 SampleData (int n, const T &val=0)
 
 SampleData (long n, const T &val=0)
 
 SampleData (int n, double offset, double stepsize, const T &val=0)
 
 SampleData (long n, double offset, double stepsize, const T &val=0)
 
 SampleData (double l, double r, double stepsize, const T &val=0)
 
 SampleData (const LinearRange &range, const T &val=0)
 
template<typename R >
 SampleData (const R *a, int n, double offset=0, double stepsize=1)
 
template<typename R >
 SampleData (const R *a, int n, const LinearRange &range)
 
template<typename R >
 SampleData (const vector< R > &a, double offset=0, double stepsize=1)
 
template<typename R >
 SampleData (const vector< R > &a, const LinearRange &range)
 
template<typename R >
 SampleData (const Array< R > &a, double offset=0, double stepsize=1)
 
template<typename R >
 SampleData (const Array< R > &a, const LinearRange &range)
 
template<typename R >
 SampleData (const SampleData< R > &sa)
 
template<typename R >
 SampleData (const SampleData< R > &sa, const LinearRange &range)
 
 SampleData (const SampleData< T > &sa)
 
virtual ~SampleData (void)
 
template<typename R >
const SampleData< T > & operator= (const R &a)
 
template<typename R >
const SampleData< T > & operator= (const SampleData< R > &a)
 
const SampleData< T > & operator= (const SampleData< T > &a)
 
template<typename R >
const SampleData< T > & assign (const R *a, int n)
 
template<typename R >
const SampleData< T > & assign (const R *a, int n, double offset, double stepsize=1)
 
template<typename R >
const SampleData< T > & assign (const R &a)
 
template<typename R >
const SampleData< T > & assign (const R &a, double offset, double stepsize=1)
 
template<typename R >
const SampleData< T > & assign (const SampleData< R > &sa)
 
const SampleData< T > & assign (const SampleData< T > &sa)
 
template<typename R >
const SampleData< T > & interpolate (const SampleData< R > &sa)
 
template<typename R >
const SampleData< T > & interpolate (const SampleData< R > &sa, double stepsize)
 
template<typename R >
const SampleData< T > & interpolate (const SampleData< R > &sa, double offset, double stepsize)
 
template<typename R >
const SampleData< T > & interpolate (const SampleData< R > &sa, const LinearRange &range)
 
template<typename R >
const SampleData< T > & interpolate (const Map< R > &ma)
 
template<typename R >
const SampleData< T > & interpolate (const Map< R > &ma, const LinearRange &range)
 
template<typename R >
const SampleData< T > & smooth (const SampleData< R > &sa, int n)
 
template<typename R >
const SampleData< T > & smooth (const SampleData< R > &sa, const ArrayD &weights, int nl)
 
template<typename R >
SampleData< T > & whiteNoise (int n, double step, double cl, double cu, R &r=rnd)
 
template<typename R >
SampleData< T > & whiteNoise (double l, double step, double cl, double cu, R &r=rnd)
 
template<typename R >
SampleData< T > & ouNoise (int n, double step, double tau, R &r=rnd)
 
template<typename R >
SampleData< T > & ouNoise (double l, double step, double tau, R &r=rnd)
 
template<typename R >
const SampleData< T > & copy (R *a, int n, const T &val=0) const
 
template<typename R >
const SampleData< T > & copy (R &a) const
 
template<typename R >
const SampleData< T > & copy (SampleData< R > &sa) const
 
template<typename R >
const SampleData< T > & copy (double x1, double x2, SampleData< R > &sa) const
 
template<typename R >
const SampleData< T > & copy (double x1, double x2, Map< R > &m) const
 
template<typename R >
const SampleData< T > & copy (double x1, double x2, Array< R > &a) const
 
template<typename R >
const SampleData< T > & copy (double x1, double x2, vector< R > &v) const
 
const SampleData< T > & append (T a, int n=1)
 
template<typename R >
const SampleData< T > & append (const R *a, int n)
 
template<typename R >
const SampleData< T > & append (const R &a)
 
template<typename R >
const SampleData< T > & append (const SampleData< R > &sa)
 
int size (void) const
 
bool empty (void) const
 
virtual int resize (int n, const T &val=0)
 
int resize (long n, const T &val=0)
 
int resize (int n, double offset, double stepsize, const T &val=0)
 
int resize (long n, double offset, double stepsize, const T &val=0)
 
int resize (double l, double r, double stepsize, const T &val=0)
 
int resize (const LinearRange &range, const T &val=0)
 
virtual void clear (void)
 
int capacity (void) const
 
virtual int reserve (int n)
 
virtual void free (int n=0)
 
double offset (void) const
 
void setOffset (double offset)
 
double stepsize (void) const
 
void setStepsize (double stepsize)
 
void scaleStepsize (double scale)
 
void setRange (double offset, double stepsize)
 
double length (void) const
 
void setLength (double l)
 
double rangeFront (void) const
 
double rangeBack (void) const
 
void setRangeBack (double val)
 
void shift (double val)
 
void scale (double scale)
 
double pos (int i) const
 
double interval (int indices) const
 
int index (double pos) const
 
int indices (double iv) const
 
bool contains (double pos) const
 
const T & operator[] (int i) const
 
T & operator[] (int i)
 
const T & at (int i) const
 
T & at (int i)
 
const T & operator[] (double x) const
 
T & operator[] (double x)
 
operator() (double x) const
 
const T & front (void) const
 
T & front (void)
 
const T & back (void) const
 
T & back (void)
 
int push (const T &val)
 
pop (void)
 
const T * data (void) const
 
T * data (void)
 
const Array< T > & array (void) const
 
Array< T > & array (void)
 
const LinearRangerange (void) const
 
LinearRangerange (void)
 
iterator begin (void)
 
const_iterator begin (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
const_range_iterator rangeBegin (void) const
 
const_range_iterator rangeEnd (void) const
 
SampleData< T > & insert (int i, const T &yval)
 
iterator insert (iterator i, const T &yval)
 
SampleData< T > & erase (int i)
 
iterator erase (iterator i)
 
const SampleData< T > & operator= (float x)
 
const SampleData< T > & operator= (double x)
 
const SampleData< T > & operator= (long double x)
 
const SampleData< T > & operator= (signed char x)
 
const SampleData< T > & operator= (unsigned char x)
 
const SampleData< T > & operator= (signed int x)
 
const SampleData< T > & operator= (unsigned int x)
 
const SampleData< T > & operator= (signed long x)
 
const SampleData< T > & operator= (unsigned long x)
 
template<class R >
const SampleData< T > & operator+= (const R &x)
 
template<class R >
const SampleData< T > & operator+= (const SampleData< R > &x)
 
const SampleData< T > & operator+= (float x)
 
const SampleData< T > & operator+= (double x)
 
const SampleData< T > & operator+= (long double x)
 
const SampleData< T > & operator+= (signed char x)
 
const SampleData< T > & operator+= (unsigned char x)
 
const SampleData< T > & operator+= (signed int x)
 
const SampleData< T > & operator+= (unsigned int x)
 
const SampleData< T > & operator+= (signed long x)
 
const SampleData< T > & operator+= (unsigned long x)
 
template<class R >
const SampleData< T > & operator-= (const R &x)
 
template<class R >
const SampleData< T > & operator-= (const SampleData< R > &x)
 
const SampleData< T > & operator-= (float x)
 
const SampleData< T > & operator-= (double x)
 
const SampleData< T > & operator-= (long double x)
 
const SampleData< T > & operator-= (signed char x)
 
const SampleData< T > & operator-= (unsigned char x)
 
const SampleData< T > & operator-= (signed int x)
 
const SampleData< T > & operator-= (unsigned int x)
 
const SampleData< T > & operator-= (signed long x)
 
const SampleData< T > & operator-= (unsigned long x)
 
template<class R >
const SampleData< T > & operator*= (const R &x)
 
template<class R >
const SampleData< T > & operator*= (const SampleData< R > &x)
 
const SampleData< T > & operator*= (float x)
 
const SampleData< T > & operator*= (double x)
 
const SampleData< T > & operator*= (long double x)
 
const SampleData< T > & operator*= (signed char x)
 
const SampleData< T > & operator*= (unsigned char x)
 
const SampleData< T > & operator*= (signed int x)
 
const SampleData< T > & operator*= (unsigned int x)
 
const SampleData< T > & operator*= (signed long x)
 
const SampleData< T > & operator*= (unsigned long x)
 
template<class R >
const SampleData< T > & operator/= (const R &x)
 
template<class R >
const SampleData< T > & operator/= (const SampleData< R > &x)
 
const SampleData< T > & operator/= (float x)
 
const SampleData< T > & operator/= (double x)
 
const SampleData< T > & operator/= (long double x)
 
const SampleData< T > & operator/= (signed char x)
 
const SampleData< T > & operator/= (unsigned char x)
 
const SampleData< T > & operator/= (signed int x)
 
const SampleData< T > & operator/= (unsigned int x)
 
const SampleData< T > & operator/= (signed long x)
 
const SampleData< T > & operator/= (unsigned long x)
 
template<class R >
const SampleData< T > & operator%= (const R &x)
 
template<class R >
const SampleData< T > & operator%= (const SampleData< R > &x)
 
const SampleData< T > & operator%= (float x)
 
const SampleData< T > & operator%= (double x)
 
const SampleData< T > & operator%= (long double x)
 
const SampleData< T > & operator%= (signed char x)
 
const SampleData< T > & operator%= (unsigned char x)
 
const SampleData< T > & operator%= (signed int x)
 
const SampleData< T > & operator%= (unsigned int x)
 
const SampleData< T > & operator%= (signed long x)
 
const SampleData< T > & operator%= (unsigned long x)
 
SampleData< T > operator- (void)
 
SampleData< T > & identity (void)
 
SampleData< T > & sin (const LinearRange &r, double f, double p=0.0)
 
SampleData< T > & sin (int n, double offset, double stepsize, double f, double p=0.0)
 
SampleData< T > & sin (double l, double r, double stepsize, double f, double p=0.0)
 
SampleData< T > & cos (const LinearRange &r, double f, double p=0.0)
 
SampleData< T > & cos (int n, double offset, double stepsize, double f, double p=0.0)
 
SampleData< T > & cos (double l, double r, double stepsize, double f, double p=0.0)
 
SampleData< T > & sweep (const LinearRange &r, double startfreq, double endfreq)
 
SampleData< T > & sweep (int n, double offset, double stepsize, double startfreq, double endfreq)
 
SampleData< T > & sweep (double l, double r, double stepsize, double startfreq, double endfreq)
 
SampleData< T > & gauss (const LinearRange &r)
 
SampleData< T > & gauss (int n, double offset, double stepsize)
 
SampleData< T > & gauss (double l, double r, double stepsize)
 
SampleData< T > & gauss (const LinearRange &r, double s, double m=0.0)
 
SampleData< T > & gauss (int n, double offset, double stepsize, double s, double m=0.0)
 
SampleData< T > & gauss (double l, double r, double stepsize, double s, double m=0.0)
 
SampleData< T > & alpha (const LinearRange &r, double tau, double offs=0.0)
 
SampleData< T > & alpha (int n, double offset, double stepsize, double tau, double offs=0.0)
 
SampleData< T > & alpha (double l, double r, double stepsize, double tau, double offs=0.0)
 
SampleData< T > & line (const LinearRange &r, double abscissa, double slope)
 
SampleData< T > & line (int n, double offset, double stepsize, double abscissa, double slope)
 
SampleData< T > & line (double l, double r, double stepsize, double abscissa, double slope)
 
SampleData< T > & rectangle (const LinearRange &r, double period, double width, double ramp=0.0)
 
SampleData< T > & rectangle (int n, double offset, double stepsize, double period, double width, double ramp=0.0)
 
SampleData< T > & rectangle (double l, double r, double stepsize, double period, double width, double ramp=0.0)
 
SampleData< T > & sawUp (const LinearRange &r, double period, double ramp=0.0)
 
SampleData< T > & sawUp (int n, double offset, double stepsize, double period, double ramp=0.0)
 
SampleData< T > & sawUp (double l, double r, double stepsize, double period, double ramp=0.0)
 
SampleData< T > & sawDown (const LinearRange &r, double period, double ramp=0.0)
 
SampleData< T > & sawDown (int n, double offset, double stepsize, double period, double ramp=0.0)
 
SampleData< T > & sawDown (double l, double r, double stepsize, double period, double ramp=0.0)
 
SampleData< T > & triangle (const LinearRange &r, double period)
 
SampleData< T > & triangle (int n, double offset, double stepsize, double period)
 
SampleData< T > & triangle (double l, double r, double stepsize, double period)
 
interpolate (double x) const
 
SampleData< T > & rampUp (double x, int type=0)
 
SampleData< T > & rampDown (double x, int type=0)
 
SampleData< T > & ramp (double x, int type=0)
 
template<typename ForwardIter >
SampleData< T > & addHist (ForwardIter first, ForwardIter last)
 
template<typename R >
SampleData< T > & addHist (const R &x)
 
template<typename ForwardIter >
SampleData< T > & hist (ForwardIter first, ForwardIter last)
 
template<typename R >
SampleData< T > & hist (const R &x)
 
template<typename R >
SampleData< T > & cumulative (const SampleData< R > &x)
 
template<typename TT >
SampleData< T > & freqFilter (const SampleData< TT > &g, bool rescale=true)
 
min (double first, double last) const
 
int minIndex (double first, double last) const
 
int minIndex (T &min, double first, double last) const
 
max (double first, double last) const
 
int maxIndex (double first, double last) const
 
int maxIndex (T &max, double first, double last) const
 
void minMax (T &min, T &max, double first, double last) const
 
void minMaxIndex (int &minindex, int &maxindex, double first, double last) const
 
void minMaxIndex (T &min, int &minindex, T &max, int &maxindex, double first, double last) const
 
numerical_traits< T >::mean_type mean (double first, double last) const
 
numerical_traits< T >::mean_type mean (typename numerical_traits< T >::variance_type &stdev, double first, double last) const
 
numerical_traits< T >
::variance_type 
variance (double first, double last) const
 
numerical_traits< T >
::variance_type 
varianceKnown (typename numerical_traits< T >::mean_type mean, double first, double last) const
 
numerical_traits< T >
::variance_type 
varianceFixed (typename numerical_traits< T >::mean_type fixedmean, double first, double last) const
 
numerical_traits< T >
::variance_type 
stdev (double first, double last) const
 
numerical_traits< T >
::variance_type 
stdevKnown (typename numerical_traits< T >::mean_type mean, double first, double last) const
 
numerical_traits< T >
::variance_type 
stdevFixed (typename numerical_traits< T >::mean_type fixedmean, double first, double last) const
 
numerical_traits< T >
::variance_type 
sem (double first, double last) const
 
numerical_traits< T >
::variance_type 
semKnown (typename numerical_traits< T >::mean_type mean, double first, double last) const
 
numerical_traits< T >
::variance_type 
semFixed (typename numerical_traits< T >::mean_type fixedmean, double first, double last) const
 
numerical_traits< T >
::variance_type 
absdev (double first, double last) const
 
numerical_traits< T >
::variance_type 
absdevKnown (typename numerical_traits< T >::mean_type mean, double first, double last) const
 
numerical_traits< T >
::variance_type 
rms (double first, double last) const
 
numerical_traits< T >
::variance_type 
skewness (double first, double last) const
 
numerical_traits< T >
::variance_type 
kurtosis (double first, double last) const
 
numerical_traits< T >::mean_type sum (double first, double last) const
 
numerical_traits< T >::mean_type integral (void) const
 
numerical_traits< T >::mean_type integral (double first, double last) const
 
numerical_traits< T >
::variance_type 
squaredSum (double first, double last) const
 
numerical_traits< T >
::variance_type 
power (double first, double last) const
 
template<typename TT >
void troughs (const SampleData< TT > &x, EventData &events, double threshold)
 
template<typename TT , class Check >
void troughs (const SampleData< TT > &x, EventData &events, double &threshold, Check &check)
 
template<typename TT >
void rising (const SampleData< TT > &x, EventData &events, double threshold)
 
template<typename TT , class Check >
void rising (const SampleData< TT > &x, EventData &events, double &threshold, Check &check)
 
template<typename TT >
void falling (const SampleData< TT > &x, EventData &events, double threshold)
 
template<typename TT , class Check >
void falling (const SampleData< TT > &x, EventData &events, double &threshold, Check &check)
 
ostream & save (ostream &str, int width=10, int prec=5, const string &start="", const string &separator=" ") const
 
void save (const string &file, int width=10, int prec=5, const string &start="", const string &separator=" ") const
 
istream & load (istream &str, const string &stop="", string *line=0)
 
SampleData< T > & load (const string &file, const string &comment="#", const string &stop="")
 
template<class COT >
const SampleData< T > & operator+= (const COT &x)
 
template<class COT >
const SampleData< T > & operator+= (const SampleData< COT > &x)
 
template<class COT >
const SampleData< T > & operator-= (const COT &x)
 
template<class COT >
const SampleData< T > & operator-= (const SampleData< COT > &x)
 
template<class COT >
const SampleData< T > & operator*= (const COT &x)
 
template<class COT >
const SampleData< T > & operator*= (const SampleData< COT > &x)
 
template<class COT >
const SampleData< T > & operator/= (const COT &x)
 
template<class COT >
const SampleData< T > & operator/= (const SampleData< COT > &x)
 
template<class COT >
const SampleData< T > & operator%= (const COT &x)
 
template<class COT >
const SampleData< T > & operator%= (const SampleData< COT > &x)
 
- Public Member Functions inherited from Array< T >
 Array (void)
 
 Array (int n)
 
 Array (int n, const T &val)
 
template<typename S >
 Array (const S *a, int n)
 
 Array (const T *a, int n)
 
template<typename S >
 Array (const vector< S > &a, int first=0, int last=-1)
 
template<typename S >
 Array (const Array< S > &a, int first=0, int last=-1)
 
 Array (const Array< T > &a)
 
 Array (const LinearRange &range)
 
virtual ~Array (void)
 
template<typename S >
const Array< T > & operator= (const S &a)
 
const Array< T > & operator= (const LinearRange &range)
 
const Array< T > & operator= (const Array< T > &a)
 
template<typename S >
const Array< T > & assign (const S *a, int n)
 
const Array< T > & assign (const T *a, int n)
 
template<typename S >
const Array< T > & assign (const S &a)
 
const Array< T > & assign (const Array< T > &a)
 
const Array< T > & assign (const Array< T > &a, int first, int last=-1)
 
const Array< T > & assign (const LinearRange &range)
 
Array< T > & zeros (int n)
 
Array< T > & ones (int n)
 
template<typename R >
Array< T > & rand (int n, R &r=rnd)
 
template<typename R >
Array< T > & randNorm (int n, R &r=rnd)
 
template<typename S >
const Array< T > & copy (S *a, int n, const S &val=0) const
 
const Array< T > & copy (T *a, int n, const T &val=0) const
 
template<typename S >
const Array< T > & copy (S &a) const
 
template<typename S >
const Array< T > & copy (Array< S > &a) const
 
const Array< T > & append (T a, int n=1)
 
template<typename S >
const Array< T > & append (const S *a, int n)
 
const Array< T > & append (const T *a, int n)
 
template<typename S >
const Array< T > & append (const S &a)
 
const Array< T > & append (const Array< T > &a)
 
const Array< T > & repeat (int n)
 
int size (void) const
 
bool empty (void) const
 
int capacity (void) const
 
int maxCapacity (void) const
 
const T & operator[] (int i) const
 
T & operator[] (int i)
 
const T & at (int i) const
 
T & at (int i)
 
const T & front (void) const
 
T & front (void)
 
const T & back (void) const
 
T & back (void)
 
int push (const T &val)
 
template<typename R >
int push (const R &x)
 
pop (void)
 
const T * data (void) const
 
T * data (void)
 
iterator begin (void)
 
const_iterator begin (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
Array< T > & insert (int i, const T &v)
 
iterator insert (iterator i, const T &v)
 
Array< T > & erase (int i)
 
iterator erase (iterator i)
 
Array< T > & sortedIndex (Array< int > &indices, int first=0, int last=-1)
 
 CONTAINEROPS1SCALARDEC (Array< T >, operator=)
 
 CONTAINEROPS1DEC (Array< T >, operator+=)
 
 CONTAINEROPS1DEC (Array< T >, operator-=)
 
 CONTAINEROPS1DEC (Array< T >, operator*=)
 
 CONTAINEROPS1DEC (Array< T >, operator/=)
 
 CONTAINEROPS1DEC (Array< T >, operator%=)
 
 CONTAINEROPS2DEC (class TT, Array< TT >, operator+)
 
 CONTAINEROPS2DEC (class TT, Array< TT >, operator-)
 
 CONTAINEROPS2DEC (class TT, Array< TT >, operator*)
 
 CONTAINEROPS2DEC (class TT, Array< TT >, operator/)
 
 CONTAINEROPS2DEC (class TT, Array< TT >, operator%)
 
Array< T > operator- (void)
 
Array< T > & sin (void)
 
Array< T > & cos (void)
 
Array< T > & tan (void)
 
Array< T > & asin (void)
 
Array< T > & acos (void)
 
Array< T > & atan (void)
 
Array< T > & sinh (void)
 
Array< T > & cosh (void)
 
Array< T > & tanh (void)
 
Array< T > & asinh (void)
 
Array< T > & acosh (void)
 
Array< T > & atanh (void)
 
Array< T > & exp (void)
 
Array< T > & log (void)
 
Array< T > & log10 (void)
 
Array< T > & erf (void)
 
Array< T > & erfc (void)
 
Array< T > & sqrt (void)
 
Array< T > & cbrt (void)
 
Array< T > & square (void)
 
Array< T > & cube (void)
 
 CONTAINERFUNC1DEC (Array< T >, pow)
 
Array< T > & exp (double base)
 
Array< T > & ceil (void)
 
Array< T > & floor (void)
 
Array< T > & abs (void)
 
Array< T > & decibel (double level=0.0)
 
Array< T > & linear (double level)
 
Array< T > & averageAdd (const Array< T > &a, int n)
 
Array< T > & averageAdd (const Array< T > &a, int n, Array< T > &sq)
 
Array< T > & averageAdd (const Array< T > &a, int n, Array< T > &sq, Array< T > &sd)
 
min (int first=0, int last=-1) const
 
int minIndex (int first=0, int last=-1) const
 
int minIndex (T &min, int first=0, int last=-1) const
 
max (int first=0, int last=-1) const
 
int maxIndex (int first=0, int last=-1) const
 
int maxIndex (T &max, int first=0, int last=-1) const
 
void minMax (T &min, T &max, int first=0, int last=-1) const
 
void minMaxIndex (int &minindex, int &maxindex, int first=0, int last=-1) const
 
void minMaxIndex (T &min, int &minindex, T &max, int &maxindex, int first=0, int last=-1) const
 
numerical_traits< T >::mean_type mean (int first=0, int last=-1) const
 
numerical_traits< T >::mean_type mean (typename numerical_traits< T >::variance_type &stdev, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
variance (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
varianceKnown (typename numerical_traits< T >::mean_type mean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
varianceFixed (typename numerical_traits< T >::mean_type fixedmean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
stdev (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
stdevKnown (typename numerical_traits< T >::mean_type mean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
stdevFixed (typename numerical_traits< T >::mean_type fixedmean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
sem (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
semKnown (typename numerical_traits< T >::mean_type mean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
semFixed (typename numerical_traits< T >::mean_type fixedmean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
absdev (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
absdevKnown (typename numerical_traits< T >::mean_type mean, int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
rms (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
skewness (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
kurtosis (int first=0, int last=-1) const
 
sum (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
squaredSum (int first=0, int last=-1) const
 
numerical_traits< T >
::variance_type 
power (int first=0, int last=-1) const
 
double rank (int first=0, int last=-1)
 
ostream & save (ostream &str, int width=10, int prec=5) const
 
void save (const string &file, int width=10, int prec=5) const
 
istream & load (istream &str, const string &stop="", string *line=0)
 
Array< T > & load (const string &file, const string &stop="")
 

Static Public Attributes

static const string RampStrings = "linear|square|sqrt|cosine"
 

Friends

template<typename TT >
bool operator== (const SampleData< TT > &a, const SampleData< TT > &b)
 
template<typename TT >
bool operator< (const SampleData< TT > &a, const SampleData< TT > &b)
 
template<typename TT , typename RR >
SampleData< TT > operator+ (const SampleData< TT > &x, const RR &y)
 
template<typename TT >
SampleData< TT > operator+ (float x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, float y)
 
template<typename TT >
SampleData< TT > operator+ (double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, double y)
 
template<typename TT >
SampleData< TT > operator+ (long double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, long double y)
 
template<typename TT >
SampleData< TT > operator+ (signed char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, signed char y)
 
template<typename TT >
SampleData< TT > operator+ (unsigned char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, unsigned char y)
 
template<typename TT >
SampleData< TT > operator+ (signed int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, signed int y)
 
template<typename TT >
SampleData< TT > operator+ (unsigned int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, unsigned int y)
 
template<typename TT >
SampleData< TT > operator+ (signed long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, signed long y)
 
template<typename TT >
SampleData< TT > operator+ (unsigned long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator+ (const SampleData< TT > &x, unsigned long y)
 
template<typename TT , typename RR >
SampleData< TT > operator- (const SampleData< TT > &x, const RR &y)
 
template<typename TT >
SampleData< TT > operator- (float x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, float y)
 
template<typename TT >
SampleData< TT > operator- (double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, double y)
 
template<typename TT >
SampleData< TT > operator- (long double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, long double y)
 
template<typename TT >
SampleData< TT > operator- (signed char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, signed char y)
 
template<typename TT >
SampleData< TT > operator- (unsigned char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, unsigned char y)
 
template<typename TT >
SampleData< TT > operator- (signed int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, signed int y)
 
template<typename TT >
SampleData< TT > operator- (unsigned int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, unsigned int y)
 
template<typename TT >
SampleData< TT > operator- (signed long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, signed long y)
 
template<typename TT >
SampleData< TT > operator- (unsigned long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator- (const SampleData< TT > &x, unsigned long y)
 
template<typename TT , typename RR >
SampleData< TT > operator* (const SampleData< TT > &x, const RR &y)
 
template<typename TT >
SampleData< TT > operator* (float x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, float y)
 
template<typename TT >
SampleData< TT > operator* (double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, double y)
 
template<typename TT >
SampleData< TT > operator* (long double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, long double y)
 
template<typename TT >
SampleData< TT > operator* (signed char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, signed char y)
 
template<typename TT >
SampleData< TT > operator* (unsigned char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, unsigned char y)
 
template<typename TT >
SampleData< TT > operator* (signed int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, signed int y)
 
template<typename TT >
SampleData< TT > operator* (unsigned int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, unsigned int y)
 
template<typename TT >
SampleData< TT > operator* (signed long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, signed long y)
 
template<typename TT >
SampleData< TT > operator* (unsigned long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator* (const SampleData< TT > &x, unsigned long y)
 
template<typename TT , typename RR >
SampleData< TT > operator/ (const SampleData< TT > &x, const RR &y)
 
template<typename TT >
SampleData< TT > operator/ (float x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, float y)
 
template<typename TT >
SampleData< TT > operator/ (double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, double y)
 
template<typename TT >
SampleData< TT > operator/ (long double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, long double y)
 
template<typename TT >
SampleData< TT > operator/ (signed char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, signed char y)
 
template<typename TT >
SampleData< TT > operator/ (unsigned char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, unsigned char y)
 
template<typename TT >
SampleData< TT > operator/ (signed int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, signed int y)
 
template<typename TT >
SampleData< TT > operator/ (unsigned int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, unsigned int y)
 
template<typename TT >
SampleData< TT > operator/ (signed long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, signed long y)
 
template<typename TT >
SampleData< TT > operator/ (unsigned long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator/ (const SampleData< TT > &x, unsigned long y)
 
template<typename TT , typename RR >
SampleData< TT > operator% (const SampleData< TT > &x, const RR &y)
 
template<typename TT >
SampleData< TT > operator% (float x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, float y)
 
template<typename TT >
SampleData< TT > operator% (double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, double y)
 
template<typename TT >
SampleData< TT > operator% (long double x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, long double y)
 
template<typename TT >
SampleData< TT > operator% (signed char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, signed char y)
 
template<typename TT >
SampleData< TT > operator% (unsigned char x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, unsigned char y)
 
template<typename TT >
SampleData< TT > operator% (signed int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, signed int y)
 
template<typename TT >
SampleData< TT > operator% (unsigned int x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, unsigned int y)
 
template<typename TT >
SampleData< TT > operator% (signed long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, signed long y)
 
template<typename TT >
SampleData< TT > operator% (unsigned long x, const SampleData< TT > &y)
 
template<typename TT >
SampleData< TT > operator% (const SampleData< TT > &x, unsigned long y)
 
SampleData sin (const LinearRange &r, double f, double p)
 
SampleData sin (int n, double offset, double stepsize, double f, double p)
 
SampleData sin (double l, double r, double stepsize, double f, double p)
 
SampleData cos (const LinearRange &r, double f, double p)
 
SampleData cos (int n, double offset, double stepsize, double f, double p)
 
SampleData cos (double l, double r, double stepsize, double f, double p)
 
SampleData sweep (const LinearRange &r, double startfreq, double endfreq)
 
SampleData sweep (int n, double offset, double stepsize, double startfreq, double endfreq)
 
SampleData sweep (double l, double r, double stepsize, double startfreq, double endfreq)
 
SampleData gauss (const LinearRange &r)
 
SampleData gauss (int n, double offset, double stepsize)
 
SampleData gauss (double l, double r, double stepsize)
 
SampleData gauss (const LinearRange &r, double s, double m)
 
SampleData gauss (int n, double offset, double stepsize, double s, double m)
 
SampleData gauss (double l, double r, double stepsize, double s, double m)
 
SampleData alpha (const LinearRange &r, double tau, double offs)
 
SampleData alpha (int n, double offset, double stepsize, double tau, double offs)
 
SampleData alpha (double l, double r, double stepsize, double tau, double offs)
 
SampleData line (const LinearRange &r, double abscissa, double slope)
 
SampleData line (int n, double offset, double stepsize, double abscissa, double slope)
 
SampleData line (double l, double r, double stepsize, double abscissa, double slope)
 
SampleData rectangle (const LinearRange &r, double period, double width, double ramp)
 
SampleData rectangle (int n, double offset, double stepsize, double period, double width, double ramp)
 
SampleData rectangle (double l, double r, double stepsize, double period, double width, double ramp)
 
SampleData sawUp (const LinearRange &r, double period, double ramp)
 
SampleData sawUp (int n, double offset, double stepsize, double period, double ramp)
 
SampleData sawUp (double l, double r, double stepsize, double period, double ramp)
 
SampleData sawDown (const LinearRange &r, double period, double ramp)
 
SampleData sawDown (int n, double offset, double stepsize, double period, double ramp)
 
SampleData sawDown (double l, double r, double stepsize, double period, double ramp)
 
SampleData triangle (const LinearRange &r, double period)
 
SampleData triangle (int n, double offset, double stepsize, double period)
 
SampleData triangle (double l, double r, double stepsize, double period)
 
template<typename TT , typename RR >
SampleData< TT > convolve (const SampleData< TT > &x, const RR &y, int offs)
 
template<typename TT >
SampleData< TT > convolve (const SampleData< TT > &x, const SampleData< TT > &y)
 
template<typename TT , typename SS >
void hcPower (const SampleData< TT > &hc, SampleData< SS > &p)
 
template<typename TT , typename SS >
void hcMagnitude (const SampleData< TT > &hc, SampleData< SS > &m)
 
template<typename TT , typename SS >
void hcPhase (const SampleData< TT > &hc, SampleData< SS > &p)
 
template<typename TT , typename SS >
void hcReal (const SampleData< TT > &hc, SampleData< SS > &r)
 
template<typename TT , typename SS >
void hcImaginary (const SampleData< TT > &hc, SampleData< SS > &i)
 
template<typename TT >
int rFFT (SampleData< TT > &x)
 
template<typename TT , typename SS >
int rPSD (const SampleData< TT > &x, SampleData< SS > &p, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int transfer (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &h, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int transfer (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &h, SampleData< RR > &c, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int gain (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &g, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int coherence (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &c, bool overlap, double(*window)(int j, int n))
 
template<typename RR >
double coherenceInfo (const SampleData< RR > &c, double f0, double f1)
 
template<typename TT , typename SS , typename RR >
int rCSD (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &cps, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int spectra (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &g, SampleData< RR > &c, SampleData< RR > &yps, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int spectra (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &g, SampleData< RR > &c, SampleData< RR > &cps, SampleData< RR > &xps, SampleData< RR > &yps, bool overlap, double(*window)(int j, int n))
 
template<typename TT , typename SS , typename RR >
int crossSpectra (const SampleData< TT > &x, const SampleData< SS > &y, SampleData< RR > &cs, SampleData< RR > &xps, SampleData< RR > &yps, bool overlap, double(*window)(int j, int n))
 
template<typename TT >
void coherence (const SampleData< TT > &cp, const SampleData< TT > &xp, const SampleData< TT > &yp, SampleData< TT > &c)
 
template<typename TT >
void average (SampleData< TT > &meantrace, const vector< SampleData< TT > > &traces)
 
template<typename TT >
void average (SampleData< TT > &meantrace, SampleData< TT > &stdev, const vector< SampleData< TT > > &traces)
 
template<typename TT >
void peaksTroughs (const SampleData< TT > &x, EventData &peaks, EventData &troughs, double threshold)
 
template<typename TT , class Check >
void peaksTroughs (const SampleData< TT > &x, EventData &peaks, EventData &troughs, double &threshold, Check &check)
 
template<typename TT >
void peaks (const SampleData< TT > &x, EventData &events, double threshold)
 
template<typename TT , class Check >
void peaks (const SampleData< TT > &x, EventData &events, double &threshold, Check &check)
 
template<typename TT >
ostream & operator<< (ostream &str, const SampleData< TT > &a)
 
template<typename TT >
istream & operator>> (istream &str, SampleData< TT > &a)
 

Detailed Description

template<typename T>
class relacs::SampleData< T >

A template defining an one-dimensional Array of data with an associated Range.

Author
Jan Benda
Todo:

colored noise

interface to class Kernel

Handle mismatch of stepsize() in various functions.

SampleData is an Array of data elements of type T and owns a LinearRange. Each element of the LinearRange has an corresponding element in the Array. SampleData is thus suited to store and handle evenly sampled data values.

For initializing a SampleData with a function, several interfaces are implemented. For example, creating a SampleData with a range from 0.0 to 1.0, sampled every 0.01 and initialized with a sine wave of frequency f, the following alternatives are all possible and lead to the same result:

x = sin( LinearRange( 0.0, 1.0, 0.01 ), f );
x = sin( 0.0, 1.0, 0.01, f );
x = sin( 100, 0.0, 0.01 ), f );
SampleDataD y( 0.0, 1.0, 0.01 );
x = sin( y.range(), f );
z.sin( LinearRange( 0.0, 1.0, 0.01 ), f );
z.sin( 0.0, 1.0, 0.01, f );
z.sin( 100, 0.0, 0.01, f );

The following functions are supported in this way: sin(), cos(), gauss(), alpha(), line(), rectangle(), sawUp(), sawDown(), and triangle().

The more general interface for computations with mathematical functions is defined in basefuncs.h and operates directly on the array. The range is neither affected nor used.

#include <relacs/basefuncs.h>
SampleDataD y( 0.0, 1.0, 0.01 );
y.identity();
SampleDataD x = sin( y, f ) - 0.3*cos( 2.0*pi*f*y ) + exp( -0.5*y );

The following functions are available: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, exp, log, log10, erf, erfc, sqrt, cbrt, hypot, square, cube, pow, ceil, floor, abs The following operators are available: +, -, *, /, % .

Member Typedef Documentation

typedef T value_type

The type of object, T, stored in the arry.

typedef T* pointer

Pointer to the type of object, T, stored in the array.

typedef T& reference

Reference to the type of object, T, stored in the array.

typedef const T& const_reference

Const reference to the type of object, T, stored in the array.

typedef int size_type

The type used for sizes and indices.

typedef T* iterator

Iterator used to iterate through the data array.

typedef const T* const_iterator

Const iterator used to iterate through the data array.

typedef double range_type

The type of an element of the range.

Const iterator used to iterate through the range.

Constructor & Destructor Documentation

SampleData ( void  )

Creates an empty SampleData.

SampleData ( int  n,
const T &  val = 0 
)

Creates a SampleData with n data elements and initialzes them with val.

SampleData ( long  n,
const T &  val = 0 
)

Creates a SampleData with n data elements that were sampled with stepsize starting at offset and initialzes them with val.

SampleData ( int  n,
double  offset,
double  stepsize,
const T &  val = 0 
)

Creates a SampleData with n data elements that were sampled with stepsize starting at offset and initialzes them with val.

SampleData ( long  n,
double  offset,
double  stepsize,
const T &  val = 0 
)

Creates a SampleData with n data elements that were sampled with stepsize starting at offset and initialzes them with val.

SampleData ( double  l,
double  r,
double  stepsize,
const T &  val = 0 
)

Creates a SampleData of data elements that were sampled with stepsize starting at l and ending at r, and initialzes them with val.

References Array< T >::resize(), and LinearRange::size().

SampleData ( const LinearRange range,
const T &  val = 0 
)

Creates a SampleData with the range range and each data element initialized with val.

References Array< T >::resize(), and LinearRange::size().

SampleData ( const R *  a,
int  n,
double  offset = 0,
double  stepsize = 1 
)

Creates a SampleData with n data elements that were sampled with stepsize starting at offset and initialzes them with the values given in a.

SampleData ( const R *  a,
int  n,
const LinearRange range 
)

Creates a SampleData with n data elements that were sampled according to range and initialzes them with the values given in a.

References LinearRange::resize().

SampleData ( const vector< R > &  a,
double  offset = 0,
double  stepsize = 1 
)

Creates a SampleData with the same size and content as the vector a that was sampled with stepsize starting at offset.

SampleData ( const vector< R > &  a,
const LinearRange range 
)

Creates a SampleData with the same size and content as the vector a that was sampled according to range.

References LinearRange::resize().

SampleData ( const Array< R > &  a,
double  offset = 0,
double  stepsize = 1 
)

Creates a SampleData with the same size and content as the array a that was sampled with stepsize starting at offset.

SampleData ( const Array< R > &  a,
const LinearRange range 
)

Creates a SampleData with the same size and content as the array a that was sampled according to range.

References LinearRange::resize(), and Array< T >::size().

SampleData ( const SampleData< R > &  sa)

Creates a SampleData with the same size, range, and content as sa.

SampleData ( const SampleData< R > &  sa,
const LinearRange range 
)

Creates a SampleData from sa resampled according to range.

SampleData ( const SampleData< T > &  sa)

Copy constructor. Creates a SampleData with the same size, range, and content as sa.

~SampleData ( void  )
virtual

The destructor.

Member Function Documentation

const SampleData< T > & operator= ( const R &  a)

Set the size(), capacity() and content of the array to a without affecting the offset() and stepsize().

See Also
assign()
const SampleData< T > & operator= ( const SampleData< R > &  a)

Set the size(), capacity(), range() and content of the array to a.

See Also
assign()
const SampleData< T > & operator= ( const SampleData< T > &  a)

Set the size(), capacity(), range() and content of the array to a.

See Also
assign()
const SampleData< T > & assign ( const R *  a,
int  n 
)

Set the size() and capacity() of the array to n and its content to a without affecting the offset() and stepsize().

References Array< T >::assign().

const SampleData< T > & assign ( const R *  a,
int  n,
double  offset,
double  stepsize = 1 
)

Set the size() and capacity() of the array to n and its content to a. The range is set to start at offset with a stepsize stepsize.

References Array< T >::assign().

const SampleData< T > & assign ( const R &  a)

Set the size(), capacity(), and content of the array to a without affecting the offset() and stepsize().

References Array< T >::assign().

const SampleData< T > & assign ( const R &  a,
double  offset,
double  stepsize = 1 
)

Set the size(), capacity(), and content of the array to a. The range is set to start at offset with a stepsize stepsize.

References Array< T >::assign().

const SampleData< T > & assign ( const SampleData< R > &  sa)

Set the size(), capacity(), range(), and content of the array to sa.

References Array< T >::assign().

const SampleData< T > & assign ( const SampleData< T > &  sa)

Set the size(), capacity(), range(), and content of the array to sa.

References Array< T >::assign().

const SampleData< T > & interpolate ( const SampleData< R > &  sa)

Assign the content of the array sa resampled over the range of this.

Referenced by relacs::KSTest().

const SampleData< T >& interpolate ( const SampleData< R > &  sa,
double  stepsize 
)
inline

Assign the array sa resampled with stepsize stepsize and linearly interpolated.

const SampleData< T > & interpolate ( const SampleData< R > &  sa,
double  offset,
double  stepsize 
)

Assign the array sa resampled with stepsize and linearly interpolated starting from offset.

References relacs::ceil().

const SampleData< T > & interpolate ( const SampleData< R > &  sa,
const LinearRange range 
)

Assign the array sa resampled over the range and linearly interpolated.

const SampleData< T > & interpolate ( const Map< R > &  ma)

Assign the content of the map ma resampled over the range of this.

References Map< T >::empty(), Map< T >::size(), Map< T >::x(), and Map< T >::y().

const SampleData< T > & interpolate ( const Map< R > &  ma,
const LinearRange range 
)

Assign the map ma resampled over the range and linearly interpolated.

References Map< T >::empty(), Map< T >::size(), Map< T >::x(), and Map< T >::y().

const SampleData< T > & smooth ( const SampleData< R > &  sa,
int  n 
)

Assign the content and the range of the array sa to this smoothed by a running average over n data points (symmetrically) .

const SampleData< T > & smooth ( const SampleData< R > &  sa,
const ArrayD weights,
int  nl 
)

Assign the content and the range of the array sa to this smoothed by summing over weights.size() data elements weighted by weight starting nl points left of the current data element (exclusively). You can construct the weights, for example, by means of the savitzkyGolay() function defined in fitalgorithm.h .

References Array< T >::begin(), Array< T >::empty(), and Array< T >::end().

SampleData< T > & whiteNoise ( int  n,
double  step,
double  cl,
double  cu,
R &  r = rnd 
)

Resize the array to n data elements sampled with stepsize step and initialize the data elements with Gaussian distributed white noise with zero mean and unit standard deviation, lower and upper cutoff frequency cl and cu. Use random number generator r.

See Also
ouNoise(), Array::zeros(), Array::ones(), Array::rand(), Array::randNorm()

References relacs::ceil(), relacs::hcFFT(), relacs::log(), and relacs::sqrt().

SampleData< T > & whiteNoise ( double  l,
double  step,
double  cl,
double  cu,
R &  r = rnd 
)

Resize the array to hold l / step data elements sampled with stepsize step and initialize the data elements with Gaussian distributed white noise with zero mean and unit standard deviation, lower and upper cutoff frequency cl and cu. Use random number generator r.

See Also
ouNoise(), Array::zeros(), Array::ones(), Array::rand(), Array::randNorm()
SampleData< T > & ouNoise ( int  n,
double  step,
double  tau,
R &  r = rnd 
)

Resize the array to n data elements sampled with stepsize step and initialize the data elements with Ornstein-Uhlenbeck noise with zero mean and unit standard deviation and time constant tau. Use random number generator r. Algorithmus from L. Bartosch (2001), International Journal of Modern Physics C, 12, 851-855.

See Also
whiteNoise(), Array::zeros(), Array::ones(), Array::rand(), Array::randNorm()

References relacs::exp(), Array< T >::randNorm(), and relacs::sqrt().

SampleData< T > & ouNoise ( double  l,
double  step,
double  tau,
R &  r = rnd 
)

Resize the array to hold l / step data elements sampled with stepsize step and initialize the data elements with Ornstein-Uhlenbeck noise with zero mean and unit standard deviation and time constant tau. Use random number generator r. Algorithmus from L. Bartosch (2001), International Journal of Modern Physics C, 12, 851-855.

See Also
whiteNoise(), Array::zeros(), Array::ones(), Array::rand(), Array::randNorm()
const SampleData< T > & copy ( R *  a,
int  n,
const T &  val = 0 
) const

Copy the content of the array to a. If necessary remaining elements of a are set to val.

References Array< T >::copy().

const SampleData< T > & copy ( R &  a) const

Copy the content of the array to a.

References Array< T >::copy().

const SampleData< T > & copy ( SampleData< R > &  sa) const

Copy the content and range of the array to sa. The size() and capacity() of are set to the size() of the array.

const SampleData< T > & copy ( double  x1,
double  x2,
SampleData< R > &  sa 
) const

Copy the content of the array from position x1 to x2 to sa.

const SampleData< T > & copy ( double  x1,
double  x2,
Map< R > &  m 
) const

Copy the content of the array from position x1 to x2 to m.

References Map< T >::clear(), Map< T >::push(), and Map< T >::reserve().

const SampleData< T > & copy ( double  x1,
double  x2,
Array< R > &  a 
) const

Copy the content of the array from position x1 to x2 to a.

References Array< T >::clear(), Array< T >::push(), and Array< T >::reserve().

const SampleData< T > & copy ( double  x1,
double  x2,
vector< R > &  v 
) const

Copy the content of the array from position x1 to x2 to v.

const SampleData< T > & append ( a,
int  n = 1 
)

Append n - times to the array.

References Array< T >::append().

const SampleData< T > & append ( const R *  a,
int  n 
)

Append a of size n to the array.

References Array< T >::append().

const SampleData< T > & append ( const R &  a)

Append a to the array.

References Array< T >::append().

const SampleData< T > & append ( const SampleData< R > &  sa)

Append sa to the array. If the stepsize of sa differs, then sa is resampled with linear interpolation.

References Array< T >::append().

int size ( void  ) const
inline
bool empty ( void  ) const
inline

True if the array does not contain any data elements.

int resize ( int  n,
const T &  val = 0 
)
virtual

Resize the array to n data elements such that the size() of the array equals n. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). The offset() and the stepsize() are preserved.

Returns
the new size() (might be smaller than n).

Reimplemented from Array< T >.

References Array< T >::resize().

Referenced by EventList::spectra(), and EventList::spectrum().

int resize ( long  n,
const T &  val = 0 
)

Resize the array to n data elements such that the size() of the array equals n. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). The offset() and the stepsize() are preserved.

Returns
the new size() (might be smaller than n).

References Array< T >::resize().

int resize ( int  n,
double  offset,
double  stepsize,
const T &  val = 0 
)

Resize the array to n data elements such that the size() of the array equals n. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). If stepsize > 0.0 the stepsize is changed to stepsize. The offset is set to offset.

Returns
the new size() (might be smaller than n).

References Array< T >::resize().

int resize ( long  n,
double  offset,
double  stepsize,
const T &  val = 0 
)

Resize the array to n data elements such that the size() of the array equals n. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). If stepsize > 0.0 the stepsize is changed to stepsize. The offset is set to offset.

Returns
the new size() (might be smaller than n).

References Array< T >::resize().

int resize ( double  l,
double  r,
double  stepsize,
const T &  val = 0 
)

Resize the array to the length() r - l. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). If stepsize > 0.0 the stepsize is changed to stepsize. The offset is set to l.

Returns
the new size() (might be smaller than n).

References Array< T >::resize().

int resize ( const LinearRange range,
const T &  val = 0 
)

Resize the array to the size of range. Data values are preserved and new data values are initialized with val. If the capacity() is smaller than n new memory is allocated with reserve(). The stepsize and the offset are set to the stepsize and the offset of range, respectively.

Returns
the new size() (might be smaller than n).

References Array< T >::resize().

void clear ( void  )
virtual

Resize the array to zero length. The capacity() remains unchanged.

Reimplemented from Array< T >.

References Array< T >::clear().

Referenced by EventList::average(), EventData::average(), and EventList::intervals().

int capacity ( void  ) const
inline

The capacity of the array, i.e. the number of data elements for which memory has been allocated. capacity() is always greater than or equal to size().

int reserve ( int  n)
virtual

If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged and the content of the array is preserved.

Returns
the new capacity.

Reimplemented from Array< T >.

References Array< T >::reserve().

Referenced by EventList::average(), and EventList::intervals().

void free ( int  n = 0)
virtual

In contrast to the reserve() function, this function frees or allocates memory, such that capacity() equals exactly n. If the size() of the array is greater than n it is set to n as well.

Reimplemented from Array< T >.

References Array< T >::free().

double offset ( void  ) const
inline

The offset of the range.

void setOffset ( double  offset)
inline

Set the offset of the range to offset.

Referenced by EventList::spectra(), and EventList::spectrum().

double stepsize ( void  ) const
inline
void setStepsize ( double  stepsize)
inline

Set the stepsize of the range to stepsize. This also changes length() and rangeBack().

Referenced by EventList::spectra(), and EventList::spectrum().

void scaleStepsize ( double  scale)
inline

Multiply the stepsize of the range by scale and adjust the size of the range appropriately. This does not change offset(), length(), and rangeBack().

void setRange ( double  offset,
double  stepsize 
)
inline

Set the offset and the stepsize of the range to offset and stepsize, respectively.

double length ( void  ) const
inline
void setLength ( double  l)

Set the size of the range such that it has the length l. The array is resized accordingly.

See Also
resize()

References relacs::ceil(), and Array< T >::resize().

double rangeFront ( void  ) const
inline
double rangeBack ( void  ) const
inline
void setRangeBack ( double  val)
inline

Resize the range such that it last value equals val.

void shift ( double  val)
inline

Add val to the offset of the range, i.e. shift the range by val.

void scale ( double  scale)
inline

Multiply the offset and the stepsize of the range with scale, i.e. rescale the range by scale.

References SampleData< T >::scale().

Referenced by SampleData< T >::scale().

double pos ( int  i) const
inline
double interval ( int  indices) const
inline

Returns the interval covered by indices indices.

Referenced by EventData::addCyclicRate(), EventData::addRate(), and EventData::rate().

int index ( double  pos) const
inline

The index of the range corresponding to pos.

Referenced by EventData::addCyclicRate(), EventData::addIntervalHistogram(), EventData::addRate(), and EventData::rate().

int indices ( double  iv) const
inline

The number of indices corresponding to an interval iv.

Referenced by EventData::addCyclicRate(), EventData::addRate(), and EventData::rate().

bool contains ( double  pos) const
inline

True if pos is within the range.

const T& operator[] ( int  i) const
inline

Returns a reference to the data element at index i. No range checking is performed.

T& operator[] ( int  i)
inline

Returns a reference to the data element at index i. No range checking is performed.

const T& at ( int  i) const
inline

Returns a reference to the data element at index i. If i is an invalid index a reference to a variable set to zero is returned.

T& at ( int  i)
inline

Returns a reference to the data element at index i. If i is an invalid index a reference to a variable set to zero is returned.

const T& operator[] ( double  x) const
inline

Returns a reference to the data element left to position x. No range checking is performed.

T& operator[] ( double  x)
inline

Returns a reference to the data element left to position x. No range checking is performed.

T operator() ( double  x) const
inline

Returns an linearly interpolated value of the data array at position x.

const T& front ( void  ) const
inline

Returns a reference to the first data element. If the array is empty a reference to a variable set to zero is returned.

T& front ( void  )
inline

Returns a reference to the first data element. If the array is empty a reference to a variable set to zero is returned.

const T& back ( void  ) const
inline

Returns a reference to the last data element. If the array is empty a reference to a variable set to zero is returned.

Referenced by EventList::average(), and EventData::average().

T& back ( void  )
inline

Returns a reference to the last data element. If the array is empty a reference to a variable set to zero is returned.

int push ( const T &  val)
inline

Add val as a new element to the array.

Returns
the number of added elements (0 or 1).

References Array< T >::push().

Referenced by EventList::intervals().

T pop ( void  )

Remove the last element of the array and return its value.

References Array< T >::pop().

const T* data ( void  ) const
inline

Returns a pointer to the data buffer.

T* data ( void  )
inline

Returns a pointer to the data buffer.

const Array<T>& array ( void  ) const
inline

Returns a reference to the data array.

Referenced by Map< T >::assign().

Array<T>& array ( void  )
inline

Returns a reference to the data array.

const LinearRange& range ( void  ) const
inline
LinearRange& range ( void  )
inline

Returns a reference to the range.

iterator begin ( void  )
inline

Returns an iterator pointing to the first element of the array.

Referenced by relacs::alpha(), relacs::cos(), relacs::gauss(), relacs::line(), relacs::rectangle(), relacs::sawDown(), relacs::sawUp(), relacs::sin(), relacs::sweep(), and relacs::triangle().

const_iterator begin ( void  ) const
inline

Returns an const_iterator pointing to the first element of the array.

iterator end ( void  )
inline

Returns an iterator pointing behind the last element of the array.

Referenced by relacs::alpha(), relacs::cos(), relacs::gauss(), relacs::line(), relacs::rectangle(), relacs::sawDown(), relacs::sawUp(), relacs::sin(), relacs::sweep(), and relacs::triangle().

const_iterator end ( void  ) const
inline

Returns an const_iterator pointing behind the last element of the array.

const_range_iterator rangeBegin ( void  ) const
inline

Returns an const_iterator pointing to the first element of the array.

const_range_iterator rangeEnd ( void  ) const
inline

Returns an const_iterator pointing behind the last element of the array.

SampleData< T > & insert ( int  i,
const T &  yval 
)

Insert the data element yval at position i.

References Array< T >::insert().

SampleData< T >::iterator insert ( iterator  i,
const T &  yval 
)

Insert the data element yval at position i.

SampleData< T > & erase ( int  i)

Remove data element at position i from the Array.

References Array< T >::erase().

SampleData< T >::iterator erase ( iterator  i)

Remove data element at position i from the Array.

const SampleData< T > & operator= ( float  x)

Set the value of each data element to val.

const SampleData< T > & operator= ( double  x)
const SampleData< T > & operator= ( long double  x)
const SampleData< T > & operator= ( signed char  x)
const SampleData< T > & operator= ( unsigned char  x)
const SampleData< T > & operator= ( signed int  x)
const SampleData< T > & operator= ( unsigned int  x)
const SampleData< T > & operator= ( signed long  x)
const SampleData< T > & operator= ( unsigned long  x)
const SampleData< T >& operator+= ( const R &  x)

Add each value of the container x to the corresponding data element.

const SampleData< T >& operator+= ( const SampleData< R > &  x)

Add each value of the container x to the corresponding data element. Also copies the range (offset(), size(), and stepsize()) of x to this.

const SampleData< T > & operator+= ( float  x)

Add x to each of the data elements. x is a scalar type like float, double, int, etc.

const SampleData< T > & operator+= ( double  x)
const SampleData< T > & operator+= ( long double  x)
const SampleData< T > & operator+= ( signed char  x)
const SampleData< T > & operator+= ( unsigned char  x)
const SampleData< T > & operator+= ( signed int  x)
const SampleData< T > & operator+= ( unsigned int  x)
const SampleData< T > & operator+= ( signed long  x)
const SampleData< T > & operator+= ( unsigned long  x)
const SampleData< T >& operator-= ( const R &  x)

Subtract each value of the container x from the corresponding data element.

const SampleData< T >& operator-= ( const SampleData< R > &  x)

Subtract each value of the container x from the corresponding data element. Also copies the range (offset(), size(), and stepsize()) of x to this.

const SampleData< T > & operator-= ( float  x)

Subtract x from each of the data elements. x is a scalar type like float, double, int, etc.

const SampleData< T > & operator-= ( double  x)
const SampleData< T > & operator-= ( long double  x)
const SampleData< T > & operator-= ( signed char  x)
const SampleData< T > & operator-= ( unsigned char  x)
const SampleData< T > & operator-= ( signed int  x)
const SampleData< T > & operator-= ( unsigned int  x)
const SampleData< T > & operator-= ( signed long  x)
const SampleData< T > & operator-= ( unsigned long  x)
const SampleData< T >& operator*= ( const R &  x)

Multiply each value of the container x with the corresponding data element.

const SampleData< T >& operator*= ( const SampleData< R > &  x)

Multiply each value of the container x with the corresponding data element. Also copies the range (offset(), size(), and stepsize()) of x to this.

const SampleData< T > & operator*= ( float  x)

Multiply x with each of the data elements. x is a scalar type like float, double, int, etc.

const SampleData< T > & operator*= ( double  x)
const SampleData< T > & operator*= ( long double  x)
const SampleData< T > & operator*= ( signed char  x)
const SampleData< T > & operator*= ( unsigned char  x)
const SampleData< T > & operator*= ( signed int  x)
const SampleData< T > & operator*= ( unsigned int  x)
const SampleData< T > & operator*= ( signed long  x)
const SampleData< T > & operator*= ( unsigned long  x)
const SampleData< T >& operator/= ( const R &  x)

Divide each data element by the corresponding element of the container x.

const SampleData< T >& operator/= ( const SampleData< R > &  x)

Divide each data element by the corresponding element of the container x. Also copies the range (offset(), size(), and stepsize()) of x to this.

const SampleData< T > & operator/= ( float  x)

Divide each data element by x. x is a scalar type like float, double, int, etc.

const SampleData< T > & operator/= ( double  x)
const SampleData< T > & operator/= ( long double  x)
const SampleData< T > & operator/= ( signed char  x)
const SampleData< T > & operator/= ( unsigned char  x)
const SampleData< T > & operator/= ( signed int  x)
const SampleData< T > & operator/= ( unsigned int  x)
const SampleData< T > & operator/= ( signed long  x)
const SampleData< T > & operator/= ( unsigned long  x)
const SampleData< T >& operator%= ( const R &  x)

Return the remainder of the division of each data element by the corresponding element of the container x.

const SampleData< T >& operator%= ( const SampleData< R > &  x)

Return the remainder of the division of each data element by the corresponding element of the container x. Also copies the range (offset(), size(), and stepsize()) of x to this.

const SampleData< T > & operator%= ( float  x)

Return the remainder of each data element divided by x. x is a scalar type like float, double, int, etc.

const SampleData< T > & operator%= ( double  x)
const SampleData< T > & operator%= ( long double  x)
const SampleData< T > & operator%= ( signed char  x)
const SampleData< T > & operator%= ( unsigned char  x)
const SampleData< T > & operator%= ( signed int  x)
const SampleData< T > & operator%= ( unsigned int  x)
const SampleData< T > & operator%= ( signed long  x)
const SampleData< T > & operator%= ( unsigned long  x)
SampleData< T > operator- ( void  )

Negates each element of the data array.

SampleData< T > & identity ( void  )

Set the value of each data element to the value of the corresponding element of the range.

SampleData< T >& sin ( const LinearRange r,
double  f,
double  p = 0.0 
)

Initializes the range with r and the array with sin(2*pi*f*x+p) computed for each element x of the range r.

SampleData< T >& sin ( int  n,
double  offset,
double  stepsize,
double  f,
double  p = 0.0 
)
inline

References relacs::sin().

SampleData< T >& sin ( double  l,
double  r,
double  stepsize,
double  f,
double  p = 0.0 
)
inline

References relacs::sin().

SampleData< T >& cos ( const LinearRange r,
double  f,
double  p = 0.0 
)

Initializes the range with r and the array with cos(2*pi*f*x) computed for each element x of the range r.

SampleData< T >& cos ( int  n,
double  offset,
double  stepsize,
double  f,
double  p = 0.0 
)
inline

References relacs::cos().

SampleData< T >& cos ( double  l,
double  r,
double  stepsize,
double  f,
double  p = 0.0 
)
inline

References relacs::cos().

SampleData< T >& sweep ( const LinearRange r,
double  startfreq,
double  endfreq 
)

Initializes the range with r and the array with a frequency sweep from startfreq f_1 to endfreq f_2, i.e. sin(2*pi*(f_1+0.5*(f_2-f_1)*x/r.length())*x), computed for each element x of the range r.

SampleData< T >& sweep ( int  n,
double  offset,
double  stepsize,
double  startfreq,
double  endfreq 
)
inline

References relacs::sweep().

SampleData< T >& sweep ( double  l,
double  r,
double  stepsize,
double  startfreq,
double  endfreq 
)
inline

References relacs::sweep().

SampleData< T >& gauss ( const LinearRange r)

Initializes the range with r and the array with the standard normal distribution exp( -0.5*x^2 )/sqrt(2*pi) computed for each element x of the range r.

SampleData< T >& gauss ( int  n,
double  offset,
double  stepsize 
)
inline

References relacs::gauss().

SampleData< T >& gauss ( double  l,
double  r,
double  stepsize 
)
inline

References relacs::gauss().

SampleData< T >& gauss ( const LinearRange r,
double  s,
double  m = 0.0 
)

Initializes the range with r and the array with the normal distribution exp( -0.5*(x-m)^2/s^2 )/sqrt(2*pi)/s with standard deviation s and mean m computed for each element x of the range r.

SampleData< T >& gauss ( int  n,
double  offset,
double  stepsize,
double  s,
double  m = 0.0 
)
inline

References relacs::gauss().

SampleData< T >& gauss ( double  l,
double  r,
double  stepsize,
double  s,
double  m = 0.0 
)
inline

References relacs::gauss().

SampleData< T >& alpha ( const LinearRange r,
double  tau,
double  offs = 0.0 
)

Initializes the range with r and the array with the alpha function y*exp(-y) with y = (x-offs)/tau computed for each element x of the range r.

SampleData< T >& alpha ( int  n,
double  offset,
double  stepsize,
double  tau,
double  offs = 0.0 
)
inline

References relacs::alpha().

SampleData< T >& alpha ( double  l,
double  r,
double  stepsize,
double  tau,
double  offs = 0.0 
)
inline

References relacs::alpha().

SampleData< T >& line ( const LinearRange r,
double  abscissa,
double  slope 
)

Initializes the range with r and the array with a straight line with abscissa abscissa and slope slope computed for each element x of the range r.

SampleData< T >& line ( int  n,
double  offset,
double  stepsize,
double  abscissa,
double  slope 
)
inline

References relacs::line().

SampleData< T >& line ( double  l,
double  r,
double  stepsize,
double  abscissa,
double  slope 
)
inline

References relacs::line().

SampleData< T >& rectangle ( const LinearRange r,
double  period,
double  width,
double  ramp = 0.0 
)

Initializes the range with r and the array with a rectangular pulse pattern with period period, duration of the rectangle width, and maximum value 1.0 computed for each element x of the range r. The up- and downstrokes have a width of ramp.

SampleData< T >& rectangle ( int  n,
double  offset,
double  stepsize,
double  period,
double  width,
double  ramp = 0.0 
)
inline

References relacs::rectangle().

SampleData< T >& rectangle ( double  l,
double  r,
double  stepsize,
double  period,
double  width,
double  ramp = 0.0 
)
inline

References relacs::rectangle().

SampleData< T >& sawUp ( const LinearRange r,
double  period,
double  ramp = 0.0 
)

Initializes the range with r and the array with a sawtooth with period period and maximum value 1.0 computed for each element x of the range r. The downstroke has a width of ramp.

SampleData< T >& sawUp ( int  n,
double  offset,
double  stepsize,
double  period,
double  ramp = 0.0 
)
inline

References relacs::sawUp().

SampleData< T >& sawUp ( double  l,
double  r,
double  stepsize,
double  period,
double  ramp = 0.0 
)
inline

References relacs::sawUp().

SampleData< T >& sawDown ( const LinearRange r,
double  period,
double  ramp = 0.0 
)

Initializes the range with r and the array with a sawtooth with period period and maximum value 1.0 computed for each element x of the range r. The upstroke has a width of ramp.

SampleData< T >& sawDown ( int  n,
double  offset,
double  stepsize,
double  period,
double  ramp = 0.0 
)
inline

References relacs::sawDown().

SampleData< T >& sawDown ( double  l,
double  r,
double  stepsize,
double  period,
double  ramp = 0.0 
)
inline

References relacs::sawDown().

SampleData< T >& triangle ( const LinearRange r,
double  period 
)

Initializes the range with r and the array with a triangular sawtooth with period period and maximum value 1.0 computed for each element x of the range r.

SampleData< T >& triangle ( int  n,
double  offset,
double  stepsize,
double  period 
)
inline

References relacs::triangle().

SampleData< T >& triangle ( double  l,
double  r,
double  stepsize,
double  period 
)
inline

References relacs::triangle().

T interpolate ( double  x) const

Return a linearly interpolated value for position x. If x is outside the range the value of the first or last data element is returned.

References Array< T >::operator[]().

SampleData< T > & rampUp ( double  x,
int  type = 0 
)

Multiply the first indices( x ) y-data elements with a ramp monotonically increasing from zero to one. type == 0: linear ramp, type == 1: square ramp, type == 2: square root ramp, type == 3: cosine ramp.

See Also
rampDown(), ramp(), RampStrings

References relacs::cos(), Array< T >::operator[](), and relacs::sqrt().

SampleData< T > & rampDown ( double  x,
int  type = 0 
)

Multiply the last indices( x ) y-data elements with a ramp monotonically decreasing from one to zero. type == 0: linear ramp, type == 1: square ramp, type == 2: square root ramp, type == 3: cosine ramp.

See Also
rampUp(), ramp(), RampStrings

References relacs::cos(), Array< T >::operator[](), and relacs::sqrt().

SampleData< T > & ramp ( double  x,
int  type = 0 
)

Multiply the first and the last indices( x ) y-data elements with a ramp. type == 0: linear ramp, type == 1: square ramp, type == 2: square root ramp, type == 3: cosine ramp.

See Also
rampUp(), rampDown(), RampStrings
SampleData< T > & addHist ( ForwardIter  first,
ForwardIter  last 
)

Add the values of the range first, last to the histogram.

References Array< T >::operator[]().

SampleData< T > & addHist ( const R &  x)

Add the values of the container x to the histogram.

SampleData< T > & hist ( ForwardIter  first,
ForwardIter  last 
)

Compute histogram for the values of the range first, last.

Referenced by EventList::correctedIntervalHistogram(), and EventList::directIntervalHistogram().

SampleData< T > & hist ( const R &  x)

Compute histogram for the container x.

SampleData< T > & cumulative ( const SampleData< R > &  x)

Compute cumulative of the distribution given in x. The range is initialized with the range of x plus one additional element. The value of the first element is always 0.0 and the last one is always 1. x does not need to be normalized.

References relacs::sum().

Referenced by relacs::KSTest().

SampleData< T > & freqFilter ( const SampleData< TT > &  g,
bool  rescale = true 
)

Filters the array with the filter g. First, the array is fourier transformed. Then the amplitudes of the fourier components are multiplied with g. Finally, the array is transformed back into the time domain. If rescale is true, the amplitude of the resulting signal is rescaled such that its rms value is the same as the original one.

References relacs::ceil(), relacs::gain(), relacs::hcFFT(), relacs::log(), relacs::rFFT(), and relacs::rms().

T min ( double  first,
double  last 
) const

The minimum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, 0 is returned.

References relacs::min().

int minIndex ( double  first,
double  last 
) const

The index of the element with the minimum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, -1 is returned.

References relacs::minIndex().

int minIndex ( T &  min,
double  first,
double  last 
) const

The index of the element with the minimum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, -1 is returned and min is set to 0. The value of the minimum element is returned in min.

References relacs::min().

T max ( double  first,
double  last 
) const

The maximum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, 0 is returned.

References relacs::max().

int maxIndex ( double  first,
double  last 
) const

The index of the element with the maximum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, -1 is returned.

References relacs::maxIndex().

int maxIndex ( T &  max,
double  first,
double  last 
) const

The index of the element with the maximum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, -1 is returned and max is set to 0. The value of the maximum element is returned in max.

References relacs::max().

void minMax ( T &  min,
T &  max,
double  first,
double  last 
) const

The minimum value min and maximum value max of the data elements between position first (inclusively) and last (exclusively). If the range is empty, min and max are set to 0.

References relacs::minMax().

void minMaxIndex ( int &  minindex,
int &  maxindex,
double  first,
double  last 
) const

The indices minindex and maxindex of the elements with the minimum and the maximum value of the data elements between position first (inclusively) and last (exclusively). If the range is empty, minindex and maxindex are set to -1.

References relacs::minMaxIndex().

void minMaxIndex ( T &  min,
int &  minindex,
T &  max,
int &  maxindex,
double  first,
double  last 
) const

The indices minindex and maxindex of the elements with the minimum value min and the maximum value max of the data elements between position first (inclusively) and last (exclusively). If the range is empty, minindex and maxindex are set to -1 and min and max to 0.

References relacs::minMax().

numerical_traits< T >::mean_type mean ( double  first,
double  last 
) const

The mean <x> of the data elements between position first (inclusively) and last (exclusively).

References relacs::mean().

Referenced by relacs::average().

numerical_traits< T >::mean_type mean ( typename numerical_traits< T >::variance_type &  stdev,
double  first,
double  last 
) const

The mean <x> of the data elements between position first (inclusively) and last (exclusively). In stdev the standard deviation is returned.

References relacs::meanStdev().

numerical_traits< T >::variance_type variance ( double  first,
double  last 
) const

The unbiased variance var(x)=<(x-<x>)^2> of the data elements between position first (inclusively) and last (exclusively).

References relacs::variance().

numerical_traits< T >::variance_type varianceKnown ( typename numerical_traits< T >::mean_type  mean,
double  first,
double  last 
) const

The unbiased variance var(x)=<(x-mean)^2> of the data elements between position first (inclusively) and last (exclusively) for known mean.

References relacs::varianceKnown().

numerical_traits< T >::variance_type varianceFixed ( typename numerical_traits< T >::mean_type  fixedmean,
double  first,
double  last 
) const

The variance var(x)=<(x-mean)^2> of the data elements between position first (inclusively) and last (exclusively) for fixed mean.

References relacs::varianceFixed().

numerical_traits< T >::variance_type stdev ( double  first,
double  last 
) const

The unbiased standard deviation sqrt(var(x)) of the data elements between position first (inclusively) and last (exclusively).

References relacs::stdev().

numerical_traits< T >::variance_type stdevKnown ( typename numerical_traits< T >::mean_type  mean,
double  first,
double  last 
) const

The unbiased standard deviation sqrt(var(x)) of the data elements between position first (inclusively) and last (exclusively) for known mean.

References relacs::stdevKnown().

numerical_traits< T >::variance_type stdevFixed ( typename numerical_traits< T >::mean_type  fixedmean,
double  first,
double  last 
) const

The standard deviation sqrt(var(x)) of the data elements between position first (inclusively) and last (exclusively) for fixed mean.

References relacs::stdevFixed().

numerical_traits< T >::variance_type sem ( double  first,
double  last 
) const

The unbiased standard error mean sqrt(var(x)/N) of the data elements between position first (inclusively) and last (exclusively).

References relacs::sem().

numerical_traits< T >::variance_type semKnown ( typename numerical_traits< T >::mean_type  mean,
double  first,
double  last 
) const

The unbiased standard error mean sqrt(var(x)/N) of the data elements between position first (inclusively) and last (exclusively) for known mean.

References relacs::sem().

numerical_traits< T >::variance_type semFixed ( typename numerical_traits< T >::mean_type  fixedmean,
double  first,
double  last 
) const

The standard deviation sqrt(var(x)/N) of the data elements between position first (inclusively) and last (exclusively) for fixed mean.

References relacs::semFixed().

numerical_traits< T >::variance_type absdev ( double  first,
double  last 
) const

The absolute deviation <|x-mu|> of the data elements between position first (inclusively) and last (exclusively).

References relacs::absdev().

numerical_traits< T >::variance_type absdevKnown ( typename numerical_traits< T >::mean_type  mean,
double  first,
double  last 
) const

The absolute deviation <|x-mu|> of the data elements between position first (inclusively) and last (exclusively) for known mean.

References relacs::absdevKnown().

numerical_traits< T >::variance_type rms ( double  first,
double  last 
) const

The root-mean-square of the data elements between position first (inclusively) and last (exclusively).

References relacs::rms().

numerical_traits< T >::variance_type skewness ( double  first,
double  last 
) const

The skewness of the data elements between position first (inclusively) and last (exclusively).

References relacs::skewness().

numerical_traits< T >::variance_type kurtosis ( double  first,
double  last 
) const

The kurtosis of the data elements between position first (inclusively) and last (exclusively).

References relacs::kurtosis().

numerical_traits< T >::mean_type sum ( double  first,
double  last 
) const

The sum of the data elements between position first (inclusively) and last (exclusively).

References relacs::sum().

numerical_traits< T >::mean_type integral ( void  ) const

Returns the integral ovar all data elements, i.e. the sum of the data elements times stepsize().

References relacs::sum().

numerical_traits< T >::mean_type integral ( double  first,
double  last 
) const

Returns the integral of the data elements between position first (inclusively) and last (exclusively), i.e. the sum of the data elements times stepsize().

References relacs::sum().

numerical_traits< T >::variance_type squaredSum ( double  first,
double  last 
) const

The sum of the square of all elements of the data elements between position first (inclusively) and last (exclusively).

References relacs::squaredSum().

numerical_traits< T >::variance_type power ( double  first,
double  last 
) const

The power <x^2> of all elements of the data elements between position first (inclusively) and last (exclusively).

References relacs::power().

void troughs ( const SampleData< TT > &  x,
EventData events,
double  threshold 
)

Return in events detected troughs in x. Peaks and troughs must at least be separated by threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

void troughs ( const SampleData< TT > &  x,
EventData events,
double &  threshold,
Check &  check 
)

Return in events detected troughs in x. Peaks and troughs must at least be separated by threshold. check is a class with the member function checkEvent() that has the following signature:

EventData &outevents, double &threshold, double &minthresh, double &maxthresh,
double &time, double &size, double &width );

This function is called to check detected troughs. It should return 1 to accept the event, or 0 to discard the detected event. In the first case, time, size and width should be set to the time, size, and width of the event, respectively. time is preset to *eventtime. This function may also change the detection threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

void rising ( const SampleData< TT > &  x,
EventData events,
double  threshold 
)

Return in events detected events in x that cross threshold with a positive slope.

void rising ( const SampleData< TT > &  x,
EventData events,
double &  threshold,
Check &  check 
)

Return in events detected events in x that cross threshold with a positive slope.

void falling ( const SampleData< TT > &  x,
EventData events,
double  threshold 
)

Return in events detected events in x that cross threshold with a negative slope.

void falling ( const SampleData< TT > &  x,
EventData events,
double &  threshold,
Check &  check 
)

Return in events detected events in x that cross threshold with a negative slope.

ostream & save ( ostream &  str,
int  width = 10,
int  prec = 5,
const string &  start = "",
const string &  separator = " " 
) const

Write content of the SampleData into stream str. Each element is written in a line. First, the string start is written, then the value of the range element ( pos( k ) ), then the string separator followed by the value of the Array element, and finally a newline. The array element is formatted in a field of width width characters and precision decimals. The range element is automatically formatted.

References relacs::numberFormat().

void save ( const string &  file,
int  width = 10,
int  prec = 5,
const string &  start = "",
const string &  separator = " " 
) const
istream & load ( istream &  str,
const string &  stop = "",
string *  line = 0 
)

Read from stream str until end of file or a line beginning with stop is reached. If stop equals "EMPTY", reading is stopped at an empty line. If line does not equal zero then the last read line is returned in line.

SampleData< T > & load ( const string &  file,
const string &  comment = "#",
const string &  stop = "" 
)
const SampleData< T >& operator+= ( const COT &  x)
const SampleData< T >& operator+= ( const SampleData< COT > &  x)
const SampleData< T >& operator-= ( const COT &  x)
const SampleData< T >& operator-= ( const SampleData< COT > &  x)
const SampleData< T >& operator*= ( const COT &  x)
const SampleData< T >& operator*= ( const SampleData< COT > &  x)
const SampleData< T >& operator/= ( const COT &  x)
const SampleData< T >& operator/= ( const SampleData< COT > &  x)
const SampleData< T >& operator%= ( const COT &  x)
const SampleData< T >& operator%= ( const SampleData< COT > &  x)

Friends And Related Function Documentation

bool operator== ( const SampleData< TT > &  a,
const SampleData< TT > &  b 
)
friend

True if size, content, and range of a and b are equal.

bool operator< ( const SampleData< TT > &  a,
const SampleData< TT > &  b 
)
friend

True if the value of each data element of array a is smaller than b and if the range of is smaller than the range of b.

SampleData<TT> operator+ ( const SampleData< TT > &  x,
const RR &  y 
)
friend

Return the sum of the containers x and y computed for each element.

SampleData<TT> operator+ ( float  x,
const SampleData< TT > &  y 
)
friend

Return the sum of x and y computed for each element. One of the parameters is a scalar type like float, double, int, etc., the other parameter is a SampleData.

SampleData<TT> operator+ ( const SampleData< TT > &  x,
float  y 
)
friend
SampleData<TT> operator+ ( double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
double  y 
)
friend
SampleData<TT> operator+ ( long double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
long double  y 
)
friend
SampleData<TT> operator+ ( signed char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
signed char  y 
)
friend
SampleData<TT> operator+ ( unsigned char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
unsigned char  y 
)
friend
SampleData<TT> operator+ ( signed int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
signed int  y 
)
friend
SampleData<TT> operator+ ( unsigned int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
unsigned int  y 
)
friend
SampleData<TT> operator+ ( signed long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
signed long  y 
)
friend
SampleData<TT> operator+ ( unsigned long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator+ ( const SampleData< TT > &  x,
unsigned long  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
const RR &  y 
)
friend

Return the difference of the containers x and y computed for each element.

SampleData<TT> operator- ( float  x,
const SampleData< TT > &  y 
)
friend

Return the difference of x and y computed for each element. One of the parameters is a scalar type like float, double, int, etc., the other parameter is a SampleData.

SampleData<TT> operator- ( const SampleData< TT > &  x,
float  y 
)
friend
SampleData<TT> operator- ( double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
double  y 
)
friend
SampleData<TT> operator- ( long double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
long double  y 
)
friend
SampleData<TT> operator- ( signed char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
signed char  y 
)
friend
SampleData<TT> operator- ( unsigned char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
unsigned char  y 
)
friend
SampleData<TT> operator- ( signed int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
signed int  y 
)
friend
SampleData<TT> operator- ( unsigned int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
unsigned int  y 
)
friend
SampleData<TT> operator- ( signed long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
signed long  y 
)
friend
SampleData<TT> operator- ( unsigned long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator- ( const SampleData< TT > &  x,
unsigned long  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
const RR &  y 
)
friend

Return the product of the containers x and y computed for each element.

SampleData<TT> operator* ( float  x,
const SampleData< TT > &  y 
)
friend

Return the product of x and y computed for each element. One of the parameters is a scalar type like float, double, int, etc., the other parameter is a SampleData.

SampleData<TT> operator* ( const SampleData< TT > &  x,
float  y 
)
friend
SampleData<TT> operator* ( double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
double  y 
)
friend
SampleData<TT> operator* ( long double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
long double  y 
)
friend
SampleData<TT> operator* ( signed char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
signed char  y 
)
friend
SampleData<TT> operator* ( unsigned char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
unsigned char  y 
)
friend
SampleData<TT> operator* ( signed int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
signed int  y 
)
friend
SampleData<TT> operator* ( unsigned int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
unsigned int  y 
)
friend
SampleData<TT> operator* ( signed long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
signed long  y 
)
friend
SampleData<TT> operator* ( unsigned long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator* ( const SampleData< TT > &  x,
unsigned long  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
const RR &  y 
)
friend

Return container x divided by container y computed for each element.

SampleData<TT> operator/ ( float  x,
const SampleData< TT > &  y 
)
friend

Return x divided by y computed for each element. One of the parameters is a scalar type like float, double, int, etc., the other parameter is a SampleData.

SampleData<TT> operator/ ( const SampleData< TT > &  x,
float  y 
)
friend
SampleData<TT> operator/ ( double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
double  y 
)
friend
SampleData<TT> operator/ ( long double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
long double  y 
)
friend
SampleData<TT> operator/ ( signed char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
signed char  y 
)
friend
SampleData<TT> operator/ ( unsigned char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
unsigned char  y 
)
friend
SampleData<TT> operator/ ( signed int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
signed int  y 
)
friend
SampleData<TT> operator/ ( unsigned int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
unsigned int  y 
)
friend
SampleData<TT> operator/ ( signed long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
signed long  y 
)
friend
SampleData<TT> operator/ ( unsigned long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator/ ( const SampleData< TT > &  x,
unsigned long  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
const RR &  y 
)
friend

Return the remainder of container x divided by container y computed for each element.

SampleData<TT> operator% ( float  x,
const SampleData< TT > &  y 
)
friend

Return the remainder of x divided by y computed for each element. One of the parameters is a scalar type like float, double, int, etc., the other parameter is a SampleData.

SampleData<TT> operator% ( const SampleData< TT > &  x,
float  y 
)
friend
SampleData<TT> operator% ( double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
double  y 
)
friend
SampleData<TT> operator% ( long double  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
long double  y 
)
friend
SampleData<TT> operator% ( signed char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
signed char  y 
)
friend
SampleData<TT> operator% ( unsigned char  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
unsigned char  y 
)
friend
SampleData<TT> operator% ( signed int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
signed int  y 
)
friend
SampleData<TT> operator% ( unsigned int  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
unsigned int  y 
)
friend
SampleData<TT> operator% ( signed long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
signed long  y 
)
friend
SampleData<TT> operator% ( unsigned long  x,
const SampleData< TT > &  y 
)
friend
SampleData<TT> operator% ( const SampleData< TT > &  x,
unsigned long  y 
)
friend
SampleData< T > & sin ( const LinearRange r,
double  f,
double  p = 0.0 
)
friend

Returns sin(2*pi*f*x+p) computed for each element x of the range r.

SampleData sin ( int  n,
double  offset,
double  stepsize,
double  f,
double  p 
)
friend
SampleData sin ( double  l,
double  r,
double  stepsize,
double  f,
double  p 
)
friend
SampleData< T > & cos ( const LinearRange r,
double  f,
double  p = 0.0 
)
friend

Returns cos(2*pi*f*x+p) computed for each element x of the range r.

SampleData cos ( int  n,
double  offset,
double  stepsize,
double  f,
double  p 
)
friend
SampleData cos ( double  l,
double  r,
double  stepsize,
double  f,
double  p 
)
friend
SampleData< T > & sweep ( const LinearRange r,
double  startfreq,
double  endfreq 
)
friend

Returns a frequency sweep from startfreq f_1 to endfreq f_2, i.e. sin(2*pi*(f_1+0.5*(f_2-f_1)*x/r.length())*x), computed for each element x of the range r.

SampleData sweep ( int  n,
double  offset,
double  stepsize,
double  startfreq,
double  endfreq 
)
friend
SampleData sweep ( double  l,
double  r,
double  stepsize,
double  startfreq,
double  endfreq 
)
friend
SampleData< T > & gauss ( const LinearRange r)
friend

Returns the standard normal distribution exp( -0.5*x^2 )/sqrt(2*pi) for each element x of the range r.

SampleData gauss ( int  n,
double  offset,
double  stepsize 
)
friend
SampleData gauss ( double  l,
double  r,
double  stepsize 
)
friend
SampleData< T > & gauss ( const LinearRange r,
double  s,
double  m 
)
friend

Returns the normal distribution exp( -0.5*(x-m)^2/s^2 )/sqrt(2*pi)/s with standard deviation s and mean m for each element x of the range r.

SampleData gauss ( int  n,
double  offset,
double  stepsize,
double  s,
double  m 
)
friend
SampleData gauss ( double  l,
double  r,
double  stepsize,
double  s,
double  m 
)
friend
SampleData< T > & alpha ( const LinearRange r,
double  tau,
double  offs 
)
friend

Returns the alpha function y*exp(-y) with y = (x-offs)/tau for each element x of the range r.

SampleData alpha ( int  n,
double  offset,
double  stepsize,
double  tau,
double  offs 
)
friend
SampleData alpha ( double  l,
double  r,
double  stepsize,
double  tau,
double  offs 
)
friend
SampleData< T > & line ( const LinearRange r,
double  abscissa,
double  slope 
)
friend

Returns a straight line with abscissa abscissa and slope slope computed for each element x of the range r.

SampleData line ( int  n,
double  offset,
double  stepsize,
double  abscissa,
double  slope 
)
friend
SampleData line ( double  l,
double  r,
double  stepsize,
double  abscissa,
double  slope 
)
friend
SampleData< T > & rectangle ( const LinearRange r,
double  period,
double  width,
double  ramp 
)
friend

Returns a rectangular pulse pattern with period period, duration of the rectangle width, and maximum value 1.0 computed for each element x of the range r. The up- and downstrokes have a width of ramp.

SampleData rectangle ( int  n,
double  offset,
double  stepsize,
double  period,
double  width,
double  ramp 
)
friend
SampleData rectangle ( double  l,
double  r,
double  stepsize,
double  period,
double  width,
double  ramp 
)
friend
SampleData< T > & sawUp ( const LinearRange r,
double  period,
double  ramp 
)
friend

Returns a sawtooth with period period and maximum value 1.0 computed for each element x of the range r. The downstroke has a width of ramp.

SampleData sawUp ( int  n,
double  offset,
double  stepsize,
double  period,
double  ramp 
)
friend
SampleData sawUp ( double  l,
double  r,
double  stepsize,
double  period,
double  ramp 
)
friend
SampleData< T > & sawDown ( const LinearRange r,
double  period,
double  ramp 
)
friend

Returns a sawtooth with period period and maximum value 1.0 computed for each element x of the range r. The upstroke has a width of ramp.

SampleData sawDown ( int  n,
double  offset,
double  stepsize,
double  period,
double  ramp 
)
friend
SampleData sawDown ( double  l,
double  r,
double  stepsize,
double  period,
double  ramp 
)
friend
SampleData< T > & triangle ( const LinearRange r,
double  period 
)
friend

Returns a triangular sawtooth with period period and maximum value 1.0 computed for each element x of the range r.

SampleData triangle ( int  n,
double  offset,
double  stepsize,
double  period 
)
friend
SampleData triangle ( double  l,
double  r,
double  stepsize,
double  period 
)
friend
SampleData<TT> convolve ( const SampleData< TT > &  x,
const RR &  y,
int  offs = 0 
)
friend

Return the convolution of x with the container y. y can be shifted by offs indices. If possible, y.size() should be smaller than x.size().

SampleData<TT> convolve ( const SampleData< TT > &  x,
const SampleData< TT > &  y 
)
friend
void hcPower ( const SampleData< TT > &  hc,
SampleData< SS > &  p 
)
friend

Compute power p of the half-complex sequence in hc. Sets the stepsize() of p to the one of hc. Half the number hc.size() of data elements in hc can be assigned a power in p, excess elements are set to zero. The spectrum is normalized such that its sum equals the mean squared amplitudes of the signal. TT and SS are real numbers.

See Also
hcMagnitude(), hcPhase(), transfer()
void hcMagnitude ( const SampleData< TT > &  hc,
SampleData< SS > &  m 
)
friend

Compute magnitude m of the half-complex sequence in hc. Sets the stepsize() of m to the one of hc. Half the number hc.size() of data elements in hc can be assigned a magnitude in m, excess elements are set to zero. TT and SS are real numbers.

See Also
hcPower(), hcPhase(), transfer()
void hcPhase ( const SampleData< TT > &  hc,
SampleData< SS > &  p 
)
friend

Compute phase p (argument, from -pi to pi) of the half-complex sequence in hc. Sets the stepsize() of p to the one of hc. Half the number hc.size() of data elements in hc can be assigned a phase in p, excess elements are set to zero. TT and SS are real numbers.

See Also
hcPower(), hcMagnitude(), transfer()
void hcReal ( const SampleData< TT > &  hc,
SampleData< SS > &  r 
)
friend

Compute real parts of the half-complex sequence in hc. Sets the stepsize() of r to the one of hc. Half the number hc.size() of data elements in hc can be assigned a real part in p, excess elements are set to zero. TT and SS are real numbers.

See Also
hcPower(), hcMagnitude(), hcPhase(), hcImaginary(), rFFT(), transfer()
void hcImaginary ( const SampleData< TT > &  hc,
SampleData< SS > &  i 
)
friend

Compute imaginary parts of the half-complex sequence in hc. Sets the stepsize() of i to the one of hc. Half the number hc.size() of data elements in hc can be assigned a imaginary part in p, excess elements are set to zero. TT and SS are real numbers.

See Also
hcPower(), hcMagnitude(), hcPhase(), hcReal(), rFFT(), transfer()
int rFFT ( SampleData< TT > &  x)
friend

Compute an in-place radix-2 FFT on x containing real numbers. The size N of x has to be a power of two, otherwise -1 is returned. The output is a half-complex sequence, which is stored in-place. The arrangement of the half-complex terms uses the following scheme: for k < N/2 the real part of the k-th term is stored in location k, and the corresponding imaginary part is stored in location N-k. Terms with k > N/2 (the negative frequencies) can be reconstructed using the symmetry z_k = z^*_{N-k}. The terms for k=0 and k=N/2 are both purely real, and count as a special case. Their real parts are stored in locations 0 and N/2 respectively, while their imaginary parts which are zero are not stored. The stepsize() is set to 1/(N stepsize()), such that the first half of the output range contains the positive frequencies at i*stepsize(), i=0..N/2. Use hcPower() and hcPhase() to compute power and phase of the spectrum. Algorithm adapted from the GNU Scientific Library http://www.gnu.org/software/gsl .

See Also
hcPower(), hcMagnitude(), hcPhase(), rPSD()

Compute an in-place radix-2 FFT on x containing real numbers. The size N of x has to be a power of two, otherwise -1 is returned. The output is a half-complex sequence, which is stored in-place. The arrangement of the half-complex terms uses the following scheme: for k < N/2 the real part of the k-th term is stored in location k, and the corresponding imaginary part is stored in location N-k. Terms with k > N/2 (the negative frequencies) can be reconstructed using the symmetry z_k = z^*_{N-k}. The terms for k=0 and k=N/2 are both purely real, and count as a special case. Their real parts are stored in locations 0 and N/2 respectively, while their imaginary parts which are zero are not stored. The first half of the output range contains the positive frequencies at i/(N stepsize()), i=0..N/2. Use hcPower() and hcPhase() to compute power and phase of the spectrum. Algorithm adapted from the GNU Scientific Library http://www.gnu.org/software/gsl .

See Also
hcPower(), hcMagnitude(), hcPhase(), rPSD()
int rPSD ( const SampleData< TT > &  x,
SampleData< SS > &  p,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Power spectrum p of x. The spectrum is normalized such that its sum equals the mean squared amplitudes of the signal x. A fourier window of size n ( a power of two no less than 2*p.size() ) is used. p.stepsize() is set to its appropriate value 0.5/x.stepsize()/n. TT and SS are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Power spectrum p of x. The spectrum is normalized such that its sum equals the mean squared amplitudes of the signal x. A fourier window of size n ( a power of two no less than 2*p.size() ) is used. p.stepsize() is set to its appropriate value 0.5/x.stepsize()/n. TT and SS are real numbers.

int transfer ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  h,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute transfer function h (half-complex sequence) between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of N data points, where N = h.size(). h.size() must be a power of two. The stepsize() of h is set to 1.0/x.stepsize()/h.size(). The gain and phase of the transfer function can be obtained using hcMagnitude() and hcPhase(). TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute transfer function h (half-complex sequence) between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of N data points, where N = h.size(). h.size() must be a power of two. The stepsize() of h is set to 1.0/x.stepsize()/h.size(). The gain and phase of the transfer function can be obtained using hcMagnitude() and hcPhase(). TT, SS, and RR are real numbers.

int transfer ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  h,
SampleData< RR > &  c,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute transfer function h (half-complex sequence) and coherence c between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of N data points, where N = h.size(). h.size() must be a power of two. The stepsize() of h is set to 1.0/x.stepsize()/h.size(). The gain and phase of the transfer function can be obtained using hcMagnitude() and hcPhase(). TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute transfer function h (half-complex sequence) and coherence c between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of N data points, where N = h.size(). h.size() must be a power of two. The stepsize() of h is set to 1.0/x.stepsize()/h.size(). The gain and phase of the transfer function can be obtained using hcMagnitude() and hcPhase(). TT, SS, and RR are real numbers.

int gain ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  g,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute gain g (magnitude of the transfer function) between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of two times N data points, where N is the minimum power of two not less than g.size(). The stepsize() of g is set to 0.5/x.stepsize()/N. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute gain g (magnitude of the transfer function) between x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of two times N data points, where N is the minimum power of two not less than g.size(). The stepsize() of g is set to 0.5/x.stepsize()/N. TT, SS, and RR are real numbers.

int coherence ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  c,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute coherence c of x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of two times N data points, where N is the minimum power of two not less than c.size(). The stepsize() of c is set to 0.5/x.stepsize()/N. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute coherence c of x and y. x and y must have the same stepsize() and size(). x and y are divided into chunks of two times N data points, where N is the minimum power of two not less than c.size(). The stepsize() of c is set to 0.5/x.stepsize()/N. TT, SS, and RR are real numbers.

double coherenceInfo ( const SampleData< RR > &  c,
double  f0 = 0.0,
double  f1 = -1.0 
)
friend

Returns a lower bound of transmitted information based on the coherence $ \gamma^2 $ in c computed by

\[ I_{\mathrm{LB}} = -\int_{f_0}^{f_1} \log_2(1-\gamma^2) \, df \]

int rCSD ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  cps,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute cross power spectrum (squared magnitude of cross spectrum) cps of x and y. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute cross spectrum c of x and y. TT, SS, and RR are real numbers.

int spectra ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  g,
SampleData< RR > &  c,
SampleData< RR > &  yps,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute gain g, coherence c and powerspectrum yps between x and y. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute gain g, coherence c and powerspectrum ys between x and y. a TT, SS, and RR are real numbers.

int spectra ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  g,
SampleData< RR > &  c,
SampleData< RR > &  cps,
SampleData< RR > &  xps,
SampleData< RR > &  yps,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute gain g, coherence c, auto- (xps and yps) and cross power spectra (cps) between x and y. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute gain g, coherence c, auto- (xs and ys) and cross spectra (cs) between x and y. TT, SS, and RR are real numbers.

int crossSpectra ( const SampleData< TT > &  x,
const SampleData< SS > &  y,
SampleData< RR > &  cs,
SampleData< RR > &  xps,
SampleData< RR > &  yps,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
)
friend

Compute power spectra (xps and yps) and cross spectrum (cs) between x and y. TT, SS, and RR are real numbers.

Returns
the number of chunks used or a negative number indicating an error.

Compute power spectra (xps and yps) and cross spectrum (cs) between x and y. TT, SS, and RR are real numbers.

void coherence ( const SampleData< TT > &  cp,
const SampleData< TT > &  xp,
const SampleData< TT > &  yp,
SampleData< TT > &  c 
)
friend

Compute coherence c from the cross spectrum cp and the power spectra xp and yp.

void average ( SampleData< TT > &  meantrace,
const vector< SampleData< TT > > &  traces 
)
friend

Returns in meantrace the average over traces at each position pos() of meantrace. The traces are linearly interpolated.

void average ( SampleData< TT > &  meantrace,
SampleData< TT > &  stdev,
const vector< SampleData< TT > > &  traces 
)
friend

Returns in meantrace and stdev the average and standard deviation over traces at each position pos() of meantrace. The traces are linearly interpolated.

void peaksTroughs ( const SampleData< TT > &  x,
EventData peaks,
EventData troughs,
double  threshold 
)
friend

Return in peaks and troughs detected peaks and troughs in x, respectively. Peaks and troughs must at least be separated by threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

void peaksTroughs ( const SampleData< TT > &  x,
EventData peaks,
EventData troughs,
double &  threshold,
Check &  check 
)
friend

Return in peaks and troughs detected peaks and troughs in x, respectively. Peaks and troughs must at least be separated by threshold. check is a class with the member functions checkPeak() and checkTrough() that have the following signature:

EventList &outevents, double &threshold, double &minthresh, double &maxthresh,
double &time, double &size, double &width );
EventList &outevents, double &threshold, double &minthresh, double &maxthresh,
double &time, double &size, double &width );

These functions are called to check detected peaks or troughs, respectively. They should return 1 to accept the event, or 0 to discard the detected event. In the first case, time, size and width should be set to the time, size, and width of the event, respectively. time is preset to *eventtime. These function may also change the detection threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

void peaks ( const SampleData< TT > &  x,
EventData events,
double  threshold 
)
friend

Return in events detected peaks in x. Peaks and troughs must at least be separated by threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

void peaks ( const SampleData< TT > &  x,
EventData events,
double &  threshold,
Check &  check 
)
friend

Return in events detected peaks in x. Peaks and troughs must at least be separated by threshold. check is a class with the member function checkEvent() that has the following signature:

EventData &outevents, double &threshold, double &minthresh, double &maxthresh,
double &time, double &size, double &width );

This function is called to check detected peaks. It should return 1 to accept the event, or 0 to discard the detected event. In the first case, time, size and width should be set to the time, size, and width of the event, respectively. time is preset to *eventtime. This function may also change the detection threshold. Uses the algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). See class Detector for details.

ostream& operator<< ( ostream &  str,
const SampleData< TT > &  a 
)
friend
istream& operator>> ( istream &  str,
SampleData< TT > &  a 
)
friend

Member Data Documentation

const string RampStrings = "linear|square|sqrt|cosine"
static

A '|' separated list of supported ramp types.


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