This class is a "CSerializable" wrapper for "CMatrixBool".
Definition at line 23 of file CMatrixB.h.
#include <mrpt/math/CMatrixB.h>
Public Types | |
using | value_type = bool |
The type of the matrix elements. More... | |
using | reference = bool & |
using | const_reference = const bool & |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
CMatrixB (size_t row=1, size_t col=1) | |
Constructor. More... | |
CMatrixB (const CMatrixBool &m) | |
Copy constructor. More... | |
CMatrixB & | operator= (const CMatrixBool &m) |
Assignment operator for float matrixes. More... | |
virtual mxArray * | writeToMatlab () const |
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. 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 | rows () const |
Number of rows in the matrix. More... | |
size_t | cols () 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 |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
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) More... | |
void | extractCol (size_t nCol, CMatrixTemplate< bool > &out, int startingRow=0) const |
Gets a given column to a vector (without modifying the matrix) 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... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
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... | |
CSerializable virtual methods | |
uint8_t | serializeGetVersion () const override |
Must return the current versioning number of the object. More... | |
void | serializeTo (mrpt::serialization::CArchive &out) const override |
Pure virtual method for writing (serializing) to an abstract archive. More... | |
void | serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override |
Pure virtual method for reading (deserializing) from an abstract archive. More... | |
Protected Attributes | |
bool ** | m_Val |
size_t | m_Rows |
size_t | m_Cols |
RTTI stuff | |
using | Ptr = std::shared_ptr< CMatrixB > |
using | ConstPtr = std::shared_ptr< const CMatrixB > |
using | UniquePtr = std::unique_ptr< CMatrixB > |
using | ConstUniquePtr = std::unique_ptr< const CMatrixB > |
static mrpt::rtti::CLASSINIT | _init_CMatrixB |
static const mrpt::rtti::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "CMatrixB" |
static const mrpt::rtti::TRuntimeClassId * | _GetBaseClass () |
static constexpr auto | getClassName () |
static const mrpt::rtti::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::rtti::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
template<typename... Args> | |
static UniquePtr | CreateUnique (Args &&... args) |
virtual const mrpt::rtti::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::rtti::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
|
inherited |
Definition at line 79 of file CMatrixTemplate.h.
using mrpt::math::CMatrixB::ConstPtr = std::shared_ptr<const CMatrixB > |
Definition at line 25 of file CMatrixB.h.
using mrpt::math::CMatrixB::ConstUniquePtr = std::unique_ptr<const CMatrixB > |
Definition at line 25 of file CMatrixB.h.
|
inherited |
Definition at line 81 of file CMatrixTemplate.h.
using mrpt::math::CMatrixB::Ptr = std::shared_ptr< CMatrixB > |
A type for the associated smart pointer
Definition at line 25 of file CMatrixB.h.
|
inherited |
Definition at line 78 of file CMatrixTemplate.h.
|
inherited |
Definition at line 80 of file CMatrixTemplate.h.
using mrpt::math::CMatrixB::UniquePtr = std::unique_ptr< CMatrixB > |
Definition at line 25 of file CMatrixB.h.
|
inherited |
The type of the matrix elements.
Definition at line 77 of file CMatrixTemplate.h.
|
inline |
Constructor.
Definition at line 28 of file CMatrixB.h.
|
inline |
Copy constructor.
Definition at line 30 of file CMatrixB.h.
|
staticprotected |
|
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).
std::exception | On size mismatch. |
Definition at line 649 of file CMatrixTemplate.h.
|
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.
std::exception | On incorrect vector length. |
Definition at line 620 of file CMatrixTemplate.h.
|
inlineinherited |
Checks whether the rows [r-N,r+N] and the columns [c-N,c+N] are present in the matrix.
Definition at line 150 of file CMatrixTemplate.h.
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::rtti::CObject.
|
inlineinherited |
Number of columns in the matrix.
Definition at line 302 of file CMatrixTemplate.h.
|
inlinestatic |
Definition at line 25 of file CMatrixB.h.
|
static |
|
inlinestatic |
Definition at line 25 of file CMatrixB.h.
|
inlineinherited |
Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).
Definition at line 169 of file CObject.h.
References mrpt::rtti::CObject::clone().
Referenced by mrpt::obs::CRawlog::addActions(), and mrpt::obs::CRawlog::addObservations().
|
inlineinherited |
Gets a given column to a vector (without modifying the matrix)
std::exception | On index out of bounds |
Definition at line 591 of file CMatrixTemplate.h.
|
inlineinherited |
Returns a given column to a vector (without modifying the matrix)
std::exception | On index out of bounds |
Definition at line 574 of file CMatrixTemplate.h.
|
inlineinherited |
Gets a series of contiguous columns.
std::logic_error | On index out of bounds |
Definition at line 564 of file CMatrixTemplate.h.
|
inlineinherited |
Gets a series of contiguous rows.
std::logic_error | On index out of bounds |
Definition at line 552 of file CMatrixTemplate.h.
|
inlineinherited |
Get a submatrix, given its bounds.
Definition at line 508 of file CMatrixTemplate.h.
|
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 528 of file CMatrixTemplate.h.
|
inlineinherited |
Fill all the elements with a given value (Note: named "fillAll" since "fill" will be used by child classes)
Definition at line 158 of file CMatrixTemplate.h.
|
inlineinherited |
Fast but unsafe method to get a reference from the matrix.
Definition at line 458 of file CMatrixTemplate.h.
|
inlineinherited |
Fast but unsafe method to read a value from the matrix.
Definition at line 441 of file CMatrixTemplate.h.
|
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 476 of file CMatrixTemplate.h.
|
inlineinherited |
Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in critical applications)
Definition at line 493 of file CMatrixTemplate.h.
|
inlineinherited |
Returns a vector containing the matrix's values.
Definition at line 682 of file CMatrixTemplate.h.
|
inlinestaticconstexpr |
Definition at line 25 of file CMatrixB.h.
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::serialization::CSerializable.
|
static |
|
inlineinherited |
Inserts a column from a vector, replacing the current contents of that column.
std::exception | On index out of bounds |
Definition at line 669 of file CMatrixTemplate.h.
Definition at line 25 of file CMatrixB.h.
Definition at line 25 of file CMatrixB.h.
Definition at line 25 of file CMatrixB.h.
Definition at line 25 of file CMatrixB.h.
|
inline |
Definition at line 25 of file CMatrixB.h.
|
inlinenoexcept |
Definition at line 25 of file CMatrixB.h.
Definition at line 25 of file CMatrixB.h.
|
inline |
Definition at line 25 of file CMatrixB.h.
|
inlineinherited |
Subscript operator to get a submatrix.
Definition at line 496 of file CMatrixTemplate.h.
|
inlineinherited |
Subscript operator to get/set an individual element from a row or column matrix.
std::exception | If the object is not a column or row matrix. |
Definition at line 364 of file CMatrixTemplate.h.
|
inlineinherited |
Subscript operator to get/set an individual element from a row or column matrix.
std::exception | If the object is not a column or row matrix. |
Definition at line 395 of file CMatrixTemplate.h.
|
inlineinherited |
Subscript operator to get/set individual elements.
Definition at line 328 of file CMatrixTemplate.h.
|
inlineinherited |
Subscript operator to get individual elements.
Definition at line 345 of file CMatrixTemplate.h.
|
inline |
Assignment operator for float matrixes.
Definition at line 32 of file CMatrixB.h.
References mrpt::math::CMatrixBool::operator=().
|
inlineprotectedinherited |
Internal use only: It reallocs the memory for the 2D matrix, maintaining the previous contents if posible.
Definition at line 90 of file CMatrixTemplate.h.
|
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 320 of file CMatrixTemplate.h.
|
inlineinherited |
Number of rows in the matrix.
Definition at line 298 of file CMatrixTemplate.h.
|
overrideprotectedvirtual |
Pure virtual method for reading (deserializing) from an abstract archive.
Users don't call this method directly. Instead, use stream >> object;
.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any I/O error |
Implements mrpt::serialization::CSerializable.
Definition at line 34 of file CMatrixB.cpp.
References mrpt::math::CMatrixTemplate< bool >::m_Cols, mrpt::math::CMatrixTemplate< bool >::m_Val, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, mrpt::math::CMatrixTemplate< bool >::setSize(), and THROW_EXCEPTION.
|
overrideprotectedvirtual |
Must return the current versioning number of the object.
Start in zero for new classes, and increments each time there is a change in the stored format.
Implements mrpt::serialization::CSerializable.
Definition at line 21 of file CMatrixB.cpp.
|
overrideprotectedvirtual |
Pure virtual method for writing (serializing) to an abstract archive.
Users don't call this method directly. Instead, use stream << object;
.
std::exception | On any I/O error |
Implements mrpt::serialization::CSerializable.
Definition at line 22 of file CMatrixB.cpp.
References mrpt::math::CMatrixTemplate< bool >::m_Cols, mrpt::math::CMatrixTemplate< bool >::m_Rows, mrpt::math::CMatrixTemplate< bool >::m_Val, and mrpt::serialization::CArchive::WriteBuffer().
|
inlineinherited |
Fast but unsafe method to write a value in the matrix.
Definition at line 424 of file CMatrixTemplate.h.
|
inlineinherited |
Changes the size of matrix, maintaining the previous contents.
Definition at line 313 of file CMatrixTemplate.h.
|
inlineinherited |
Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x))
Definition at line 304 of file CMatrixTemplate.h.
|
inlineinherited |
Swap with another matrix very efficiently (just swaps a pointer and two integer values).
Definition at line 166 of file CMatrixTemplate.h.
|
inlinevirtualinherited |
Introduces a pure virtual method responsible for writing to a mxArray
Matlab object, typically a MATLAB struct
whose contents are documented in each derived class.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 70 of file CSerializable.h.
|
staticprotected |
Definition at line 25 of file CMatrixB.h.
|
staticconstexpr |
Definition at line 25 of file CMatrixB.h.
|
protectedinherited |
Definition at line 85 of file CMatrixTemplate.h.
|
protectedinherited |
Definition at line 85 of file CMatrixTemplate.h.
|
protectedinherited |
Definition at line 84 of file CMatrixTemplate.h.
|
staticprotected |
Definition at line 25 of file CMatrixB.h.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST |