Particle Identification and Tracking
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
utilities::Tuple< T, length > Class Template Reference

Class for carrying around the posistion and velocity vectors. More...

#include <tuple.h>

+ Inheritance diagram for utilities::Tuple< T, length >:
+ Collaboration diagram for utilities::Tuple< T, length >:

Public Member Functions

bool operator== (const Tuple &b) const
 Over loads for comparison. More...
 
void operator= (const Tuple &y)
 Over loads for copying. More...
 
Tuple operator- ()
 Over loads for negation. More...
 
T & operator[] (int i)
 Overides random access. More...
 
const T & operator[] (int i) const
 Overides random access. More...
 
Tuple operator+ (const Tuple &y) const
 Over loads for element-wise addition. More...
 
Tuple operator+ (const T y) const
 Over loads for constant addition. More...
 
void operator+= (const Tuple &y)
 adds Tuple to the current Tuple More...
 
void operator+= (const T y)
 adds constant to the current Tuple More...
 
Tuple operator- (const Tuple &y) const
 Over loads for element-wise subtraction. More...
 
Tuple operator- (const T y) const
 Over loads for constant subtraction. More...
 
void operator-= (const Tuple &y)
 subtracts Tuple to the current Tuple More...
 
void operator-= (const T y)
 subtracts constant to the current Tuple More...
 
Tuple operator* (const T y) const
 Over loads for constant multilplication. More...
 
Tuple operator* (const Tuple &y) const
 Over loads for elementwise mustiplication. More...
 
void operator*= (const Tuple &y)
 element wise multilication of the current Tuple More...
 
void operator*= (const T y)
 multiplies current Tuple by a constant More...
 
Tuple operator/ (const Tuple &y) const
 Over loads for element-wise division. More...
 
void operator/= (const Tuple &y)
 element wise division of the current Tuple More...
 
void operator/= (const T y)
 devides current Tuple by a constant More...
 
magnitude_sqr () const
 square of the magnitude of the Tuple assuming euclidian space More...
 
magnitude () const
 magnitude of the Tuple assuming euclidian space More...
 
dot (const Tuple &y) const
 take the dot product between two tuple More...
 
prod () const
 Ruturns the product of the elements. More...
 
sum () const
 Ruturns the sum of the elements. More...
 
max () const
 Returns the maximum element. More...
 
min () const
 Returns the minimum element. More...
 
void make_unit ()
 makes a tuple a unit vector More...
 
Tuple direction () const
 makes a tuple a unit vector More...
 
void print () const
 prints the data More...
 
void clear ()
 sets tuple to (0,0) More...
 
 Tuple ()
 empty constructor More...
 
 Tuple (const Tuple &y)
 Copy constructor. More...
 
dist_sqr (const Tuple &y) const
 returns the distance squared between two points More...
 
 ~Tuple ()
 Destructor. More...
 
 Tuple (T x)
 Uniform constructor. More...
 
 Tuple (T x, T y)
 hard coded 2-D constructor More...
 
 Tuple (T x, T y, T z)
 hard coded 3-D constructor More...
 
 Tuple (const T *)
 Takes in an array, assumes it is the correct length. More...
 
const T * get_ptr () const
 returns a pointer to the internal data in a safe way. More...
 
T * get_ptr ()
 returns a pointer to the internal data in a unsafe way. More...
 
template<class T2 >
 Tuple (const Tuple< T2, length > &)
 Template for converting data types. More...
 
int get_len () const
 Returns the length. More...
 

Static Public Attributes

static const int length_ = length
 

Protected Attributes

data_ [length]
 pointer to data More...
 

Detailed Description

template<class T, int length>
class utilities::Tuple< T, length >

Class for carrying around the posistion and velocity vectors.

The logic for making this class is a memory concern that there will be millions of these objects. Also to make some specific matlab like functions simpler to implement

Todo:
move actual code to a c++ file and use explicit instantiation

Constructor & Destructor Documentation

template<class T , int length>
utilities::Tuple< T, length >::Tuple ( )

empty constructor

template<class T , int length>
utilities::Tuple< T, length >::Tuple ( const Tuple< T, length > &  y)

Copy constructor.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
utilities::Tuple< T, length >::~Tuple ( )

Destructor.

template<class T, int length>
utilities::Tuple< T, length >::Tuple ( x)

Uniform constructor.

template<class T, int length>
utilities::Tuple< T, length >::Tuple ( x,
y 
)

hard coded 2-D constructor

template<class T, int length>
utilities::Tuple< T, length >::Tuple ( x,
y,
z 
)

hard coded 3-D constructor

template<class T, int length>
utilities::Tuple< T, length >::Tuple ( const T *  in)

Takes in an array, assumes it is the correct length.

template<class T , int length>
template<class T2 >
utilities::Tuple< T, length >::Tuple ( const Tuple< T2, length > &  y)

Template for converting data types.

Member Function Documentation

template<class T , int length>
void utilities::Tuple< T, length >::clear ( )

sets tuple to (0,0)

Referenced by tracking::Hash_shelf::compute_mean_forward_disp(), and main().

template<class T , int length>
Tuple< T, length > utilities::Tuple< T, length >::direction ( ) const

makes a tuple a unit vector

References utilities::Tuple< T, length >::make_unit().

template<class T , int length>
T utilities::Tuple< T, length >::dist_sqr ( const Tuple< T, length > &  y) const

