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

#include <array.h>

Inheritance diagram for Array< T >:
Inheritance 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
 

Public Member Functions

 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
 
virtual int resize (int n, const T &val=0)
 
virtual void clear (void)
 
int capacity (void) const
 
int maxCapacity (void) const
 
virtual int reserve (int n)
 
virtual void free (int n=0)
 
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="")
 

Friends

void gslVector (gsl_vector &a, const Array< double > &b)
 
void gslVector (gsl_vector_float &a, const Array< float > &b)
 
void gslVector (gsl_vector_int &a, const Array< int > &b)
 
template<typename TT >
bool operator== (const Array< TT > &a, const Array< TT > &b)
 
template<typename TT >
bool operator< (const Array< TT > &a, const Array< TT > &b)
 
template<typename TT , typename SS >
Array< TT > convolve (const Array< TT > &x, const SS &y, int offs)
 
template<typename TT >
ostream & operator<< (ostream &str, const Array< TT > &a)
 
template<typename TT >
istream & operator>> (istream &str, Array< TT > &a)
 

Detailed Description

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

A template defining an one-dimensional array of data.

Author
Jan Benda
Todo:

type independent reading of data elements in load()

math functions with two arguments: one scalar/container as first argument for member function, z.B. pow/exp

smooth functions (average over k neighboring points, or with kernel)

implement logical operators with scalars and other vectors: >, <, >=, <=, == such that they return a vector of booleans!

implement operator && and || that operate on zero and non-zero entries of arrays.

implement "find": take an Array and return an array of indices pointing to elements != 0.0

implement interface to index vectors

This class is very similar to the vector class from the standard template library, in that it is a random access container of objects of type T. In addition, however, it is specialized for numerical objects, like double or float, in two ways. First, the data are stored in a single classical T array that can be accessed by the data() function. This allows to apply ordinary C functions on the array, and thus makes this container useable for many numerical algorithm libraries. Second, Array supports some basic computations on its data elements. All the +,-,,/,+=,-=,*=,/= operators are implemented, as well as some basic functions like min(), max(), mean(), stdev(), etc.

In addition to resize() and reserve() there is a free() function that allows to free allocated memory.

For convenience an array of double is defined as ArrayD, an array of float as ArrayF, and an array of int as ArrayI.

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 an array.

typedef const T* const_iterator

Const iterator used to iterate through an array.

Constructor & Destructor Documentation

Array ( void  )

Creates an empty array.

Array ( int  n)

Creates an array with n data elements without initializing them.

Array ( int  n,
const T &  val 
)

Creates an array with n data elements and initialzes them with val.

Array ( const S *  a,
int  n 
)

Creates an array with n data elements and initialzes them with the values given in a.

Array ( const T *  a,
int  n 
)

Creates an array with n data elements and initialzes them with the values given in a.

Array ( const vector< S > &  a,
int  first = 0,
int  last = -1 
)

Creates an array with a copy of the range [first,last) of the vector a.

Array ( const Array< S > &  a,
int  first = 0,
int  last = -1 
)

Creates an array with a copy of the range [first,last) of the array a.

References Array< T >::size().

Array ( const Array< T > &  a)

Copy constructor. Creates an array with the same size and content as the array a.

References Array< T >::size().

Array ( const LinearRange range)

Creates an array from range.

References Array< T >::assign().

~Array ( void  )
virtual

The destructor.

Member Function Documentation

const Array< T > & operator= ( const S &  a)

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

const Array< T > & operator= ( const LinearRange range)

Assign range to this.

const Array< T > & operator= ( const Array< T > &  a)

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

const Array< T > & assign ( const S *  a,
int  n 
)

Set the size() and capacity() of the array to n and its content to a.

Referenced by Array< T >::Array(), Map< T >::assign(), SampleData< T >::assign(), and Array< T >::copy().

const Array< T > & assign ( const T *  a,
int  n 
)

Set the size() and capacity() of the array to n and its content to a.

const Array< T > & assign ( const S &  a)

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

const Array< T > & assign ( const Array< T > &  a)

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

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

const Array< T > & assign ( const Array< T > &  a,
int  first,
int  last = -1 
)

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

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

const Array< T > & assign ( const LinearRange range)

Assign range to this.

References LinearRange::size().

Array< T > & zeros ( int  n)

Initialize the array with n zeros.

