MRPT  2.0.1
List of all members | Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes
mrpt::math::CVectorDynamic< T > Class Template Reference

Detailed Description

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

Template for column vectors of dynamic size, compatible with Eigen.

Note
For a complete introduction to Matrices and vectors in MRPT, see: http://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes
See also
CVectorDynamic, CMatrixFixed, CVectorFixed

Definition at line 31 of file CVectorDynamic.h.

#include <mrpt/math/CVectorDynamic.h>

Inheritance diagram for mrpt::math::CVectorDynamic< T >:

Public Member Functions

void realloc (const size_t new_len, bool newElementsToZero=false)
 Internal use only: It reallocs the memory for the 2D matrix, maintaining the previous contents if posible. More...
 
void swap (CVectorDynamic< T > &o)
 
 CVectorDynamic ()=default
 
 CVectorDynamic (size_t N, bool initZero=true)
 Initializes to a vector of "N" zeros. More...
 
template<typename U >
 CVectorDynamic (const CVectorDynamic< U > &m)
 Copy (casting from if needed) from another matrix. More...
 
template<std::size_t ROWS>
 CVectorDynamic (const CMatrixFixed< T, ROWS, 1 > &v)
 Ctor from a fixed-size vector. More...
 
template<typename ARRAY , typename = std::enable_if_t<std::is_array_v<ARRAY>>>
 CVectorDynamic (const ARRAY &data)
 Constructor from a given size and a C array. More...
 
template<class Derived >
 CVectorDynamic (const Eigen::MatrixBase< Derived > &m)
 Convert from Eigen matrix. More...
 
size_type rows () const
 Number of rows in the vector. More...
 
size_type cols () const
 Number of columns in the matrix (always 1) More...
 
size_type size () const
 Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x)) More...
 
bool empty () const
 
void setSize (size_t row, size_t col, bool zeroNewElements=false)
 Changes the size of matrix, maintaining the previous contents. More...
 
void resize (std::size_t N, bool zeroNewElements=false)
 
template<class MAT >
void fromVectorLike (const MAT &m)
 
template<typename U >
CVectorDynamicoperator= (const CMatrixDynamic< U > &m)
 Assignment operator from another matrix (possibly of a different type) More...
 
template<class Derived >
CVectorDynamicoperator= (const Eigen::MatrixBase< Derived > &m)
 Assignment from an Eigen matrix. More...
 
template<std::size_t ROWS>
CVectorDynamicoperator= (const CMatrixFixed< T, ROWS, 1 > &v)
 Assignment from a fixed-size vector. More...
 
void push_back (const T &val)
 
template<int LEN>
CMatrixFixed< Scalar, LEN, 1 > segmentCopy (int start=0) const
 const segmentCopy(): Returns a copy of the given vector segment More...
 
CVectorDynamic< ScalarsegmentCopy (int start, int LEN) const
 const segmentCopy(): Returns a copy of the given vector segment (non templated version, dynamic length) More...
 
T & operator() (size_t row, size_t col)
 Subscript operator to get/set individual elements. More...
 
const T & operator() (size_t row, size_t col) const
 Subscript operator to get individual elements. More...
 
T & operator[] (size_t ith)
 Subscript operator to get/set an individual element from a row or column matrix. More...
 
const T & operator[] (size_t ith) const
 
template<typename EIGEN_VECTOR = eigen_t, typename EIGEN_MAP = Eigen::Map< EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
EIGEN_MAP asEigen ()
 Get as an Eigen-compatible Eigen::Map object. More...
 
template<typename EIGEN_VECTOR = Eigen::Matrix<T, -1, 1, 0, -1, 1>, typename EIGEN_MAP = Eigen::Map< const EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
EIGEN_MAP asEigen () const
 
template<typename T2 >
CVectorDynamic< T2 > cast () const
 
CVectorDynamic< T > & mvbDerived ()
 
const CVectorDynamic< T > & mvbDerived () const
 
Operations that DO require `#include <Eigen/Dense>` in user code
auto block (int start_row, int start_col)
 non-const block(): Returns an Eigen::Block reference to the block More...
 
auto block (int start_row, int start_col, int BLOCK_ROWS, int BLOCK_COLS)
 
auto block (int start_row, int start_col, int BLOCK_ROWS, int BLOCK_COLS) const
 
auto transpose ()
 
auto transpose () const
 
auto array ()
 
auto array () const
 
auto operator- () const
 
auto operator- (const MatrixVectorBase< S2, D2 > &m2) const
 
auto operator+ (const MatrixVectorBase< S2, D2 > &m2) const
 
void operator+= (const MatrixVectorBase< S2, D2 > &m2)
 
void operator-= (const MatrixVectorBase< S2, D2 > &m2)
 
auto operator* (const MatrixVectorBase< S2, D2 > &m2) const
 
