Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions

mrpt::mrpt_base_vector< _TYPE > Struct Template Reference

Numeric vectors compatible with mrpt/math/ops_containers.h: More...

#include <mrpt/utils/types.h>

Inheritance diagram for mrpt::mrpt_base_vector< _TYPE >:
Inheritance graph
[legend]
Collaboration diagram for mrpt::mrpt_base_vector< _TYPE >:
Collaboration graph
[legend]

List of all members.

Classes

struct  mrpt_container

Public Types

typedef mrpt_base_vector< _TYPE > mrpt_autotype

Public Member Functions

 mrpt_base_vector ()
 mrpt_base_vector (const std::vector< _TYPE > &o)
mrpt_base_vector< _TYPE > & operator= (const std::vector< _TYPE > &o)
 mrpt_base_vector (size_t N)
 mrpt_base_vector (size_t N, _TYPE val)
template<typename ITERATOR >
 mrpt_base_vector (const ITERATOR &b, const ITERATOR &e)
Methods common to all containers

size_t countNonZero () const
void fill (const _TYPE &val)
_TYPE maximum (size_t *maxIndex=NULL) const
_TYPE minimum (size_t *minIndex=NULL) const
void minimum_maximum (_TYPE &out_min, _TYPE &out_max, size_t *minIndex=NULL, size_t *maxIndex=NULL) const
_TYPE norm_inf (size_t *maxIndex=NULL) const
_TYPE sumAll () const
template<typename RET_TYPE >
RET_TYPE sumAllRetType () const
template<class CONTAINEROUT >
void cumsum (CONTAINEROUT &out) const
template<class CONTAINEROUT >
CONTAINEROUT cumsum () const
template<class CONTAINER2 >
size_t countCommonElements (const CONTAINER2 &b) const
 Counts the number of elements that appear in both containers (comparison through the == operator).
std::vector< double > histogram (double limit_min, double limit_max, size_t number_bins, bool do_normalization=false) const
 Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.
template<class F >
mrpt_autotype & applyToAllElements (_TYPE(*function)(_TYPE))
mrpt_autotype & Sqrt ()
mrpt_autotype & Abs ()
mrpt_autotype & Square ()
mrpt_autotype & Exp ()
mrpt_autotype & Log ()
_TYPE squareNorm () const
_TYPE norm () const
double mean () const
void adjustRange (const _TYPE min_val, const _TYPE max_val)
void normalize (const _TYPE min_val=0, const _TYPE max_val=1)
double std (bool unbiased=true) const
void meanAndStd (double &out_mean, double &out_std, bool unbiased=true)
void loadFromTextFileAsVector (const std::string &file)
void saveToTextFileAsVector (const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool asColumnVector=false) const

Detailed Description

template<typename _TYPE>
struct mrpt::mrpt_base_vector< _TYPE >

Numeric vectors compatible with mrpt/math/ops_containers.h:

Definition at line 169 of file base/include/mrpt/utils/types.h.


Member Typedef Documentation

template<typename _TYPE>
typedef mrpt_base_vector<_TYPE> mrpt::mrpt_base_vector< _TYPE >::mrpt_autotype

Definition at line 177 of file base/include/mrpt/utils/types.h.


Constructor & Destructor Documentation

template<typename _TYPE>
mrpt::mrpt_base_vector< _TYPE >::mrpt_base_vector (  )  [inline]

Definition at line 171 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt::mrpt_base_vector< _TYPE >::mrpt_base_vector ( const std::vector< _TYPE > &  o  )  [inline]

Definition at line 172 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt::mrpt_base_vector< _TYPE >::mrpt_base_vector ( size_t  N  )  [inline]

Definition at line 174 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt::mrpt_base_vector< _TYPE >::mrpt_base_vector ( size_t  N,
_TYPE  val 
) [inline]

Definition at line 175 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<typename ITERATOR >
mrpt::mrpt_base_vector< _TYPE >::mrpt_base_vector ( const ITERATOR &  b,
const ITERATOR &  e 
) [inline]

Definition at line 176 of file base/include/mrpt/utils/types.h.


Member Function Documentation

template<typename _TYPE>
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::Abs (  )  [inline]

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::adjustRange ( const _TYPE  min_val,
const _TYPE  max_val 
) [inline]
Parameters:
max_val Normalize all the elements such as they are in the given range

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<class F >
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::applyToAllElements ( _TYPE(*)(_TYPE)  function  )  [inline]

Applies a generic operation "T func(T val)" to all the elements.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<class CONTAINER2 >
size_t mrpt::mrpt_base_vector< _TYPE >::countCommonElements ( const CONTAINER2 &  b  )  const [inline]