See Also
resize()
Array< T > & ones ( int  n)

Initialize the array with n ones.

See Also
resize()
Array< T > & rand ( int  n,
R &  r = rnd 
)

Initialize the array with n uniformly distributed random numbers between zero and one, using the random number generator r.

Array< T > & randNorm ( int  n,
R &  r = rnd 
)

Initialize the array with n normally distributed random numbers with zero mean and unit standard deviation, using the random number generator r.

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

const Array< T > & copy ( S *  a,
int  n,
const S &  val = 0 
) const

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

Referenced by Map< T >::copy(), and SampleData< T >::copy().

const Array< T > & copy ( T *  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.

const Array< T > & copy ( S &  a) const

Copy the content of the array to a.

const Array< T > & copy ( Array< S > &  a) const

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

References Array< T >::assign().

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

Append n - times to the array.

Referenced by Map< T >::append(), and SampleData< T >::append().

const Array< T > & append ( const S *  a,
int  n 
)

Append a of size n to the array.

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

Append a of size n to the array.

const Array< T > & append ( const S &  a)

Append a to the array.

const Array< T > & append ( const Array< T > &  a)

Append a to the array.

References Array< T >::size().

const Array< T > & repeat ( int  n)

Repeat the current content of the array n times.

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

True if the array does not contain any data elements.

Referenced by Sine::operator()(), EventData::push(), EventData::set(), relacs::signTest(), and SampleData< T >::smooth().

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().

Returns
the new size of the array (might be smaller than n)

Reimplemented in SampleData< T >, and Map< T >.

Referenced by Map< T >::resize(), SampleData< T >::resize(), SampleData< T >::SampleData(), relacs::savitzkyGolay(), SampleData< T >::setLength(), Array< T >::sortedIndex(), and EventList::trialAveragedSerialCorr().

void clear ( void  )
virtual
int capacity ( void  ) const

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().

See Also
maxCapacity()
int maxCapacity ( void  ) const

The maximum possible capacity of the array.

See Also
capacity()
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 (might be smaller than n ).
See Also
capacity(), maxCapacity()

Reimplemented in SampleData< T >, and Map< T >.

Referenced by EventData::addIntervals(), SampleData< T >::copy(), EventData::copy(), EventList::correctedIntervalHistogram(), EventList::directIntervalHistogram(), EventData::fano(), EventList::frequency(), EventList::frequencyAt(), EventList::intervalsAt(), EventList::locking(), Map< T >::reserve(), SampleData< T >::reserve(), EventData::serialCorr(), EventList::sum(), EventList::vectorPhase(), and EventList::vectorStrength().

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 in SampleData< T >, and Map< T >.

Referenced by Map< T >::free(), and SampleData< T >::free().

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

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

Referenced by SampleData< T >::addHist(), SampleData< T >::interpolate(), SampleData< T >::rampDown(), and SampleData< T >::rampUp().

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

Returns a const 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)

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 & front ( void  ) const

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

Referenced by EventData::assign(), and EventData::push().

T & front ( void  )

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

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

Referenced by EventData::assign(), and EventList::serialCorr().

T & back ( void  )

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. If necessary, the capacity of the array is increased first. If the capacity cannot increased any more, then val is not added to the array.

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

Referenced by EventData::addIntervals(), SampleData< T >::copy(), EventData::copy(), EventList::correctedIntervalHistogram(), EventList::directIntervalHistogram(), EventData::fano(), EventList::frequency(), EventList::frequencyAt(), EventList::intervalsAt(), EventList::locking(), SampleData< T >::push(), EventData::serialCorr(), EventList::sum(), EventList::vectorPhase(), and EventList::vectorStrength().

int push ( const R &  x)

Add the content of the container x as a new elements to the array. If necessary, the capacity of the array is increased first.

Returns
the number of added elements (can be smaller than x.size())
T pop ( void  )

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

Referenced by Map< T >::pop(), and SampleData< T >::pop().

const T * data ( void  ) const
inline

Returns a pointer to the data buffer.

Referenced by Array< T >::assign(), and relacs::gslVector().

T * data ( void  )
inline

Returns a pointer to the data buffer.

Array< T >::iterator begin ( void  )
inline

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

Referenced by relacs::convolve(), relacs::fitUncertainties(), Array< T >::operator-(), relacs::rankSumWilcoxon(), SampleData< T >::smooth(), and EventList::sum().

