Main MRPT website > C++ reference for MRPT 1.3.2
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
mrpt::math::CMatrixBool Class Reference

Detailed Description

Declares a matrix of booleans (non serializable).

See also
CMatrixDouble, CMatrixFloat, CMatrixB

Definition at line 557 of file CMatrixTemplate.h.

#include <mrpt/math/CMatrixTemplate.h>

Inheritance diagram for mrpt::math::CMatrixBool:
Inheritance graph

Public Types

typedef bool value_type
 The type of the matrix elements. More...
 
typedef bool & reference
 
typedef const bool & const_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

 CMatrixBool (size_t row=1, size_t col=1)
 Constructor. More...
 
 CMatrixBool (const CMatrixTemplate< bool > &m)
 Copy constructor. More...
 
CMatrixBooloperator= (const CMatrixTemplate< bool > &m)
 Assignment operator for float matrixes. More...
 
void ASSERT_ENOUGHROOM (size_t r, size_t c) const
 Checks whether the rows [r-N,r+N] and the columns [c-N,c+N] are present in the matrix. More...
 
void fillAll (const bool &val)
 
void swap (CMatrixTemplate< bool > &o)
 Swap with another matrix very efficiently (just swaps a pointer and two integer values). More...
 
size_t getRowCount () const
 Number of rows in the matrix. More...
 
size_t getColCount () const
 Number of columns in the matrix. More...
 
CMatrixTemplateSize size () const
 Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x)) More...
 
void setSize (size_t row, size_t col, bool zeroNewElements=false)
 Changes the size of matrix, maintaining the previous contents. More...
 
void resize (const CMatrixTemplateSize &siz, bool zeroNewElements=false)
 This method just checks has no effects in this class, but raises an exception if the expected size does not match. More...
 
bool & operator() (size_t row, size_t col)
 Subscript operator to get/set individual elements. More...
 
const bool & operator() (size_t row, size_t col) const
 Subscript operator to get individual elements. More...
 
bool & operator() (size_t ith)
 Subscript operator to get/set an individual element from a row or column matrix. More...
 
bool operator() (size_t ith) const
 Subscript operator to get/set an individual element from a row or column matrix. More...
 
CMatrixTemplate< bool > operator() (const size_t row1, const size_t row2, const size_t col1, const size_t col2) const
 Subscript operator to get a submatrix. More...
 
void set_unsafe (size_t row, size_t col, const bool &v)
 Fast but unsafe method to write a value in the matrix. More...
 
const bool & get_unsafe (size_t row, size_t col) const
 Fast but unsafe method to read a value from the matrix. More...
 
bool & get_unsafe (size_t row, size_t col)
 Fast but unsafe method to get a reference from the matrix. More...
 
bool * get_unsafe_row (size_t row)
 Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in time critical applications) More...
 
const bool * get_unsafe_row (size_t row) const
 Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in critical applications) More...
 
void extractSubmatrix (const size_t row1, const size_t row2, const size_t col1, const size_t col2, CMatrixTemplate< bool > &out) const
 Get a submatrix, given its bounds. More...
 
void extractSubmatrix (const size_t row1, const size_t row2, const size_t col1, const size_t col2, EIGEN_MATRIX &out) const
 
void extractRows (size_t firstRow, size_t lastRow, CMatrixTemplate< bool > &out) const
 Gets a series of contiguous rows. More...
 
void extractColumns (size_t firstCol, size_t lastCol, CMatrixTemplate< bool > &out) const
 Gets a series of contiguous columns. More...
 
void extractCol (size_t nCol, std::vector< bool > &out, int startingRow=0) const
 Returns a given column to a vector (without modifying the matrix)

Exceptions
std::exceptionOn index out of bounds.
More...
 
void extractCol (size_t nCol, CMatrixTemplate< bool > &out, int startingRow=0) const
 Gets a given column to a vector (without modifying the matrix)

Exceptions
std::exceptionOn index out of bounds.
More...
 
void appendRow (const std::vector< bool > &in)
 Appends a new row to the MxN matrix from a 1xN vector. More...
 
void appendCol (const std::vector< bool > &in)
 Appends a new column to the matrix from a vector. More...
 
void insertCol (size_t nCol, const std::vector< bool > &in)
 Inserts a column from a vector, replacing the current contents of that column. More...
 
void getAsVector (std::vector< bool > &out) const
 Returns a vector containing the matrix's values. More...
 

Protected Member Functions

