Vector< T, NumberTraits > Class Template Reference

#include <MathVector.h>

List of all members.

Public Types

typedef Vector< T, NumberTraits > vector_type
 shortcut for the type of this class
typedef T number_type
 type of the vector elements
typedef NumberTraits traits_type
 the AlgebraicTraits class associated to the type of vector elements
typedef NumberTraits::norm_type norm_type
 the type of the norm of the vector

Public Member Functions

 Vector ()
 Vector (unsigned int nSize)
 ~Vector ()
 Vector (const vector_type &other)
vector_typeoperator= (const vector_type &other)
vector_type operator- () const
vector_type operator+ (const vector_type &rhs) const
vector_type operator- (const vector_type &rhs) const
number_type operator * (const vector_type &rhs) const
vector_typeoperator+= (const vector_type &rhs)
vector_typeoperator-= (const vector_type &rhs)
bool operator== (const vector_type &rhs) const
bool operator!= (const vector_type &rhs) const
bool operator< (const vector_type &rhs) const
 operator number_type * () const
number_type getNorm ()
size_t size () const
const vector_type zero () const
void display (std::ostream &os=std::cout) const
void load (std::istream &is)
void save (std::ostream &os) const


Detailed Description

template<class T, class NumberTraits = AlgebraicTraits< T >>
class Vector< T, NumberTraits >

class Vector Represents a collection of elements of type T. Besides the usual handling and creation functions the vector class implements arithmetic operations like: addition, subtraction, scalar product and norm.

Definition at line 26 of file MathVector.h.


Constructor & Destructor Documentation

template<class T, class NumberTraits = AlgebraicTraits< T >>
Vector< T, NumberTraits >::Vector (  )  [inline]

Default constructor

Definition at line 64 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
Vector< T, NumberTraits >::Vector ( unsigned int  nSize  )  [inline, explicit]

Constructor

Parameters:
nSize initial count of elements in the vector

Definition at line 71 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
Vector< T, NumberTraits >::~Vector (  )  [inline]

Destructor

Definition at line 78 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
Vector< T, NumberTraits >::Vector ( const vector_type other  )  [inline]

Copy constructor

Definition at line 85 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:


Member Function Documentation

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type& Vector< T, NumberTraits >::operator= ( const vector_type other  )  [inline]

Assignment operator

Definition at line 95 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type Vector< T, NumberTraits >::operator- (  )  const [inline]

Unary minus operator

Definition at line 123 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type Vector< T, NumberTraits >::operator+ ( const vector_type rhs  )  const [inline]

Addition operator. This function simply sums up corresponding elements in vectors having the same size.

Parameters:
rhs right hand side vector
Returns:
the result vector

Definition at line 141 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type Vector< T, NumberTraits >::operator- ( const vector_type rhs  )  const [inline]

Subtraction operator. This function simply subtracts corresponding elements in vectors having the same size.

Parameters:
rhs right hand side vector
Returns:
the result vector

Definition at line 168 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
number_type Vector< T, NumberTraits >::operator * ( const vector_type rhs  )  const [inline]

Compute the scalar product of two same sizes vectors.

Parameters:
rhs right hand side vector
Returns:
The value of the scalar product

Definition at line 195 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type& Vector< T, NumberTraits >::operator+= ( const vector_type rhs  )  [inline]

Addition assignment operator

Parameters:
rhs right hand side vector
Returns:
refference to this vector after the addition operation

Definition at line 223 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
vector_type& Vector< T, NumberTraits >::operator-= ( const vector_type rhs  )  [inline]

Subtraction assignment operator

Parameters:
rhs Right hand side vector
Returns:
refference to this vector after the addition operation

Definition at line 242 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
bool Vector< T, NumberTraits >::operator== ( const vector_type rhs  )  const [inline]

Equality operator

Parameters:
rhs right hand side vector
Returns:
true if the two vectors are equal, false otherwise

Definition at line 266 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
bool Vector< T, NumberTraits >::operator!= ( const vector_type rhs  )  const [inline]

Inequality operator

Parameters:
rhs right hand side vector
Returns:
true if the two vectors are different, false otherwise

Definition at line 288 of file MathVector.h.

References Vector< T, NumberTraits >::size().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
bool Vector< T, NumberTraits >::operator< ( const vector_type rhs  )  const [inline]

Comparison operator.

Parameters:
rhs right hand side vector
Returns:
true if the norm of this vector is less than the norm of the right hand side vector.

Definition at line 311 of file MathVector.h.

References Vector< T, NumberTraits >::getNorm().

Here is the call graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
Vector< T, NumberTraits >::operator number_type * (  )  const [inline]

Cast operator to number_type. This operator is used to access the elements of the vector in the same way as accessing elements of a C array. (e.g. vect[0])

Returns:
pointer to the stored buffer

Definition at line 336 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
number_type Vector< T, NumberTraits >::getNorm (  )  [inline]

Compute the euclidean norm of the vector.

Returns:
the value of the euclidean norm

Definition at line 344 of file MathVector.h.

Referenced by Vector< T, NumberTraits >::operator<().

Here is the caller graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
size_t Vector< T, NumberTraits >::size (  )  const [inline]

Return the count of elements in the vector

Returns:
the count of elements in the vector

Definition at line 362 of file MathVector.h.

Referenced by Vector< T, NumberTraits >::operator *(), Vector< T, NumberTraits >::operator!=(), Vector< T, NumberTraits >::operator+(), Vector< T, NumberTraits >::operator+=(), Vector< T, NumberTraits >::operator-(), Vector< T, NumberTraits >::operator-=(), Vector< T, NumberTraits >::operator=(), Vector< T, NumberTraits >::operator==(), and Vector< T, NumberTraits >::Vector().

Here is the caller graph for this function:

template<class T, class NumberTraits = AlgebraicTraits< T >>
const vector_type Vector< T, NumberTraits >::zero (  )  const [inline]

Synthetise a vector having all elements equal to zero. The synthetised vector has the same size as this vector. To call this method this vector can not be empty.

Returns:
a vector having all elements equal to zero and the same size

Definition at line 374 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
void Vector< T, NumberTraits >::display ( std::ostream &  os = std::cout  )  const [inline]

Displays this vector to a stream.

Parameters:
os the stream to insert this vector into

Definition at line 393 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
void Vector< T, NumberTraits >::load ( std::istream &  is  )  [inline]

Load this from a stream

Parameters:
is stream to load from

Definition at line 409 of file MathVector.h.

template<class T, class NumberTraits = AlgebraicTraits< T >>
void Vector< T, NumberTraits >::save ( std::ostream &  os  )  const [inline]

Save this to a stream

Parameters:
os stream to save to

Definition at line 428 of file MathVector.h.


The documentation for this class was generated from the following file:
Math-Objects Library Docs  Generated by: doxygen