Array< T >::const_iterator begin ( void  ) const
inline

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

Array< T >::iterator end ( void  )
inline

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

Referenced by relacs::convolve(), Array< T >::operator-(), relacs::rankSumWilcoxon(), SampleData< T >::smooth(), and EventList::sum().

Array< T >::const_iterator end ( void  ) const
inline

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

Array< T > & insert ( int  i,
const T &  v 
)

Insert element v at position i.

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

Array< T >::iterator insert ( iterator  i,
const T &  v 
)

Insert element v at position i.

Array< T > & erase ( int  i)

Remove element at position i from the Array.

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

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

Remove element at position i from the Array.

Array< T > & sortedIndex ( Array< int > &  indices,
int  first = 0,
int  last = -1 
)

Return in indices a list of indices such that operator[]( indices[ i ] ) results in a sorted list of the arrray elements.

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

CONTAINEROPS1SCALARDEC ( Array< T >  ,
operator   
)

Set the value of each data element to val.

CONTAINEROPS1DEC ( Array< T >  ,
operator+   
)

Add each value of x to the corresponding data element. x can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS1DEC ( Array< T >  ,
operator-   
)

Subtract each value of x from the corresponding data element. x can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS1DEC ( Array< T >  ,
operator*   
)

Multiply each data element by the corresponding value of x. x can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS1DEC ( Array< T >  ,
operator/   
)

Divide each data element by the corresponding value of x. x can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS1DEC ( Array< T >  ,
operator%   
)

Return the remainder of the division of each data element by the corresponding value of x. x can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS2DEC ( class TT  ,
Array< TT >  ,
operator+   
)

Return the sum of x and y computed for each element. x and y can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS2DEC ( class TT  ,
Array< TT >  ,
operator-   
)

Return the difference between x and y computed for each element. x and y can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS2DEC ( class TT  ,
Array< TT >  ,
operator*   
)

Return the product of x and y computed for each element. x and y can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS2DEC ( class TT  ,
Array< TT >  ,
operator/   
)

Return x divided by y computed for each element. x and y can be either a container or a scalar type like float, double, int, etc.

CONTAINEROPS2DEC ( class TT  ,
Array< TT >  ,
operator%   
)

Return the remainder of x divided by y computed for each element. x and y can be either a container or a scalar type like float, double, int, etc.

Array< T > operator- ( void  )

Negates each element of the array.

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

Array<T>& sin ( void  )

Computes sin(x) of each data element of the array.

Array<T>& cos ( void  )

Computes cos(x) of each data element of the array.

Array<T>& tan ( void  )

Computes tan(x) of each data element of the array.

Array<T>& asin ( void  )

Computes asin(x) of each data element of the array.

Array<T>& acos ( void  )

Computes acos(x) of each data element of the array.

Array<T>& atan ( void  )

Computes atan(x) of each data element of the array.

Array<T>& sinh ( void  )

Computes sinh(x) of each data element of the array.

Array<T>& cosh ( void  )

Computes cosh(x) of each data element of the array.

Array<T>& tanh ( void  )

Computes tanh(x) of each data element of the array.

Array<T>& asinh ( void  )

Computes asinh(x) of each data element of the array.

Array<T>& acosh ( void  )

Computes acosh(x) of each data element of the array.

Array<T>& atanh ( void  )

Computes atanh(x) of each data element of the array.

Array<T>& exp ( void  )

Computes exp(x) of each data element of the array.

Array<T>& log ( void  )

Computes log(x) of each data element of the array.

Array<T>& log10 ( void  )

Computes log10(x) of each data element of the array.

Array<T>& erf ( void  )

Computes erf(x) of each data element of the array.

Array<T>& erfc ( void  )

Computes erfc(x) of each data element of the array.

Array<T>& sqrt ( void  )

Computes sqrt(x) of each data element of the array.

Array<T>& cbrt ( void  )

Computes cbrt(x) of each data element of the array.

Array<T>& square ( void  )

Squares each data element of the array.

Array<T>& cube ( void  )

Computes cube(x) of each data element of the array.

CONTAINERFUNC1DEC ( Array< T >  ,
pow   
)

Raise each data element of the array to the power x. x can be either a container or a scalar type like float, double, int, etc.

Array< TT > & exp ( double  base)

For each data element of the array raise base to the power of the data element.

References relacs::exp().