void realloc (size_t row, size_t col, bool newElementsToZero=false)
 Internal use only: It reallocs the memory for the 2D matrix, maintaining the previous contents if posible. More...
 

Protected Attributes

bool ** m_Val
 
size_t m_Rows
 
size_t m_Cols
 

Member Typedef Documentation

typedef const bool & mrpt::math::CMatrixTemplate< bool >::const_reference
inherited

Definition at line 45 of file CMatrixTemplate.h.

typedef std::ptrdiff_t mrpt::math::CMatrixTemplate< bool >::difference_type
inherited

Definition at line 47 of file CMatrixTemplate.h.

typedef bool & mrpt::math::CMatrixTemplate< bool >::reference
inherited

Definition at line 44 of file CMatrixTemplate.h.

typedef std::size_t mrpt::math::CMatrixTemplate< bool >::size_type
inherited

Definition at line 46 of file CMatrixTemplate.h.

typedef bool mrpt::math::CMatrixTemplate< bool >::value_type
inherited

The type of the matrix elements.

Definition at line 43 of file CMatrixTemplate.h.

Constructor & Destructor Documentation

mrpt::math::CMatrixBool::CMatrixBool ( size_t  row = 1,
size_t  col = 1 
)

Constructor.

mrpt::math::CMatrixBool::CMatrixBool ( const CMatrixTemplate< bool > &  m)

Copy constructor.

Member Function Documentation

void mrpt::math::CMatrixTemplate< bool >::appendCol ( const std::vector< bool > &  in)
inlineinherited

Appends a new column to the matrix from a vector.

The length of the vector must match the number of rows of the matrix, unless it is (0,0).

Exceptions
std::exceptionOn size mismatch.
See also
extractCol
appendRow

Definition at line 517 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::appendRow ( const std::vector< bool > &  in)
inlineinherited

Appends a new row to the MxN matrix from a 1xN vector.

The lenght of the vector must match the width of the matrix, unless it's empty: in that case the matrix is resized to 1xN.

CVectorDouble v(7),w(7);
// ...
M.appendRow(v);
M.appendRow(w);
Exceptions
std::exceptionOn incorrect vector length.
See also
extractRow
appendCol

Definition at line 488 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::ASSERT_ENOUGHROOM ( size_t  r,
size_t  c 
) const
inlineinherited

Checks whether the rows [r-N,r+N] and the columns [c-N,c+N] are present in the matrix.

Definition at line 106 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractCol ( size_t  nCol,
std::vector< bool > &  out,
int  startingRow = 0 
) const
inlineinherited

Returns a given column to a vector (without modifying the matrix)

Exceptions
std::exceptionOn index out of bounds.

Definition at line 442 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractCol ( size_t  nCol,
CMatrixTemplate< bool > &  out,
int  startingRow = 0 
) const
inlineinherited

Gets a given column to a vector (without modifying the matrix)

Exceptions
std::exceptionOn index out of bounds.

Definition at line 460 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractColumns ( size_t  firstCol,
size_t  lastCol,
CMatrixTemplate< bool > &  out 
) const
inlineinherited

Gets a series of contiguous columns.

Exceptions
std::logic_errorOn index out of bounds
See also
extractColumn
extractRows

Definition at line 434 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractRows ( size_t  firstRow,
size_t  lastRow,
CMatrixTemplate< bool > &  out 
) const
inlineinherited

Gets a series of contiguous rows.

Exceptions
std::logic_errorOn index out of bounds
See also
extractRow
extractColumns

Definition at line 424 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractSubmatrix ( const size_t  row1,
const size_t  row2,
const size_t  col1,
const size_t  col2,
CMatrixTemplate< bool > &  out 
) const
inlineinherited

Get a submatrix, given its bounds.

See also
extractSubmatrixSymmetricalBlocks

Definition at line 391 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::extractSubmatrix ( const size_t  row1,
const size_t  row2,
const size_t  col1,
const size_t  col2,
EIGEN_MATRIX &  out 
) const
inlineinherited

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 405 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::fillAll ( const bool &  val)
inlineinherited

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

Definition at line 112 of file CMatrixTemplate.h.

const bool & mrpt::math::CMatrixTemplate< bool >::get_unsafe ( size_t  row,
size_t  col 
) const
inlineinherited

Fast but unsafe method to read a value from the matrix.

Definition at line 343 of file CMatrixTemplate.h.

bool & mrpt::math::CMatrixTemplate< bool >::get_unsafe ( size_t  row,
size_t  col 
)
inlineinherited

Fast but unsafe method to get a reference from the matrix.

