SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Attributes
Vector< T > Class Template Reference

Object that can host any type of data in a vector arrangement. More...

#include <Vector.hh>

Public Member Functions

 Vector ()
 Default constructor, initilizes an empty vector of dimension 0. More...
 
 Vector (const size_t &n)
 Size constructor, initializes an empty vector of dimension n. More...
 
 Vector (const std::vector< T > &vec)
 Std constructor, sets the underlying std::vector. More...
 
 Vector (const T *vec, const size_t &n)
 Array constructor, sets the underlying std::vector. More...
 
 Vector (const size_t &n, const T &value)
 Constant constructor, initializes a vector of dimension n filled with value. More...
 
 Vector (const Vector &vec)
 Copy constructor. More...
 
 ~Vector ()
 Destructor. More...
 
Vector & operator= (const Vector &vec)
 Equality operator. More...
 
Vector operator- () const
 Overload the unary minus for vector algebra. More...
 
Vector operator+ (const Vector &vec) const
 Overload the vector sum. More...
 
void operator+= (const Vector &vec)
 Overload the vector sum. More...
 
Vector operator- (const Vector &vec) const
 Overload the v substraction. More...
 
void operator-= (const Vector &vec)
 Overload the v substraction. More...
 
T operator* (const Vector &vec) const
 Overload the vector product (dot product) More...
 
Vector operator* (const T &factor) const
 Overload the vector product with a scalar. More...
 
void operator*= (const T &factor)
 Overload the vector product with a scalar. More...
 
Vector operator/ (const T &factor) const
 Overload the vector ratio with a scalar. More...
 
void operator/= (const T &factor)
 Overload the vector ratio with a scalar. More...
 
const T & operator[] (const size_t i) const
 Overload the subscript operator, return a value. More...
 
T & operator[] (const size_t i)
 Overload the subscript operator, return a value, allows mods. More...
 
const T & back () const
 Returns the last element of the vector. More...
 
const T & front () const
 Returns the first element of the vector. More...
 
T mag () const
 Returns the magnitude of the vector. More...
 
T mag2 () const
 Returns the square of the magnitude of the vector. More...
 
T norm () const
 Returns the norm of the vector. More...
 
T norm2 () const
 Returns the square of the norm of the vector. More...
 
T dot (const Vector &vec) const
 Returns the dot product with another vecror. More...
 
Vector cross (const Vector &vec) const
 Returns the cross product with another vecror. More...
 
void push_back (const T &element)
 Adds element at the back. More...
 
void push_front (const T &element)
 Adds element at the back. More...
 
void resize (const size_t n)
 Resizes the vector to chosen dimension. More...
 
const size_t size () const
 Returns dimension of the vector. More...
 
const std::vector< T > & std () const
 Returns the vector as an std::vector. More...
 

Private Attributes

std::vector< T > _vec
 Underlying std::vector. More...
 

Detailed Description

template<typename T>
class Vector< T >

Object that can host any type of data in a vector arrangement.

The class definition also contains a multitude of linear algebra methods that are useful to work with vectors.

Constructor & Destructor Documentation

template<typename T >
Vector< T >::Vector ( )

Default constructor, initilizes an empty vector of dimension 0.

template<typename T >
Vector< T >::Vector ( const size_t &  n)

Size constructor, initializes an empty vector of dimension n.

template<typename T >
Vector< T >::Vector ( const std::vector< T > &  vec)

Std constructor, sets the underlying std::vector.

template<typename T >
Vector< T >::Vector ( const T *  vec,
const size_t &  n 
)

Array constructor, sets the underlying std::vector.

template<typename T >
Vector< T >::Vector ( const size_t &  n,
const T &  value 
)

Constant constructor, initializes a vector of dimension n filled with value.

template<typename T >
Vector< T >::Vector ( const Vector< T > &  vec)

Copy constructor.

template<typename T >
Vector< T >::~Vector ( )

Destructor.

Member Function Documentation

template<typename T >
const T & Vector< T >::back ( ) const

Returns the last element of the vector.

template<typename T >
Vector< T > Vector< T >::cross ( const Vector< T > &  vec) const

Returns the cross product with another vecror.

template<typename T >
T Vector< T >::dot ( const Vector< T > &  vec) const

Returns the dot product with another vecror.

template<typename T >
const T & Vector< T >::front ( ) const

Returns the first element of the vector.

template<typename T >
T Vector< T >::mag ( ) const

Returns the magnitude of the vector.

template<typename T >
T Vector< T >::mag2 ( ) const

Returns the square of the magnitude of the vector.

template<typename T >
T Vector< T >::norm ( ) const

Returns the norm of the vector.

template<typename T >
T Vector< T >::norm2 ( ) const

Returns the square of the norm of the vector.

template<typename T >
T Vector< T >::operator* ( const Vector< T > &  vec) const

Overload the vector product (dot product)

template<typename T >
Vector< T > Vector< T >::operator* ( const T &  factor) const

Overload the vector product with a scalar.

template<typename T >
void Vector< T >::operator*= ( const T &  factor)

Overload the vector product with a scalar.

template<typename T >
Vector< T > Vector< T >::operator+ ( const Vector< T > &  vec) const

Overload the vector sum.

template<typename T >
void Vector< T >::operator+= ( const Vector< T > &  vec)

Overload the vector sum.

template<typename T >
Vector< T > Vector< T >::operator- ( ) const

Overload the unary minus for vector algebra.

template<typename T >
Vector< T > Vector< T >::operator- ( const Vector< T > &  vec) const

Overload the v substraction.

template<typename T >
void Vector< T >::operator-= ( const Vector< T > &  vec)

Overload the v substraction.

template<typename T >
Vector< T > Vector< T >::operator/ ( const T &  factor) const

Overload the vector ratio with a scalar.

template<typename T >
void Vector< T >::operator/= ( const T &  factor)

Overload the vector ratio with a scalar.

template<typename T >
Vector< T > & Vector< T >::operator= ( const Vector< T > &  vec)

Equality operator.

template<typename T >
const T & Vector< T >::operator[] ( const size_t  i) const

Overload the subscript operator, return a value.

template<typename T >
T & Vector< T >::operator[] ( const size_t  i)

Overload the subscript operator, return a value, allows mods.

template<typename T >
void Vector< T >::push_back ( const T &  element)

Adds element at the back.

template<typename T >
void Vector< T >::push_front ( const T &  element)

Adds element at the back.

template<typename T >
void Vector< T >::resize ( const size_t  n)

Resizes the vector to chosen dimension.

template<typename T >
const size_t Vector< T >::size ( ) const

Returns dimension of the vector.

template<typename T >
const std::vector< T > & Vector< T >::std ( ) const

Returns the vector as an std::vector.

Field Documentation

template<typename T>
std::vector<T> Vector< T >::_vec
private

Underlying std::vector.


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