Array<T>& ceil ( void  )

Computes ceil(x) of each data element of the array.

Array<T>& floor ( void  )

Computes floor(x) of each data element of the array.

Array<T>& abs ( void  )

Computes the absolute value of each data element of the array.

Array< T > & decibel ( double  level = 0.0)

Transforms the data elements into decibel relative to level according to 10.0 * log10( x / level ). By default (level=0.0), level is set to the maximum of the data array.

References relacs::log10(), and relacs::max().

Array< T > & linear ( double  level)

Transforms the data elements from a decibel scala relative to level back to a linear scala according to pow( 10.0, 0.1 * x ) * level.

References relacs::pow().

Array< T > & averageAdd ( const Array< T > &  a,
int  n 
)

Add as the n -th element of an average to this.

References Array< T >::size().

Array< T > & averageAdd ( const Array< T > &  a,
int  n,
Array< T > &  sq 
)

Add as the n -th element of an average to this. Simultaneously add the squared elements of a to the average in sq.

References Array< T >::size().

Array< T > & averageAdd ( const Array< T > &  a,
int  n,
Array< T > &  sq,
Array< T > &  sd 
)

Add as the n -th element of an average to this. Simultaneously add the squared elements of a to the average in sq and return in sd the corresponding standard deviation.

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

T min ( int  first = 0,
int  last = -1 
) const

The minimum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, 0 is returned.

References relacs::min().

int minIndex ( int  first = 0,
int  last = -1 
) const

The index of the element with the minimum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, -1 is returned.

References relacs::minIndex().

Referenced by Map< T >::minY(), and Map< T >::minYIndex().

int minIndex ( T &  min,
int  first = 0,
int  last = -1 
) const

The index of the element with the minimum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. The value of the minimum element is returned in min. If the range is empty, -1 is returned and min is set to 0.

References relacs::min().

T max ( int  first = 0,
int  last = -1 
) const

The maximum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, 0 is returned.

References relacs::max().

int maxIndex ( int  first = 0,
int  last = -1 
) const

The index of the element with the maximum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, -1 is returned.

References relacs::maxIndex().

Referenced by Map< T >::maxY(), and Map< T >::maxYIndex().

int maxIndex ( T &  max,
int  first = 0,
int  last = -1 
) const

The index of the element with the maximum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. The value of the maximum element is returned in max. If the range is empty, -1 is returned and max is set to 0.

References relacs::max().

void minMax ( T &  min,
T &  max,
int  first = 0,
int  last = -1 
) const

The minimum value min and maximum value max of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, min and max are set to 0.

References relacs::minMax().

void minMaxIndex ( int &  minindex,
int &  maxindex,
int  first = 0,
int  last = -1 
) const

The indices minindex and maxindex of the elements with the minimum and the maximum value of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. If the range is empty, minindex and maxindex are set to -1.

References relacs::minMaxIndex().

Referenced by Map< T >::minMaxY(), and Map< T >::minMaxYIndex().

void minMaxIndex ( T &  min,
int &  minindex,
T &  max,
int &  maxindex,
int  first = 0,
int  last = -1 
) const

The indices minindex and maxindex of the elements with the minimum value min and the maximum value max of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. 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 ( int  first = 0,
int  last = -1 
) const

The mean <x> of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::mean().

Referenced by EventData::fano(), EventList::locking(), EventList::vectorPhase(), and EventList::vectorStrength().

numerical_traits< T >::mean_type mean ( typename numerical_traits< T >::variance_type &  stdev,
int  first = 0,
int  last = -1 
) const

The mean <x> of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered. In stdev the standard deviation is returned.

References relacs::meanStdev().

numerical_traits< T >::variance_type variance ( int  first = 0,
int  last = -1 
) const

The unbiased variance var(x)=<(x-<x>)^2> of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::variance().

numerical_traits< T >::variance_type varianceKnown ( typename numerical_traits< T >::mean_type  mean,
int  first = 0,
int  last = -1 
) const

The unbiased variance var(x)=<(x-mean)^2> of the data elements between indices first (inclusively) and last (exclusively) for known mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::varianceKnown().

numerical_traits< T >::variance_type varianceFixed ( typename numerical_traits< T >::mean_type  fixedmean,
int  first = 0,
int  last = -1 
) const

