Main MRPT website > C++ reference
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 Types

typedef CVectorTemplate< T > mrpt_autotype

Public Member Functions

DECLARE_MRPT_CONTAINER_TYPES
DECLARE_MRPT_CONTAINER_IS_VECTOR 
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.
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].

Protected 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 [protected]

Definition at line 54 of file CVectorTemplate.h.

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

Definition at line 57 of file CVectorTemplate.h.


Constructor & Destructor Documentation

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

Construct the vector with a given initial size.

Definition at line 63 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 69 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 254 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 153 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 167 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 448 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 90 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 76 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 186 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 206 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 227 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 456 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 108 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 314 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 265 of file CVectorTemplate.h.

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

Calculate the mean value of a vector.

Definition at line 303 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 411 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 355 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 385 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 325 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 122 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 398 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 340 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 424 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 370 of file CVectorTemplate.h.

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

unary transpose operator

Definition at line 437 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 292 of file CVectorTemplate.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010