Counts the number of elements that appear in both containers (comparison through the == operator).

It is assumed that no repeated elements appear within each of the containers.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
size_t mrpt::mrpt_base_vector< _TYPE >::countNonZero (  )  const [inline]

Count how many elements in a container are non-zero.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<class CONTAINEROUT >
void mrpt::mrpt_base_vector< _TYPE >::cumsum ( CONTAINEROUT &  out  )  const [inline]

Cumsum of all the elements, saving in an output container

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<class CONTAINEROUT >
CONTAINEROUT mrpt::mrpt_base_vector< _TYPE >::cumsum (  )  const [inline]

Cumsum of all the elements, returning a container of the given type, for example: CMatrixDouble m = mat.cumsum<CMatrixDouble>();

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::Exp (  )  [inline]

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::fill ( const _TYPE &  val  )  [inline]

Fill all the elements with a given value

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
std::vector<double> mrpt::mrpt_base_vector< _TYPE >::histogram ( double  limit_min,
double  limit_max,
size_t  number_bins,
bool  do_normalization = false 
) const [inline]

Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.

In any case this is a "linear" histogram, i.e. for matrices, all the elements are taken as if they were a plain sequence, not taking into account they were in columns or rows.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::loadFromTextFileAsVector ( const std::string &  file  )  [inline]

Load this matrix or vector from a text file which can contain a column or row vector or a matrix, then assigns to this container all those elements in order (for example, a file with a 10x2 matrix can be loaded into a 20-length array)

Exceptions:
std::exception On any error.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::Log (  )  [inline]

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::maximum ( size_t *  maxIndex = NULL  )  const [inline]

Finds the maximum value (and the corresponding zero-based index).

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
double mrpt::mrpt_base_vector< _TYPE >::mean (  )  const [inline]

Return the mean of the container (for matrices, as if it were a vector with all its elements).

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::meanAndStd ( double &  out_mean,
double &  out_std,
bool  unbiased = true 
) [inline]

Return the mean and standard deviation of all the elements in the container.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::minimum ( size_t *  minIndex = NULL  )  const [inline]

Finds the minimum value (and the corresponding zero-based index).

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::minimum_maximum ( _TYPE &  out_min,
_TYPE &  out_max,
size_t *  minIndex = NULL,
size_t *  maxIndex = NULL 
) const [inline]

Minimum and maximum of a vector at once

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::norm (  )  const [inline]

Return the norm of the container (for matrices, as if it were a vector with all its elements).

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::norm_inf ( size_t *  maxIndex = NULL  )  const [inline]

Compute the norm-infinite of a vector ($f[ ||{v}||_ $f]), ie the maximum absolute value of the elements.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::normalize ( const _TYPE  min_val = 0,
const _TYPE  max_val = 1 
) [inline]
Parameters:
max_val Normalize all the elements such as they are in the given range

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt_base_vector<_TYPE>& mrpt::mrpt_base_vector< _TYPE >::operator= ( const std::vector< _TYPE > &  o  )  [inline]
template<typename _TYPE>
void mrpt::mrpt_base_vector< _TYPE >::saveToTextFileAsVector ( const std::string &  file,
mrpt::math::TMatrixTextFileFormat  fileFormat = mrpt::math::MATRIX_FORMAT_ENG,
bool  asColumnVector = false 
) const [inline]

Save this matrix or vector to a text file as a row (or optionally as a vector), independently of this containers actually being a vector, an array or a matrix.

Exceptions:
std::exception On any error.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::Sqrt (  )  [inline]

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
mrpt_autotype& mrpt::mrpt_base_vector< _TYPE >::Square (  )  [inline]

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::squareNorm (  )  const [inline]

Return the square norm of the container (for matrices, as if it were a vector with all its elements).

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
double mrpt::mrpt_base_vector< _TYPE >::std ( bool  unbiased = true  )  const [inline]

Return the standard deviation of all the elements in the container.

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
_TYPE mrpt::mrpt_base_vector< _TYPE >::sumAll (  )  const [inline]

Sum all the elements, returning a value of the same type than the container

Definition at line 180 of file base/include/mrpt/utils/types.h.

template<typename _TYPE>
template<typename RET_TYPE >
RET_TYPE mrpt::mrpt_base_vector< _TYPE >::sumAllRetType (  )  const [inline]

Sum all the elements, returning a value of a custom type (this could be used to avoid overflow with containers of integers)

Definition at line 180 of file base/include/mrpt/utils/types.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.7.1 for MRPT 0.9.1 SVN:exported at Fri Aug 6 10:31:35 UTC 2010