The variance var(x)=<(x-mean)^2> of the data elements between indices first (inclusively) and last (exclusively) for fixed mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::varianceFixed().

numerical_traits< T >::variance_type stdev ( int  first = 0,
int  last = -1 
) const

The unbiased standard deviation sqrt(var(x)) of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::stdev().

numerical_traits< T >::variance_type stdevKnown ( typename numerical_traits< T >::mean_type  mean,
int  first = 0,
int  last = -1 
) const

The unbiased standard deviation sqrt(var(x)) of the data elements between indices first (inclusively) and last (exclusively) for known mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::stdevKnown().

numerical_traits< T >::variance_type stdevFixed ( typename numerical_traits< T >::mean_type  fixedmean,
int  first = 0,
int  last = -1 
) const

The standard deviation sqrt(var(x)) of the data elements between indices first (inclusively) and last (exclusively) for fixed mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::stdevFixed().

numerical_traits< T >::variance_type sem ( int  first = 0,
int  last = -1 
) const

The unbiased standard error mean sqrt(var(x)/N) of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::sem().

numerical_traits< T >::variance_type semKnown ( typename numerical_traits< T >::mean_type  mean,
int  first = 0,
int  last = -1 
) const

The unbiased standard error mean sqrt(var(x)/N) of the data elements between indices first (inclusively) and last (exclusively) for known mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::semKnown().

numerical_traits< T >::variance_type semFixed ( typename numerical_traits< T >::mean_type  fixedmean,
int  first = 0,
int  last = -1 
) const

The standard deviation sqrt(var(x)/N) of the data elements between indices first (inclusively) and last (exclusively) for fixed mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::semFixed().

numerical_traits< T >::variance_type absdev ( int  first = 0,
int  last = -1 
) const

The absolute deviation <|x-mu|> of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::absdev().

numerical_traits< T >::variance_type absdevKnown ( typename numerical_traits< T >::mean_type  mean,
int  first = 0,
int  last = -1 
) const

The absolute deviation <|x-mu|> of the data elements between indices first (inclusively) and last (exclusively) for known mean. If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::absdevKnown().

numerical_traits< T >::variance_type rms ( int  first = 0,
int  last = -1 
) const

The root-mean-square of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::rms().

numerical_traits< T >::variance_type skewness ( int  first = 0,
int  last = -1 
) const

The skewness of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::skewness().

numerical_traits< T >::variance_type kurtosis ( int  first = 0,
int  last = -1 
) const

The kurtosis of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::kurtosis().

T sum ( int  first = 0,
int  last = -1 
) const

The sum of all elements of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::sum().

numerical_traits< T >::variance_type squaredSum ( int  first = 0,
int  last = -1 
) const

The sum of the square of all elements of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::squaredSum().

numerical_traits< T >::variance_type power ( int  first = 0,
int  last = -1 
) const

The power <x^2> of all elements of the data elements between indices first (inclusively) and last (exclusively). If last is negative it is set behind the last data element. Called with no arguments all data elements are considered.

References relacs::power().

double rank ( int  first = 0,
int  last = -1 
)

Replace each element of the sorted array between indices first (inclusively) and last (exclusively) by its rank, including midranking of ties, and returns the sum of f^3-f, where f is the number of elements in each tie.

References relacs::rank().

ostream & save ( ostream &  str,
int  width = 10,
int  prec = 5 
) const

Write content of the Array into stream str. Each element is written in a line. The array element is formatted in a field of width width characters and precision decimals.

void save ( const string &  file,
int  width = 10,
int  prec = 5 
) 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.

Referenced by relacs::operator>>().

Array< T > & load ( const string &  file,
const string &  stop = "" 
)

Friends And Related Function Documentation

void gslVector ( gsl_vector &  a,
const Array< double > &  b 
)
friend

Initializes the gsl_vector a such that it points to the data buffer of b. Ownership remains with b.

void gslVector ( gsl_vector_float &  a,
const Array< float > &  b 
)
friend

Initializes the gsl_vector_float a such that it points to the data buffer of b. Ownership remains with b.

void gslVector ( gsl_vector_int &  a,
const Array< int > &  b 
)
friend

Initializes the gsl_vector_int a such that it points to the data buffer of b. Ownership remains with b.

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

True if size and content of array a and b are equal.

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

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

Array<TT> convolve ( const Array< TT > &  x,
const SS &  y,
int  offs 
)
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().

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

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