MRPT logo

mrpt::math::CVectorTemplate< T > Class Template Reference

This template class provides the basic functionality for a general 1D any-size, resizable container of numerical or non-numerical elements. More...

#include <mrpt/math/CVectorTemplate.h>

Inheritance diagram for mrpt::math::CVectorTemplate< T >:
Inheritance graph
[legend]
Collaboration diagram for mrpt::math::CVectorTemplate< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CVectorTemplate (size_t creationSize=0)
 Construct the vector with a given initial size.
 CVectorTemplate (size_t creationSize, const T &initVal)
 Construct the vector with a given initial size and initial filling value.
virtual ~CVectorTemplate ()
void extract_vector (const size_t &index, CVectorTemplate< T > &out)
 This function extract a part of a vector.
CVectorTemplate< T > extract_vector (const size_t index, const unsigned int length)
 This function extract a part of a vector.
void insert_vector (const size_t &index, const CVectorTemplate< T > &in)
 This function insert the vector "in" into in the vector from an index.
void operator+= (const CMatrixTemplateNumeric< T > &M)
 Adds a row or column matrix of the correct length to the vector.
void concatenate (const CVectorTemplate &first, const CVectorTemplate &second)
 This function join two vectors in a new vector.
void deconcatenate (CVectorTemplate &first, CVectorTemplate &second, const size_t &index)
 This function split a vectors in a two new vector.
void find_max (size_t &index, T &val)
 This function find the maximun value of a vector and return this value and his index.
void find_min (size_t &index, T &val)
 This function find the minimun value of a vector and return this value and his index.
void find_min_max (size_t &index_min, size_t &index_max, T &min, T &max)
 This function find the maximun and minimun value of a vector and return this value and his index.
void abs ()
 This function make the vector absolute value for each element.
void loadFromTextFile (const std::string &file)
 This function is a fast solution to read a vector from text, but isn't optimum.
void saveToTextFile (const std::string &file)
 This function is a fast solution to write a vector into a text file, but isn't optimum.
mean ()
 Calculate the mean value of a vector.
CMatrixTemplateNumeric< T > likeMatrix ()
 Return the vector like a matrix with dimension [1 , vector-size].
CVectorTemplate< T > operator+ (CVectorTemplate &b)
 A template function for adding std::vector's having the same number of elements.
CVectorTemplate< T > operator- (CVectorTemplate &b)
 A template function for substracting std::vector's having the same number of elements.