auto operator* (const T s) const
 
CMatrixFixed< T, N, 1 > tail () const
 
CMatrixFixed< T, N, 1 > head () const
 
Standalone operations (do NOT require `#include <Eigen/Dense>`)
CVectorDynamic< T > operator- (const CVectorDynamic< T > &m2) const
 
CVectorDynamic< T > operator+ (const CVectorDynamic< T > &m2) const
 
void operator+= (T s)
 
void operator+= (const CVectorDynamic< T > &m2)
 
void operator-= (T s)
 
void operator-= (const CVectorDynamic< T > &m2)
 
CMatrixDynamic< T > operator* (const CMatrixDynamic< T > &v)
 
CVectorDynamic< T > operator* (const CVectorDynamic< T > &m2) const
 
T & coeffRef (int r, int c)
 
const T & coeff (int r, int c) const
 
minCoeff () const
 Minimum value in the matrix/vector. More...
 
minCoeff (std::size_t &outIndexOfMin) const
 
minCoeff (std::size_t &rowIdx, std::size_t &colIdx) const
 
maxCoeff () const
 Maximum value in the matrix/vector. More...
 
maxCoeff (std::size_t &outIndexOfMax) const
 
maxCoeff (std::size_t &rowIdx, std::size_t &colIdx) const
 
bool isSquare () const
 returns true if matrix is NxN More...
 
norm_inf () const
 Compute the norm-infinite of a vector ($f[ ||{v}||_ $f]), ie the maximum absolute value of the elements. More...
 
norm () const
 Compute the L2 norm of a vector/array/matrix (the Euclidean distance to the origin, taking all the elements as a single vector). More...
 
void operator*= (T s)
 
dot (const CVectorDynamic< T > &v) const
 dot product of this \cdot v More...
 
dot (const MatrixVectorBase< T, CVectorDynamic< T > > &v) const
 
void matProductOf_Ab (const CMatrixDynamic< T > &A, const CVectorDynamic< T > &b)
 this = A * b , with A and b a dynamic matrix & vector More...
 
void matProductOf_Atb (const CMatrixDynamic< T > &A, const CVectorDynamic< T > &b)
 this = AT * b , with A and b a dynamic matrix & vector More...
 
sum () const
 Sum of all elements in matrix/vector. More...
 
sum_abs () const
 Sum of the absolute value of all elements in matrix/vector. More...
 
std::string asString () const
 Returns a string representation of the vector/matrix, using Eigen's default settings. More...
 
