Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Vector_n< T, N > Class Template Reference

Represents a n-dimensional vector of type T. More...

#include <Vector_n.h>

Collaboration diagram for Vector_n< T, N >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Vector_n ()
 Standard constructor.

 Vector_n (const T *v)
 Constructor that initializes the vector with the values in the passed array.

 Vector_n (const Vector_n< T, N > &v)
 Copy constructor.

 ~Vector_n ()
 Destructor.

Vector_n< T, N > & operator= (const Vector_n< T, N > &v)
 Copy operator.

Vector_n< T, N > & operator= (const T *v)
 Copy operator.

void copyTo (T *v) const
 Copies contents of vector to passed array.

const T & operator[] (size_t i) const
 Constant element access operator.

T & operator[] (size_t i)
 Element access operator.

Vector_n< T, N > & operator+= (const Vector_n< T, N > &v)
 Operator +=.

Vector_n< T, N > & operator-= (const Vector_n< T, N > &v)
 Operator -=.

Vector_n< T, N > & operator *= (const T &s)
 Operator *=.

Vector_n< T, N > & operator/= (const T &s)
 Operator /=.

length ()
 Get length of vector.


Private Attributes

content [N]
 The array holding the contents of the vector.


Detailed Description

template<class T, size_t N>
class Vector_n< T, N >

Represents a n-dimensional vector of type T.

Vector_n represents a n-dimensional vector of type T. The class supplies standard arithmetic operations.

Definition at line 30 of file Vector_n.h.


Constructor & Destructor Documentation

template<class T, size_t N>
Vector_n< T, N >::Vector_n  )  [inline]
 

Standard constructor.

Initializes the vector with values supplied by the standard constructor of T.

Complexity: n

Definition at line 42 of file Vector_n.h.

template<class T, size_t N>
Vector_n< T, N >::Vector_n const T *  v  )  [inline]
 

Constructor that initializes the vector with the values in the passed array.

Parameters:
v Array with initialization values
Complexity: n

Definition at line 59 of file Vector_n.h.

template<class T, size_t N>
Vector_n< T, N >::Vector_n const Vector_n< T, N > &  v  )  [inline]
 

Copy constructor.

Parameters:
v Vector to copy
Complexity: n

Definition at line 75 of file Vector_n.h.

template<class T, size_t N>
Vector_n< T, N >::~Vector_n  )  [inline]
 

Destructor.

Complexity: n

Definition at line 89 of file Vector_n.h.


Member Function Documentation

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator= const Vector_n< T, N > &  v  )  [inline]
 

Copy operator.

Parameters:
v Vector to copy
Complexity: n

Definition at line 102 of file Vector_n.h.

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator= const T *  v  )  [inline]
 

Copy operator.

Parameters:
v Array with initialization values
Complexity: n

Definition at line 115 of file Vector_n.h.

template<class T, size_t N>
void Vector_n< T, N >::copyTo T *  v  )  const [inline]
 

Copies contents of vector to passed array.

Parameters:
v Array the values are stored to
Complexity: n

Definition at line 128 of file Vector_n.h.

Referenced by Matrix_nxn< double, 2 >::copyTo().

template<class T, size_t N>
const T& Vector_n< T, N >::operator[] size_t  i  )  const [inline]
 

Constant element access operator.

Parameters:
i Index of element to access (first element has index 0)
Returns:
Constant reference to value
Complexity: 1

Definition at line 142 of file Vector_n.h.

template<class T, size_t N>
T& Vector_n< T, N >::operator[] size_t  i  )  [inline]
 

Element access operator.

Parameters:
i Index of element to access (first element has index 0)
Returns:
Reference to value
Complexity: 1

Definition at line 154 of file Vector_n.h.

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator+= const Vector_n< T, N > &  v  )  [inline]
 

Operator +=.

Parameters:
v Vector to add
Complexity: n

Definition at line 165 of file Vector_n.h.

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator-= const Vector_n< T, N > &  v  )  [inline]
 

Operator -=.

Parameters:
v Vector to subtract
Complexity: n

Definition at line 178 of file Vector_n.h.

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator *= const T &  s  )  [inline]
 

Operator *=.

Parameters:
s Scalar the vector is to multiplied with
Complexity: n

Definition at line 191 of file Vector_n.h.

template<class T, size_t N>
Vector_n<T, N>& Vector_n< T, N >::operator/= const T &  s  )  [inline]
 

Operator /=.

Parameters:
s Scalar the vector is to be divided by
Complexity: n

Definition at line 213 of file Vector_n.h.

template<class T, size_t N>
T Vector_n< T, N >::length  )  [inline]
 

Get length of vector.

Returns:
Length of vector
Complexity: n

Definition at line 243 of file Vector_n.h.


Member Data Documentation

template<class T, size_t N>
T Vector_n< T, N >::content[N] [private]
 

The array holding the contents of the vector.

Definition at line 257 of file Vector_n.h.

Referenced by Vector_n< double, 2 >::operator+=(), Vector_n< double, 2 >::operator-=(), and Vector_n< double, 2 >::operator=().


The documentation for this class was generated from the following file:
Generated on Thu Sep 23 20:12:11 2004 for GT2004 by doxygen 1.3.6