returns the distance squared between two points

References utilities::Tuple< T, length >::data_.

Referenced by tracking::particle_base::distancesq().

template<class T , int length>
T utilities::Tuple< T, length >::dot ( const Tuple< T, length > &  y) const

take the dot product between two tuple

References utilities::Tuple< T, length >::data_.

template<class T, int length>
int utilities::Tuple< T, length >::get_len ( ) const
inline

Returns the length.

template<class T , int length>
const T * utilities::Tuple< T, length >::get_ptr ( ) const

returns a pointer to the internal data in a safe way.

mostly to make it simpler to write out to hdf wrappers

Referenced by utilities::Attr_list_hdf::get_value(), utilities::ND_Array< T, N >::ND_Array(), and utilities::Attr_list_hdf::set_value().

template<class T , int length>
T * utilities::Tuple< T, length >::get_ptr ( )

returns a pointer to the internal data in a unsafe way.

mostly to make it simpler to read out from hdf wrappers

template<class T , int length>
T utilities::Tuple< T, length >::magnitude ( ) const

magnitude of the Tuple assuming euclidian space

template<class T , int length>
T utilities::Tuple< T, length >::magnitude_sqr ( ) const

square of the magnitude of the Tuple assuming euclidian space

Referenced by tracking::Corr_theta_2pt::compute().

template<class T , int length>
void utilities::Tuple< T, length >::make_unit ( )
template<class T , int length>
T utilities::Tuple< T, length >::max ( ) const

Returns the maximum element.

Referenced by main().

template<class T , int length>
T utilities::Tuple< T, length >::min ( ) const

Returns the minimum element.

template<class T, int length>
Tuple< T, length > utilities::Tuple< T, length >::operator* ( const T  y) const

Over loads for constant multilplication.

References utilities::Tuple< T, length >::data_.

template<class T, int length>
Tuple< T, length > utilities::Tuple< T, length >::operator* ( const Tuple< T, length > &  y) const

Over loads for elementwise mustiplication.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
void utilities::Tuple< T, length >::operator*= ( const Tuple< T, length > &  y)

element wise multilication of the current Tuple

References utilities::Tuple< T, length >::data_.

template<class T, int length>
void utilities::Tuple< T, length >::operator*= ( const T  y)

multiplies current Tuple by a constant

template<class T , int length>
Tuple< T, length > utilities::Tuple< T, length >::operator+ ( const Tuple< T, length > &  y) const

Over loads for element-wise addition.

References utilities::Tuple< T, length >::data_.

template<class T, int length>
Tuple< T, length > utilities::Tuple< T, length >::operator+ ( const T  y) const

Over loads for constant addition.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
void utilities::Tuple< T, length >::operator+= ( const Tuple< T, length > &  y)

adds Tuple to the current Tuple

References utilities::Tuple< T, length >::data_.

template<class T, int length>
void utilities::Tuple< T, length >::operator+= ( const T  y)

adds constant to the current Tuple

template<class T , int length>
Tuple< T, length > utilities::Tuple< T, length >::operator- ( )

Over loads for negation.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
Tuple< T, length > utilities::Tuple< T, length >::operator- ( const Tuple< T, length > &  y) const

Over loads for element-wise subtraction.

References utilities::Tuple< T, length >::data_.

template<class T, int length>
Tuple< T, length > utilities::Tuple< T, length >::operator- ( const T  y) const

Over loads for constant subtraction.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
void utilities::Tuple< T, length >::operator-= ( const Tuple< T, length > &  y)

subtracts Tuple to the current Tuple

References utilities::Tuple< T, length >::data_.

template<class T, int length>
void utilities::Tuple< T, length >::operator-= ( const T  y)

subtracts constant to the current Tuple

template<class T , int length>
Tuple< T, length > utilities::Tuple< T, length >::operator/ ( const Tuple< T, length > &  y) const

Over loads for element-wise division.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
void utilities::Tuple< T, length >::operator/= ( const Tuple< T, length > &  y)

element wise division of the current Tuple

References utilities::Tuple< T, length >::data_.

template<class T, int length>
void utilities::Tuple< T, length >::operator/= ( const T  y)

devides current Tuple by a constant

template<class T , int length>
void utilities::Tuple< T, length >::operator= ( const Tuple< T, length > &  y)

Over loads for copying.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
bool utilities::Tuple< T, length >::operator== ( const Tuple< T, length > &  b) const

Over loads for comparison.

References utilities::Tuple< T, length >::data_.

template<class T , int length>
T & utilities::Tuple< T, length >::operator[] ( int  i)

Overides random access.

template<class T , int length>
const T & utilities::Tuple< T, length >::operator[] ( int  i) const

Overides random access.

template<class T , int length>
void utilities::Tuple< T, length >::print ( ) const

prints the data

Referenced by main().

template<class T , int length>
T utilities::Tuple< T, length >::prod ( ) const

Ruturns the product of the elements.

Referenced by utilities::ND_Array< T, N >::ND_Array().

template<class T , int length>
T utilities::Tuple< T, length >::sum ( ) const

Ruturns the sum of the elements.

Member Data Documentation

template<class T, int length>
T utilities::Tuple< T, length >::data_[length]
protected
template<class T, int length>
const int utilities::Tuple< T, length >::length_ = length
static

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