bool fromMatlabStringFormat (const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
 Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must start with '[' and end with ']'. More...
 
std::string inMatlabFormat (const std::size_t decimal_digits=6) const
 Exports the matrix as a string compatible with Matlab/Octave. More...
 
void saveToTextFile (const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
 Saves the vector/matrix to a file compatible with MATLAB/Octave text format. More...
 
void loadFromTextFile (std::istream &f)
 Loads a vector/matrix from a text file, compatible with MATLAB text format. More...
 
void loadFromTextFile (const std::string &file)
 
bool operator== (const OTHERMATVEC &o) const
 
bool operator!= (const OTHERMATVEC &o) const
 

Protected Types

using vec_t = mrpt::containers::vector_with_small_size_optimization< T, small_size, MRPT_MAX_STATIC_ALIGN_BYTES >
 

Protected Attributes

vec_t m_data
 

Static Protected Attributes

static constexpr size_t small_size = 16
 

Matrix type definitions

using value_type = T
 The type of the matrix elements. More...
 
using Scalar = T
 
using Index = int
 
using reference = T &
 
using const_reference = const T &
 
using size_type = int
 
using difference_type = std::ptrdiff_t
 
using eigen_t = Eigen::Matrix< T, -1, 1, 0, -1, 1 >
 
static constexpr int RowsAtCompileTime = -1
 
static constexpr int ColsAtCompileTime = 1
 
static constexpr int is_mrpt_type = 1
 

Iterators interface

using iterator = typename vec_t::iterator
 
using const_iterator = typename vec_t::const_iterator
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Initialization methods

void fill (const T &val)
 
void setConstant (const T value)
 
void setConstant (size_t nrows, size_t ncols, const T value)
 
void setConstant (size_t nrows, const T value)
 
void assign (const std::size_t N, const T value)
 
void setZero ()
 
void setZero (size_t nrows, size_t ncols)
 
void setZero (size_t nrows)
 
static CVectorDynamic< T > Constant (const T value)
 
static CVectorDynamic< T > Constant (size_t nrows, size_t ncols, const T value)
 
static CVectorDynamic< T > Zero ()
 
static CVectorDynamic< T > Zero (size_t nrows, size_t ncols)
 

Member Typedef Documentation

◆ const_iterator

template<class T>
using mrpt::math::CVectorDynamic< T >::const_iterator = typename vec_t::const_iterator

Definition at line 60 of file CVectorDynamic.h.

◆ const_reference

template<class T>
using mrpt::math::CVectorDynamic< T >::const_reference = const T&

Definition at line 48 of file CVectorDynamic.h.

◆ difference_type

template<class T>
using mrpt::math::CVectorDynamic< T >::difference_type = std::ptrdiff_t

Definition at line 50 of file CVectorDynamic.h.

◆ eigen_t

template<class T>
using mrpt::math::CVectorDynamic< T >::eigen_t = Eigen::Matrix<T, -1, 1, 0, -1, 1>

Definition at line 54 of file CVectorDynamic.h.

◆ Index

template<class T>
using mrpt::math::CVectorDynamic< T >::Index = int

Definition at line 46 of file CVectorDynamic.h.

◆ iterator

template<class T>
using mrpt::math::CVectorDynamic< T >::iterator = typename vec_t::iterator

Definition at line 59 of file CVectorDynamic.h.

◆ reference

template<class T>
using mrpt::math::CVectorDynamic< T >::reference = T&

Definition at line 47 of file CVectorDynamic.h.

◆ Scalar

template<class T>
using mrpt::math::CVectorDynamic< T >::Scalar = T

Definition at line 45 of file CVectorDynamic.h.

◆ size_type

template<class T>
using mrpt::math::CVectorDynamic< T >::size_type = int

Definition at line 49 of file CVectorDynamic.h.

◆ value_type

template<class T>
using mrpt::math::CVectorDynamic< T >::value_type = T

The type of the matrix elements.

Definition at line 44 of file CVectorDynamic.h.

◆ vec_t

template<class T>
using mrpt::math::CVectorDynamic< T >::vec_t = mrpt::containers::vector_with_small_size_optimization< T, small_size, MRPT_MAX_STATIC_ALIGN_BYTES>
protected

Definition at line 36 of file CVectorDynamic.h.

Constructor & Destructor Documentation

◆ CVectorDynamic() [1/6]

template<class T>
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( )
default

◆ CVectorDynamic() [2/6]

template<class T>
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( size_t  N,
bool  initZero = true 
)
inline

Initializes to a vector of "N" zeros.

Definition at line 92 of file CVectorDynamic.h.

◆ CVectorDynamic() [3/6]

template<class T>
template<typename U >
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( const CVectorDynamic< U > &  m)
inlineexplicit

Copy (casting from if needed) from another matrix.

Definition at line 96 of file CVectorDynamic.h.

◆ CVectorDynamic() [4/6]

template<class T>
template<std::size_t ROWS>
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( const CMatrixFixed< T, ROWS, 1 > &  v)
inlineexplicit

Ctor from a fixed-size vector.

Definition at line 103 of file CVectorDynamic.h.

◆ CVectorDynamic() [5/6]

template<class T>
template<typename ARRAY , typename = std::enable_if_t<std::is_array_v<ARRAY>>>
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( const ARRAY &  data)
inline

Constructor from a given size and a C array.

The array length must match cols x row.

const double numbers[] = {
1,2,3,
4,5,6 };
CMatrixDouble M(3,2, numbers);

Definition at line 119 of file CVectorDynamic.h.

◆ CVectorDynamic() [6/6]

template<class T>
template<class Derived >
mrpt::math::CVectorDynamic< T >::CVectorDynamic ( const Eigen::MatrixBase< Derived > &  m)
inlineexplicit

Convert from Eigen matrix.

Definition at line 129 of file CVectorDynamic.h.

Member Function Documentation

◆ array() [1/2]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::array ( )
inlineinherited

Definition at line 170 of file MatrixVectorBase.h.

◆ array() [2/2]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::array ( ) const
inlineinherited

Definition at line 175 of file MatrixVectorBase.h.

◆ asEigen() [1/2]

template<class T>
template<typename EIGEN_VECTOR = eigen_t, typename EIGEN_MAP = Eigen::Map< EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
EIGEN_MAP mrpt::math::CVectorDynamic< T >::asEigen ( )
inline

◆ asEigen() [2/2]

template<class T>
template<typename EIGEN_VECTOR = Eigen::Matrix<T, -1, 1, 0, -1, 1>, typename EIGEN_MAP = Eigen::Map< const EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
EIGEN_MAP mrpt::math::CVectorDynamic< T >::asEigen ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 293 of file CVectorDynamic.h.

◆ assign()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::assign ( const std::size_t  N,
const T  value 
)
inlineinherited

Definition at line 106 of file MatrixVectorBase.h.

◆ asString()

std::string mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::asString ( ) const
inherited

Returns a string representation of the vector/matrix, using Eigen's default settings.

Definition at line 337 of file MatrixVectorBase_impl.h.

◆ begin() [1/2]

template<class T>
iterator mrpt::math::CVectorDynamic< T >::begin ( )
inline

Definition at line 61 of file CVectorDynamic.h.

Referenced by mrpt::math::averageLogLikelihood(), mrpt::slam::CRangeBearingKFSLAM2D::getCurrentState(), mrpt::slam::CRangeBearingKFSLAM::getCurrentState(), mrpt::gui::CDisplayWindow::plot(), mrpt::nav::CLogFileRecord::serializeFrom(), and mrpt::nav::CLogFileRecord::serializeTo().

Here is the caller graph for this function:

◆ begin() [2/2]

template<class T>
const_iterator mrpt::math::CVectorDynamic< T >::begin ( ) const
inline

Definition at line 63 of file CVectorDynamic.h.

◆ block() [1/3]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::block ( int  start_row,
int  start_col 
)
inlineinherited

non-const block(): Returns an Eigen::Block reference to the block

Definition at line 138 of file MatrixVectorBase.h.

◆ block() [2/3]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::block ( int  start_row,
int  start_col,
int  BLOCK_ROWS,
int  BLOCK_COLS 
)
inlineinherited

Definition at line 145 of file MatrixVectorBase.h.

◆ block() [3/3]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::block ( int  start_row,
int  start_col,
int  BLOCK_ROWS,
int  BLOCK_COLS 
) const
inlineinherited

Definition at line 151 of file MatrixVectorBase.h.

◆ cast()

template<typename T >
template<typename T2 >
CVectorDynamic< T2 > CVectorDynamic::cast ( ) const

Definition at line 19 of file CVectorDynamic.cpp.

◆ cbegin()

template<class T>
const_iterator mrpt::math::CVectorDynamic< T >::cbegin ( ) const
inline

Definition at line 65 of file CVectorDynamic.h.

◆ cend()

template<class T>
const_iterator mrpt::math::CVectorDynamic< T >::cend ( ) const
inline

Definition at line 66 of file CVectorDynamic.h.

◆ coeff()

const T & mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::coeff ( int  r,
int  c 
) const
inlineinherited

Definition at line 244 of file MatrixVectorBase.h.

◆ coeffRef()

T & mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::coeffRef ( int  r,
int  c 
)
inlineinherited

Definition at line 243 of file MatrixVectorBase.h.

◆ cols()

template<class T>
size_type mrpt::math::CVectorDynamic< T >::cols ( ) const
inline

Number of columns in the matrix (always 1)

Definition at line 138 of file CVectorDynamic.h.

Referenced by TEST().

Here is the caller graph for this function:

◆ Constant() [1/2]

static CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::Constant ( const T  value)
inlinestaticinherited

Definition at line 89 of file MatrixVectorBase.h.

◆ Constant() [2/2]

static CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::Constant ( size_t  nrows,
size_t  ncols,
const T  value 
)
inlinestaticinherited

Definition at line 99 of file MatrixVectorBase.h.

◆ dot() [1/2]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::dot ( const CVectorDynamic< T > &  v) const
inherited

dot product of this \cdot v

Definition at line 511 of file MatrixVectorBase_impl.h.

Referenced by mrpt::math::mahalanobisDistance2().

◆ dot() [2/2]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::dot ( const MatrixVectorBase< T , CVectorDynamic< T > > &  v) const
inherited

Definition at line 524 of file MatrixVectorBase_impl.h.

◆ empty()

template<class T>
bool mrpt::math::CVectorDynamic< T >::empty ( ) const
inline

Definition at line 143 of file CVectorDynamic.h.

Referenced by mrpt::math::averageWrap2Pi(), mrpt::apps::MonteCarloLocalization_Base::do_pf_localization(), and mrpt::math::ransac_detect_2D_lines().

Here is the caller graph for this function:

◆ end() [1/2]

template<class T>
iterator mrpt::math::CVectorDynamic< T >::end ( )
inline

Definition at line 62 of file CVectorDynamic.h.

Referenced by mrpt::math::averageLogLikelihood(), mrpt::slam::CRangeBearingKFSLAM2D::getCurrentState(), mrpt::slam::CRangeBearingKFSLAM::getCurrentState(), and mrpt::gui::CDisplayWindow::plot().

Here is the caller graph for this function:

◆ end() [2/2]

template<class T>
const_iterator mrpt::math::CVectorDynamic< T >::end ( ) const
inline

Definition at line 64 of file CVectorDynamic.h.

◆ fill()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::fill ( const T &  val)
inlineinherited

Fill all the elements with a given value (Note: named "fillAll" since "fill" will be used by child classes)

Definition at line 70 of file MatrixVectorBase.h.

◆ fromMatlabStringFormat()

bool mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::fromMatlabStringFormat ( const std::string &  s,
mrpt::optional_ref< std::ostream >  dump_errors_here = std::nullopt 
)
inherited

Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must start with '[' and end with ']'.

Rows are separated by semicolons ';' and columns in each row by one or more whitespaces ' ' or tabs ''. Commas ',' between elements are NOT allowed.

This format is also used for CConfigFile::read_matrix.

Returns
true on success. false if the string is malformed, and then the matrix will be resized to 0x0.
See also
inMatlabFormat, CConfigFile::read_matrix

Definition at line 24 of file MatrixVectorBase_impl.h.

◆ fromVectorLike()

template<class T>
template<class MAT >
void mrpt::math::CVectorDynamic< T >::fromVectorLike ( const MAT &  m)
inline

Definition at line 157 of file CVectorDynamic.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::operator=().

Here is the caller graph for this function:

◆ head()

CMatrixFixed<T , N, 1> mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::head ( ) const
inlineinherited

Definition at line 232 of file MatrixVectorBase.h.

◆ inMatlabFormat()

std::string mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::inMatlabFormat ( const std::size_t  decimal_digits = 6) const
inherited

Exports the matrix as a string compatible with Matlab/Octave.

See also
fromMatlabStringFormat()

Definition at line 141 of file MatrixVectorBase_impl.h.

◆ isSquare()

bool mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::isSquare ( ) const
inlineinherited

returns true if matrix is NxN

Definition at line 257 of file MatrixVectorBase.h.

◆ loadFromTextFile() [1/2]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::loadFromTextFile ( std::istream &  f)
inherited

Loads a vector/matrix from a text file, compatible with MATLAB text format.

Lines starting with '' or '#' are interpreted as comments and ignored.

Exceptions
std::runtime_errorOn format error.
See also
saveToTextFile, fromMatlabStringFormat

Definition at line 238 of file MatrixVectorBase_impl.h.

◆ loadFromTextFile() [2/2]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::loadFromTextFile ( const std::string &  file)
inherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 326 of file MatrixVectorBase_impl.h.

◆ matProductOf_Ab()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::matProductOf_Ab ( const CMatrixDynamic< T > &  A,
const CVectorDynamic< T > &  b 
)
inherited

this = A * b , with A and b a dynamic matrix & vector

Definition at line 485 of file MatrixVectorBase_impl.h.

◆ matProductOf_Atb()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::matProductOf_Atb ( const CMatrixDynamic< T > &  A,
const CVectorDynamic< T > &  b 
)
inherited

this = AT * b , with A and b a dynamic matrix & vector

Definition at line 492 of file MatrixVectorBase_impl.h.

◆ maxCoeff() [1/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::maxCoeff ( ) const
inherited

Maximum value in the matrix/vector.

Definition at line 363 of file MatrixVectorBase_impl.h.

◆ maxCoeff() [2/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::maxCoeff ( std::size_t &  outIndexOfMax) const
inherited

Definition at line 384 of file MatrixVectorBase_impl.h.

◆ maxCoeff() [3/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::maxCoeff ( std::size_t &  rowIdx,
std::size_t &  colIdx 
) const
inherited

Definition at line 409 of file MatrixVectorBase_impl.h.

◆ minCoeff() [1/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::minCoeff ( ) const
inherited

Minimum value in the matrix/vector.

Definition at line 357 of file MatrixVectorBase_impl.h.

◆ minCoeff() [2/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::minCoeff ( std::size_t &  outIndexOfMin) const
inherited

Definition at line 369 of file MatrixVectorBase_impl.h.

◆ minCoeff() [3/3]

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::minCoeff ( std::size_t &  rowIdx,
std::size_t &  colIdx 
) const
inherited

Definition at line 398 of file MatrixVectorBase_impl.h.

◆ mvbDerived() [1/2]

CVectorDynamic< T > & mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::mvbDerived ( )
inlineinherited

◆ mvbDerived() [2/2]

const CVectorDynamic< T > & mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::mvbDerived ( ) const
inlineinherited

Definition at line 60 of file MatrixVectorBase.h.

◆ norm()

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::norm ( ) const
inherited

Compute the L2 norm of a vector/array/matrix (the Euclidean distance to the origin, taking all the elements as a single vector).

See also
norm

Definition at line 505 of file MatrixVectorBase_impl.h.

◆ norm_inf()

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::norm_inf ( ) const
inherited

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

Definition at line 499 of file MatrixVectorBase_impl.h.

◆ operator!=()

bool mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator!= ( const OTHERMATVEC &  o) const
inlineinherited

Definition at line 432 of file MatrixVectorBase.h.

◆ operator()() [1/2]

template<class T>
T& mrpt::math::CVectorDynamic< T >::operator() ( size_t  row,
size_t  col 
)
inline

Subscript operator to get/set individual elements.

Definition at line 224 of file CVectorDynamic.h.

◆ operator()() [2/2]

template<class T>
const T& mrpt::math::CVectorDynamic< T >::operator() ( size_t  row,
size_t  col 
) const
inline

Subscript operator to get individual elements.

Definition at line 240 of file CVectorDynamic.h.

◆ operator*() [1/4]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator* ( const MatrixVectorBase< S2, D2 > &  m2) const
inlineinherited

Definition at line 214 of file MatrixVectorBase.h.

◆ operator*() [2/4]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator* ( const T  s) const
inlineinherited

Definition at line 219 of file MatrixVectorBase.h.

◆ operator*() [3/4]

CMatrixDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator* ( const CMatrixDynamic< T > &  v)
inherited

Definition at line 438 of file MatrixVectorBase_impl.h.

◆ operator*() [4/4]

CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator* ( const CVectorDynamic< T > &  m2) const
inherited

Definition at line 470 of file MatrixVectorBase_impl.h.

◆ operator*=()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator*= ( s)
inherited

Definition at line 432 of file MatrixVectorBase_impl.h.

◆ operator+() [1/2]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator+ ( const MatrixVectorBase< S2, D2 > &  m2) const
inlineinherited

Definition at line 188 of file MatrixVectorBase.h.

◆ operator+() [2/2]

CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator+ ( const CVectorDynamic< T > &  m2) const
inlineinherited

Definition at line 279 of file MatrixVectorBase.h.

◆ operator+=() [1/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator+= ( const MatrixVectorBase< S2, D2 > &  m2)
inlineinherited

Definition at line 194 of file MatrixVectorBase.h.

◆ operator+=() [2/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator+= ( s)
inherited

Definition at line 420 of file MatrixVectorBase_impl.h.

◆ operator+=() [3/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator+= ( const CVectorDynamic< T > &  m2)
inlineinherited

Definition at line 294 of file MatrixVectorBase.h.

◆ operator-() [1/3]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator- ( ) const
inlineinherited

Definition at line 181 of file MatrixVectorBase.h.

◆ operator-() [2/3]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator- ( const MatrixVectorBase< S2, D2 > &  m2) const
inlineinherited

Definition at line 201 of file MatrixVectorBase.h.

◆ operator-() [3/3]

CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator- ( const CVectorDynamic< T > &  m2) const
inlineinherited

Definition at line 309 of file MatrixVectorBase.h.

◆ operator-=() [1/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator-= ( const MatrixVectorBase< S2, D2 > &  m2)
inlineinherited

Definition at line 207 of file MatrixVectorBase.h.

◆ operator-=() [2/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator-= ( s)
inherited

Definition at line 426 of file MatrixVectorBase_impl.h.

◆ operator-=() [3/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator-= ( const CVectorDynamic< T > &  m2)
inlineinherited

Definition at line 324 of file MatrixVectorBase.h.

◆ operator=() [1/3]

template<class T>
template<typename U >
CVectorDynamic& mrpt::math::CVectorDynamic< T >::operator= ( const CMatrixDynamic< U > &  m)
inline

Assignment operator from another matrix (possibly of a different type)

Definition at line 169 of file CVectorDynamic.h.

◆ operator=() [2/3]

template<class T>
template<class Derived >
CVectorDynamic& mrpt::math::CVectorDynamic< T >::operator= ( const Eigen::MatrixBase< Derived > &  m)
inline

Assignment from an Eigen matrix.

Definition at line 179 of file CVectorDynamic.h.

◆ operator=() [3/3]

template<class T>
template<std::size_t ROWS>
CVectorDynamic& mrpt::math::CVectorDynamic< T >::operator= ( const CMatrixFixed< T, ROWS, 1 > &  v)
inline

Assignment from a fixed-size vector.

Definition at line 189 of file CVectorDynamic.h.

◆ operator==()

bool mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::operator== ( const OTHERMATVEC &  o) const
inlineinherited

Definition at line 422 of file MatrixVectorBase.h.

◆ operator[]() [1/2]

template<class T>
T& mrpt::math::CVectorDynamic< T >::operator[] ( size_t  ith)
inline

Subscript operator to get/set an individual element from a row or column matrix.

Exceptions
std::exceptionIf the object is not a column or row matrix.

Definition at line 258 of file CVectorDynamic.h.

◆ operator[]() [2/2]

template<class T>
const T& mrpt::math::CVectorDynamic< T >::operator[] ( size_t  ith) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 269 of file CVectorDynamic.h.

◆ push_back()

template<class T>
void mrpt::math::CVectorDynamic< T >::push_back ( const T &  val)
inline

Definition at line 197 of file CVectorDynamic.h.

Referenced by mrpt::obs::detail::cost_func(), mrpt::apps::MonteCarloLocalization_Base::do_pf_localization(), mrpt::topography::path_from_rtk_gps(), mrpt::apps::CGridMapAlignerApp::run(), and TEST().

Here is the caller graph for this function:

◆ realloc()

template<class T>
void mrpt::math::CVectorDynamic< T >::realloc ( const size_t  new_len,
bool  newElementsToZero = false 
)
inline

Internal use only: It reallocs the memory for the 2D matrix, maintaining the previous contents if posible.

Definition at line 72 of file CVectorDynamic.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::CVectorDynamic(), and mrpt::math::CVectorDynamic< KFTYPE >::setSize().

Here is the caller graph for this function:

◆ resize()

template<class T>
void mrpt::math::CVectorDynamic< T >::resize ( std::size_t  N,
bool  zeroNewElements = false 
)
inline

◆ rows()

template<class T>
size_type mrpt::math::CVectorDynamic< T >::rows ( ) const
inline

Number of rows in the vector.

Definition at line 135 of file CVectorDynamic.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::fromVectorLike(), and TEST().

Here is the caller graph for this function:

◆ saveToTextFile()

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::saveToTextFile ( const std::string &  file,
mrpt::math::TMatrixTextFileFormat  fileFormat = mrpt::math::MATRIX_FORMAT_ENG,
bool  appendMRPTHeader = false,
const std::string &  userHeader = std::string() 
) const
inherited

Saves the vector/matrix to a file compatible with MATLAB/Octave text format.

Parameters
fileThe target filename.
fileFormatSee TMatrixTextFileFormat. The format of the numbers in the text file.
appendMRPTHeaderInsert this header to the file "% File generated by MRPT. Load with MATLAB with: VAR=load(FILENAME);"
userHeaderAdditional text to be written at the head of the file. Typically MALAB comments "% This file blah blah". Final end-of-line is not needed.
See also
loadFromTextFile, CMatrixDynamic::inMatlabFormat, SAVE_MATRIX

Definition at line 159 of file MatrixVectorBase_impl.h.

◆ segmentCopy() [1/2]

template<class T>
template<int LEN>
CMatrixFixed<Scalar, LEN, 1> mrpt::math::CVectorDynamic< T >::segmentCopy ( int  start = 0) const
inline

const segmentCopy(): Returns a copy of the given vector segment

Definition at line 205 of file CVectorDynamic.h.

◆ segmentCopy() [2/2]

template<class T>
CVectorDynamic<Scalar> mrpt::math::CVectorDynamic< T >::segmentCopy ( int  start,
int  LEN 
) const
inline

const segmentCopy(): Returns a copy of the given vector segment (non templated version, dynamic length)

Definition at line 214 of file CVectorDynamic.h.

◆ setConstant() [1/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setConstant ( const T  value)
inlineinherited

Definition at line 75 of file MatrixVectorBase.h.

◆ setConstant() [2/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setConstant ( size_t  nrows,
size_t  ncols,
const T  value 
)
inlineinherited

Definition at line 76 of file MatrixVectorBase.h.

◆ setConstant() [3/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setConstant ( size_t  nrows,
const T  value 
)
inlineinherited

Definition at line 81 of file MatrixVectorBase.h.

◆ setSize()

template<class T>
void mrpt::math::CVectorDynamic< T >::setSize ( size_t  row,
size_t  col,
bool  zeroNewElements = false 
)
inline

Changes the size of matrix, maintaining the previous contents.

Definition at line 146 of file CVectorDynamic.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::fromVectorLike(), and mrpt::math::CVectorDynamic< KFTYPE >::resize().

Here is the caller graph for this function:

◆ setZero() [1/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setZero ( )
inlineinherited

Definition at line 112 of file MatrixVectorBase.h.

◆ setZero() [2/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setZero ( size_t  nrows,
size_t  ncols 
)
inlineinherited

Definition at line 113 of file MatrixVectorBase.h.

◆ setZero() [3/3]

void mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::setZero ( size_t  nrows)
inlineinherited

Definition at line 117 of file MatrixVectorBase.h.

◆ size()

template<class T>
size_type mrpt::math::CVectorDynamic< T >::size ( ) const
inline

Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x))

Definition at line 141 of file CVectorDynamic.h.

Referenced by mrpt::bayes::detail::addNewLandmarks(), mrpt::math::averageLogLikelihood(), mrpt::math::averageWrap2Pi(), mrpt::math::CSparseMatrix::CholeskyDecomp::backsub(), mrpt::obs::detail::cam2vec(), mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::computeDominantEigenVector(), mrpt::poses::CPointPDFSOG::drawSingleSample(), mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::evalPWConsistenciesMatrix(), mrpt::obs::CObservation2DRangeScanWithUncertainty::evaluateScanLikelihood(), mrpt::math::fft_real(), mrpt::slam::CRangeBearingKFSLAM2D::getAs3DObject(), mrpt::slam::CRangeBearingKFSLAM2D::getCurrentRobotPose(), mrpt::slam::CRangeBearingKFSLAM::getCurrentRobotPose(), mrpt::slam::CRangeBearingKFSLAM::getCurrentRobotPoseMean(), mrpt::slam::CRangeBearingKFSLAM2D::getCurrentState(), mrpt::slam::CRangeBearingKFSLAM::getCurrentState(), mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::getStateVectorLength(), mrpt::img::TCamera::loadFromConfigFile(), mrpt::slam::CRangeBearingKFSLAM2D::TOptions::loadFromConfigFile(), mrpt::slam::CRangeBearingKFSLAM::TOptions::loadFromConfigFile(), mrpt::nav::CReactiveNavigationSystem3D::loggingGetWSObstaclesAndShape(), mrpt::math::CSparseMatrix::matProductOf_Ab(), mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests(), mrpt::slam::CRangeBearingKFSLAM2D::OnTransitionModel(), mrpt::slam::CRangeBearingKFSLAM::OnTransitionModel(), mrpt::slam::CRangeBearingKFSLAM2D::OnTransitionNoise(), mrpt::slam::CRangeBearingKFSLAM::OnTransitionNoise(), mrpt::math::operator<<(), mrpt::math::operator>>(), mrpt::graphslam::optimize_graph_spa_levmarq(), mrpt::gui::CDisplayWindow::plot(), mrpt::gui::CWindowDialogPlots::plot(), mrpt::gui::CWindowDialogPlots::plotEllipse(), mrpt::math::ransac_detect_2D_lines(), mrpt::obs::CObservation3DRangeScan::recoverCameraCalibrationParameters(), mrpt::slam::CRangeBearingKFSLAM2D::saveMapAndPath2DRepresentationAsMATLABFile(), mrpt::opengl::CSetOfLines::serializeFrom(), mrpt::nav::CLogFileRecord::serializeTo(), mrpt::maps::CRandomFieldGridMap2D::setMeanAndSTD(), mrpt::gui::CDisplayWindow::showImageAndPoints(), TEST(), and mrpt::maps::CRandomFieldGridMap2D::updateMapEstimation_GMRF().

Here is the caller graph for this function:

◆ sum()

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::sum ( ) const
inherited

Sum of all elements in matrix/vector.

Definition at line 345 of file MatrixVectorBase_impl.h.

◆ sum_abs()

T mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::sum_abs ( ) const
inherited

Sum of the absolute value of all elements in matrix/vector.

Definition at line 351 of file MatrixVectorBase_impl.h.

◆ swap()

template<class T>
void mrpt::math::CVectorDynamic< T >::swap ( CVectorDynamic< T > &  o)
inline

Definition at line 87 of file CVectorDynamic.h.

◆ tail()

CMatrixFixed<T , N, 1> mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::tail ( ) const
inlineinherited

Definition at line 226 of file MatrixVectorBase.h.

◆ transpose() [1/2]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::transpose ( )
inlineinherited

Definition at line 159 of file MatrixVectorBase.h.

◆ transpose() [2/2]

auto mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::transpose ( ) const
inlineinherited

Definition at line 164 of file MatrixVectorBase.h.

◆ Zero() [1/2]

static CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::Zero ( )
inlinestaticinherited

Definition at line 125 of file MatrixVectorBase.h.

Referenced by mrpt::vision::build_linear_system().

◆ Zero() [2/2]

static CVectorDynamic< T > mrpt::math::MatrixVectorBase< T , CVectorDynamic< T > >::Zero ( size_t  nrows,
size_t  ncols 
)
inlinestaticinherited

Definition at line 126 of file MatrixVectorBase.h.

Member Data Documentation

◆ ColsAtCompileTime

template<class T>
constexpr int mrpt::math::CVectorDynamic< T >::ColsAtCompileTime = 1
static

Definition at line 52 of file CVectorDynamic.h.

◆ is_mrpt_type

template<class T>
constexpr int mrpt::math::CVectorDynamic< T >::is_mrpt_type = 1
static

Definition at line 53 of file CVectorDynamic.h.

◆ m_data

template<class T>
vec_t mrpt::math::CVectorDynamic< T >::m_data
protected

◆ RowsAtCompileTime

template<class T>
constexpr int mrpt::math::CVectorDynamic< T >::RowsAtCompileTime = -1
static

Definition at line 51 of file CVectorDynamic.h.

◆ small_size

template<class T>
constexpr size_t mrpt::math::CVectorDynamic< T >::small_size = 16
staticprotected

Definition at line 34 of file CVectorDynamic.h.




Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020