CVectorTemplate< T > operator* (CVectorTemplate &b)
 A template function for scalar product (element by element, like .
CVectorTemplate< T > operator/ (CVectorTemplate &b)
 A template function for scalar division (element by element, like .
CVectorTemplate< T > operator+ (T b)
 A template function for adding a scalar to a std::vector.
CVectorTemplate< T > operator- (T b)
 A template function for subtracting a scalar to a std::vector.
CVectorTemplate< T > operator* (T b)
 A template function for multiplying a scalar to a std::vector.
CVectorTemplate< T > operator/ (T b)
 A template function for adding a scalar to a std::vector.
CMatrixTemplateNumeric< T > operator~ ()
 unary transpose operator
template<size_t N>
void extract_array (size_t first_idx, CArrayPOD< T, N > &out_array) const
 Extract a fixed-size array from the vector elements [first_idx,first_idx+N-1].
template<size_t N>
void insert_array (size_t first_idx, CArrayPOD< T, N > &in_array)
 Insert a fixed-size array into the vector elements [first_idx,first_idx+N-1].

Private Types

typedef std::vector< T > base_class

Detailed Description

template<class T>
class mrpt::math::CVectorTemplate< T >

This template class provides the basic functionality for a general 1D any-size, resizable container of numerical or non-numerical elements.

NOTES:

Definition at line 51 of file CVectorTemplate.h.


Member Typedef Documentation

template<class T>
typedef std::vector<T> mrpt::math::CVectorTemplate< T >::base_class [private]

Definition at line 57 of file CVectorTemplate.h.


Constructor & Destructor Documentation

template<class T>
mrpt::math::CVectorTemplate< T >::CVectorTemplate ( size_t  creationSize = 0  )  [inline]

Construct the vector with a given initial size.

Definition at line 64 of file CVectorTemplate.h.

template<class T>
mrpt::math::CVectorTemplate< T >::CVectorTemplate ( size_t  creationSize,
const T &  initVal 
) [inline]

Construct the vector with a given initial size and initial filling value.

Definition at line 70 of file CVectorTemplate.h.

template<class T>
virtual mrpt::math::CVectorTemplate< T >::~CVectorTemplate (  )  [inline, virtual]

Definition at line 74 of file CVectorTemplate.h.


Member Function Documentation

template<class T>
void mrpt::math::CVectorTemplate< T >::abs (  )  [inline]

This function make the vector absolute value for each element.

Definition at line 257 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::concatenate ( const CVectorTemplate< T > &  first,
const CVectorTemplate< T > &  second 
) [inline]

This function join two vectors in a new vector.

Definition at line 156 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::deconcatenate ( CVectorTemplate< T > &  first,
CVectorTemplate< T > &  second,
const size_t &  index 
) [inline]

This function split a vectors in a two new vector.

Definition at line 170 of file CVectorTemplate.h.

template<class T>
template<size_t N>
void mrpt::math::CVectorTemplate< T >::extract_array ( size_t  first_idx,
CArrayPOD< T, N > &  out_array 
) const [inline]

Extract a fixed-size array from the vector elements [first_idx,first_idx+N-1].

Definition at line 451 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::extract_vector ( const size_t  index,
const unsigned int  length 
) [inline]

This function extract a part of a vector.

It's necessary initialize the output vector to desired size.

Definition at line 93 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::extract_vector ( const size_t &  index,
CVectorTemplate< T > &  out 
) [inline]

This function extract a part of a vector.

It's necessary initialize the output vector to desired size.

Definition at line 79 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::find_max ( size_t &  index,
T &  val 
) [inline]

This function find the maximun value of a vector and return this value and his index.

Definition at line 189 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::find_min ( size_t &  index,
T &  val 
) [inline]

This function find the minimun value of a vector and return this value and his index.

Definition at line 209 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::find_min_max ( size_t &  index_min,
size_t &  index_max,
T &  min,
T &  max 
) [inline]

This function find the maximun and minimun value of a vector and return this value and his index.

Definition at line 230 of file CVectorTemplate.h.

template<class T>
template<size_t N>
void mrpt::math::CVectorTemplate< T >::insert_array ( size_t  first_idx,
CArrayPOD< T, N > &  in_array 
) [inline]

Insert a fixed-size array into the vector elements [first_idx,first_idx+N-1].

Definition at line 459 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::insert_vector ( const size_t &  index,
const CVectorTemplate< T > &  in 
) [inline]

This function insert the vector "in" into in the vector from an index.

Definition at line 111 of file CVectorTemplate.h.

template<class T>
CMatrixTemplateNumeric<T> mrpt::math::CVectorTemplate< T >::likeMatrix (  )  [inline]

Return the vector like a matrix with dimension [1 , vector-size].

Definition at line 317 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::loadFromTextFile ( const std::string &  file  )  [inline]

This function is a fast solution to read a vector from text, but isn't optimum.

Definition at line 268 of file CVectorTemplate.h.

template<class T>
T mrpt::math::CVectorTemplate< T >::mean (  )  [inline]

Calculate the mean value of a vector.

Definition at line 306 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator* ( b  )  [inline]

A template function for multiplying a scalar to a std::vector.

Definition at line 414 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator* ( CVectorTemplate< T > &  b  )  [inline]

A template function for scalar product (element by element, like .

* in MATLAB) of std::vector's having the same number of elements.

Definition at line 358 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator+ ( b  )  [inline]

A template function for adding a scalar to a std::vector.

Definition at line 388 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator+ ( CVectorTemplate< T > &  b  )  [inline]

A template function for adding std::vector's having the same number of elements.

Definition at line 328 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::operator+= ( const CMatrixTemplateNumeric< T > &  M  )  [inline]

Adds a row or column matrix of the correct length to the vector.

Definition at line 125 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator- ( b  )  [inline]

A template function for subtracting a scalar to a std::vector.

Definition at line 401 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator- ( CVectorTemplate< T > &  b  )  [inline]

A template function for substracting std::vector's having the same number of elements.

Definition at line 343 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator/ ( b  )  [inline]

A template function for adding a scalar to a std::vector.

Definition at line 427 of file CVectorTemplate.h.

template<class T>
CVectorTemplate<T> mrpt::math::CVectorTemplate< T >::operator/ ( CVectorTemplate< T > &  b  )  [inline]

A template function for scalar division (element by element, like .

/ in MATLAB) of std::vector's having the same number of elements.

Definition at line 373 of file CVectorTemplate.h.

template<class T>
CMatrixTemplateNumeric<T> mrpt::math::CVectorTemplate< T >::operator~ (  )  [inline]

unary transpose operator

Definition at line 440 of file CVectorTemplate.h.

template<class T>
void mrpt::math::CVectorTemplate< T >::saveToTextFile ( const std::string &  file  )  [inline]

This function is a fast solution to write a vector into a text file, but isn't optimum.

Definition at line 295 of file CVectorTemplate.h.




Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010