vector_template< T > Class Template Reference

#include <matrix_template.h>

List of all members.

Public Member Functions

 vector_template (void)
 vector_template (size_t n)
 vector_template (const T &val, size_t n)
 vector_template (const T *p, size_t n)
 vector_template (const std::valarray< T > &vv)
size_t size (void) const
operator[] (size_t i) const
T & operator[] (size_t i)
operator() (size_t i) const
T & operator() (size_t i)

Protected Attributes

std::valarray< T > v

Friends

template<class TT >
vector_template< TT > operator+ (const vector_template< TT > &v1, const vector_template< TT > &v2)
template<class TT >
vector_template< TT > operator- (const vector_template< TT > &v1, const vector_template< TT > &v2)
template<class TT >
vector_template< TT > operator+ (const vector_template< TT > &v1)
template<class TT >
vector_template< TT > operator- (const vector_template< TT > &v1)
template<class TT , class SS >
vector_template< TT > operator* (const SS &c, const vector_template< TT > &v2)
template<class TT , class SS >
vector_template< TT > operator* (const vector_template< TT > &v1, const SS &c)
template<class TT , class SS >
vector_template< TT > operator/ (const vector_template< TT > &v1, const SS &c)
template<class TT >
TT operator* (const vector_template< TT > &v1, const vector_template< TT > &v2)
template<class TT >
vector_template< TT > operator* (const matrix_template< TT > &v1, const vector_template< TT > &v2)
template<class TT >
vector_template< TT > operator* (const vector_template< TT > &v1, const matrix_template< TT > &v2)
template<class TT >
std::ostream & operator<< (std::ostream &os, const vector_template< TT > &v)

Detailed Description

template<class T>
class pdf::vector_template< T >

The class vector_template is a template class for a one-dimensional vector in a mathematical sense (not to be confused with a vector in C++).

The representation is based on a valarray with value semantics. This class is designed for vectors of modest size.

The interface is more restricted than for a valarray, e.g. there is no operator+ (const vector_template<T> & v1, const T & c).

If efficiency becomes an issue, one can defer evaluation and introduce closures (B. Stroustrup, The C++ Programming Language, 3rd edition, 22.4.7)


Constructor & Destructor Documentation

vector_template ( void   )  [inline]

Default constructor

vector_template ( size_t  n  )  [inline, explicit]

Construct a vector_template of size n.

vector_template ( const T &  val,
size_t  n 
) [inline]

Construct a vector_template of size n and initialize each component with val.

vector_template ( const T *  p,
size_t  n 
) [inline]

Construct from an array.

vector_template ( const std::valarray< T > &  vv  )  [inline, explicit]

Construct from a valarray.


Member Function Documentation

T & operator() ( size_t  i  )  [inline]

Subscription via ()

T operator() ( size_t  i  )  const [inline]

Subscription via ()

T & operator[] ( size_t  i  )  [inline]

Subscription via []

T operator[] ( size_t  i  )  const [inline]

Subscription via []

size_t size ( void   )  const [inline]

Returns the size of a vector_template.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208