ParM  parm
A molecular dynamics library
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
NVector< T, N > Class Template Reference

An N-dimensional vector, extending addition and subtraction from the type T to the NVector class. More...

#include <vec.hpp>

Inheritance diagram for NVector< T, N >:
NumVector< T, N > NumVector< T, 2 > NumVector< T, 3 > Vector2< T > Vector3< T >

Public Types

typedef T * iterator
 

Public Member Functions

 NVector ()
 
 NVector (const NVector &rhs)
 
template<class U >
 NVector (const NVector< U, N > &rhs)
 
 NVector (const T locs[N])
 
const T & get (const unsigned int n) const
 
void set (const unsigned int n, const T a)
 
unsigned int len () const
 
NVectoroperator+= (const NVector &rhs)
 
NVectoroperator-= (const NVector &rhs)
 
template<class U >
NVectoroperator*= (const U rhs)
 
template<class U >
NVectoroperator/= (const U rhs)
 
NVector operator- () const
 
NVector operator+ (const NVector &rhs) const
 
NVector operator- (const NVector &rhs) const
 
T & operator[] (const unsigned int i)
 
const T & operator[] (const unsigned int i) const
 
template<class U >
NVector operator* (const U rhs) const
 Multiplication by a scalar. More...
 
template<class U >
NVector operator/ (const U rhs) const
 Division by a scalar. More...
 
T * begin ()
 
T * end ()
 
 ~NVector ()
 
template<class U >
NVector< T, N > & operator*= (const U rhs)
 
template<class U >
NVector< T, N > & operator/= (const U rhs)
 

Protected Attributes

vals [N]
 

Friends

template<class U , unsigned int M>
ostream & operator<< (ostream &out, const NVector< U, M > v)
 

Detailed Description

template<class T, unsigned int N>
class NVector< T, N >

An N-dimensional vector, extending addition and subtraction from the type T to the NVector class.

This is extended by NumVector for things like multiplication and division, but you can use NVector for something like an array of NumVectors.

Template Parameters
Ta type that can be added and subtracted.
Nthe number of dimensions.

Member Typedef Documentation

template<class T, unsigned int N>
typedef T* NVector< T, N >::iterator

Constructor & Destructor Documentation

template<class T , unsigned int N>
NVector< T, N >::NVector ( )
template<class T , unsigned int N>
NVector< T, N >::NVector ( const NVector< T, N > &  rhs)
template<class T , unsigned int N>
template<class U >
NVector< T, N >::NVector ( const NVector< U, N > &  rhs)
template<class T, unsigned int N>
NVector< T, N >::NVector ( const T  locs[N])
template<class T, unsigned int N>
NVector< T, N >::~NVector ( )
inline

Member Function Documentation

template<class T, unsigned int N>
T* NVector< T, N >::begin ( )
inline
template<class T, unsigned int N>
T* NVector< T, N >::end ( )
inline
template<class T, unsigned int N>
const T& NVector< T, N >::get ( const unsigned int  n) const
inline
template<class T, unsigned int N>
unsigned int NVector< T, N >::len ( ) const
inline
template<class T, unsigned int N>
template<class U >
NVector NVector< T, N >::operator* ( const U  rhs) const
inline

Multiplication by a scalar.

template<class T, unsigned int N>
template<class U >
NVector& NVector< T, N >::operator*= ( const U  rhs)
template<class T, unsigned int N>
template<class U >
NVector<T,N>& NVector< T, N >::operator*= ( const U  rhs)
template<class T, unsigned int N>
NVector NVector< T, N >::operator+ ( const NVector< T, N > &  rhs) const
inline
template<class T , unsigned int N>
NVector< T, N > & NVector< T, N >::operator+= ( const NVector< T, N > &  rhs)
template<class T , unsigned int N>
NVector< T, N > NVector< T, N >::operator- ( ) const
template<class T, unsigned int N>
NVector NVector< T, N >::operator- ( const NVector< T, N > &  rhs) const
inline
template<class T , unsigned int N>
NVector< T, N > & NVector< T, N >::operator-= ( const NVector< T, N > &  rhs)
template<class T, unsigned int N>
template<class U >
NVector NVector< T, N >::operator/ ( const U  rhs) const
inline

Division by a scalar.

template<class T, unsigned int N>
template<class U >
NVector& NVector< T, N >::operator/= ( const U  rhs)
template<class T, unsigned int N>
template<class U >
NVector<T,N>& NVector< T, N >::operator/= ( const U  rhs)
template<class T, unsigned int N>
T& NVector< T, N >::operator[] ( const unsigned int  i)
inline
template<class T, unsigned int N>
const T& NVector< T, N >::operator[] ( const unsigned int  i) const
inline
template<class T, unsigned int N>
void NVector< T, N >::set ( const unsigned int  n,
const T  a 
)
inline

Friends And Related Function Documentation

template<class T, unsigned int N>
template<class U , unsigned int M>
ostream& operator<< ( ostream &  out,
const NVector< U, M >  v 
)
friend

Member Data Documentation

template<class T, unsigned int N>
T NVector< T, N >::vals[N]
protected

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