AIToolbox
A library that offers tools for AI problem solving.
|
This class provides an Eigen-compatible automatically resized Matrix2D. More...
#include <AIToolbox/Utils/StorageEigen.hpp>
Public Member Functions | |
StorageMatrix2D (size_t startRows, size_t cols) | |
Basic constructor. More... | |
StorageMatrix2D (Matrix2D matrix) | |
Basic constructor. More... | |
void | pop_back (size_t num=1) |
This function removes rows from the view matrix. More... | |
void | push_back () |
This function inserts a new row in storage, and expands the view accordingly. More... | |
template<typename V > | |
void | push_back (const Eigen::MatrixBase< V > &row) |
This function inserts a new row in storage, and expands the view accordingly. More... | |
void | resize (size_t rows) |
This function resizes the view to the requested rows. More... | |
void | reserve (size_t rows) |
This function reserves row space in the underlying storage. More... | |
Public Attributes | |
Eigen::Ref< Matrix2D > | matrix |
This member provides a view of the pushed data. More... | |
This class provides an Eigen-compatible automatically resized Matrix2D.
The number of columns cannot be modified, only the number of rows.
The interface is deliberately simple for now. This class simply maintains a public reference to the internal storage container.
Pushing and popping modifies the view, while the storage gets increased automatically when needed.
AIToolbox::StorageMatrix2D::StorageMatrix2D | ( | size_t | startRows, |
size_t | cols | ||
) |
Basic constructor.
startRows | The initial pre-reserved rows for storage. |
cols | The fixed number of columns to store. |
AIToolbox::StorageMatrix2D::StorageMatrix2D | ( | Matrix2D | matrix | ) |
Basic constructor.
matrix | The vector with which to initialize storage (and the public view). |
void AIToolbox::StorageMatrix2D::pop_back | ( | size_t | num = 1 | ) |
This function removes rows from the view matrix.
num | The number of rows to remove. |
void AIToolbox::StorageMatrix2D::push_back | ( | ) |
This function inserts a new row in storage, and expands the view accordingly.
The new row is left un-initialized. This function is provided for performance, if the new row must be constructed dynamically.
void AIToolbox::StorageMatrix2D::push_back | ( | const Eigen::MatrixBase< V > & | row | ) |
This function inserts a new row in storage, and expands the view accordingly.
row | The row to copy. |
void AIToolbox::StorageMatrix2D::reserve | ( | size_t | rows | ) |
This function reserves row space in the underlying storage.
This function does not modify the view. We also call Eigen's conservativeResize
so that already stored data is maintained.
rows | The requested new rows. |
void AIToolbox::StorageMatrix2D::resize | ( | size_t | rows | ) |
This function resizes the view to the requested rows.
We first call reserve(size_t) to make sure that the storage is appropriately sized.
rows | The requested new rows. |
Eigen::Ref<Matrix2D> AIToolbox::StorageMatrix2D::matrix |
This member provides a view of the pushed data.