Definition at line 354 of file CMatrixTemplate.h.

bool * mrpt::math::CMatrixTemplate< bool >::get_unsafe_row ( size_t  row)
inlineinherited

Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in time critical applications)

Definition at line 365 of file CMatrixTemplate.h.

const bool * mrpt::math::CMatrixTemplate< bool >::get_unsafe_row ( size_t  row) const
inlineinherited

Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in critical applications)

Definition at line 376 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::getAsVector ( std::vector< bool > &  out) const
inlineinherited

Returns a vector containing the matrix's values.

Definition at line 545 of file CMatrixTemplate.h.

size_t mrpt::math::CMatrixTemplate< bool >::getColCount ( ) const
inlineinherited

Number of columns in the matrix.

See also
getRowCount, getColCount, nr, nc

Definition at line 229 of file CMatrixTemplate.h.

size_t mrpt::math::CMatrixTemplate< bool >::getRowCount ( ) const
inlineinherited

Number of rows in the matrix.

See also
getRowCount, getColCount, nr, nc

Definition at line 224 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::insertCol ( size_t  nCol,
const std::vector< bool > &  in 
)
inlineinherited

Inserts a column from a vector, replacing the current contents of that column.

Exceptions
std::exceptionOn index out of bounds
See also
extractCol

Definition at line 532 of file CMatrixTemplate.h.

bool & mrpt::math::CMatrixTemplate< bool >::operator() ( size_t  row,
size_t  col 
)
inlineinherited

Subscript operator to get/set individual elements.

Definition at line 254 of file CMatrixTemplate.h.

const bool & mrpt::math::CMatrixTemplate< bool >::operator() ( size_t  row,
size_t  col 
) const
inlineinherited

Subscript operator to get individual elements.

Definition at line 265 of file CMatrixTemplate.h.

bool & mrpt::math::CMatrixTemplate< bool >::operator() ( size_t  ith)
inlineinherited

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 277 of file CMatrixTemplate.h.

bool mrpt::math::CMatrixTemplate< bool >::operator() ( size_t  ith) const
inlineinherited

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 305 of file CMatrixTemplate.h.

CMatrixTemplate<bool > mrpt::math::CMatrixTemplate< bool >::operator() ( const size_t  row1,
const size_t  row2,
const size_t  col1,
const size_t  col2 
) const
inlineinherited

Subscript operator to get a submatrix.

Definition at line 382 of file CMatrixTemplate.h.

CMatrixBool& mrpt::math::CMatrixBool::operator= ( const CMatrixTemplate< bool > &  m)

Assignment operator for float matrixes.

Referenced by mrpt::math::CMatrixB::operator=().

void mrpt::math::CMatrixTemplate< bool >::realloc ( size_t  row,
size_t  col,
bool  newElementsToZero = false 
)
inlineprotectedinherited

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

Definition at line 56 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::resize ( const CMatrixTemplateSize siz,
bool  zeroNewElements = false 
)
inlineinherited

This method just checks has no effects in this class, but raises an exception if the expected size does not match.

Definition at line 247 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::set_unsafe ( size_t  row,
size_t  col,
const bool &  v 
)
inlineinherited

Fast but unsafe method to write a value in the matrix.

Definition at line 332 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::setSize ( size_t  row,
size_t  col,
bool  zeroNewElements = false 
)
inlineinherited

Changes the size of matrix, maintaining the previous contents.

Definition at line 241 of file CMatrixTemplate.h.

CMatrixTemplateSize mrpt::math::CMatrixTemplate< bool >::size ( ) const
inlineinherited

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

Definition at line 232 of file CMatrixTemplate.h.

void mrpt::math::CMatrixTemplate< bool >::swap ( CMatrixTemplate< bool > &  o)
inlineinherited

Swap with another matrix very efficiently (just swaps a pointer and two integer values).

Definition at line 119 of file CMatrixTemplate.h.

Member Data Documentation

size_t mrpt::math::CMatrixTemplate< bool >::m_Cols
protectedinherited

Definition at line 52 of file CMatrixTemplate.h.

size_t mrpt::math::CMatrixTemplate< bool >::m_Rows
protectedinherited

Definition at line 52 of file CMatrixTemplate.h.

bool ** mrpt::math::CMatrixTemplate< bool >::m_Val
protectedinherited

Definition at line 51 of file CMatrixTemplate.h.




Page generated by Doxygen 1.8.11 for MRPT 1.3.2 SVN: at Wed May 25 02:34:21 UTC 2016