iDynTree::MatrixDynSize class

Class providing a simple form of matrix with dynamic size.

Derived classes

class FrameFreeFloatingJacobian
Jacobian of the 6D frame velocity.
class FreeFloatingMassMatrix
Class representing the mass matrix of a Free Floating robot.
class FreeFloatingStateLinearization
class MomentumFreeFloatingJacobian
Jacobian of the 6D momentum.

Constructors, destructors, conversion operators

MatrixDynSize()
Default constructor: create a 0x0 matrix.
MatrixDynSize(std::size_t _rows, std::size_t _cols)
Constructor from the rows and columns, all the element assigned to 0.
MatrixDynSize(const double* in_data, const std::size_t in_rows, const std::size_t in_cols)
Constructor from a C-style matrix.
MatrixDynSize(const MatrixDynSize& other)
Copy constructor.
MatrixDynSize(iDynTree::MatrixView<const double> other)
Constructor from MatrixView object.
~MatrixDynSize() virtual
Denstructor.

Public functions

auto operator=(const MatrixDynSize& other) -> MatrixDynSize&
Assignment operator.
auto operator=(iDynTree::MatrixView<const double> other) -> MatrixDynSize&
Assignment operator.
auto data() const -> const double*
Raw data accessor.
auto data() -> double*
Raw data accessor.
void zero()
Assign all element of the matrix to 0.
void resize(const std::size_t _newRows, const std::size_t _newCols)
Change the size of the matrix, without preserving old content.
void reserve(const size_t _newCapacity)
Increase the capacity of the matrix, preserving old content.
auto capacity() const -> size_t
Get the dimension (in doubles) of the buffer to which m_data is pointing.
void shrink_to_fit()
Change the capacity of the matrix such that capacity() == rows()*cols(), preserving old content.
void fillRowMajorBuffer(double* rowMajorBuf) const
Assume that rowMajorBuf is pointing to a buffer of rows()*cols() doubles, and fill it with the content of this matrix, using row major order.
void fillColMajorBuffer(double* colMajorBuf) const
Assume that colMajorBuf is pointing to a buffer of rows()*cols() doubles, and fill it with the content of this matrix, using column major order.

Protected variables

double* m_data
Storage for the MatrixDynSize.
std::size_t m_rows
std::size_t m_cols
std::size_t m_capacity
The buffer to which m_data is pointing is m_capacity*sizeof(double).

Matrix interface methods.

Methods exposing a matrix-like interface to MatrixDynSize.

auto operator()(const std::size_t row, const std::size_t col) const -> double
auto operator()(const std::size_t row, const std::size_t col) -> double&
auto getVal(const std::size_t row, const std::size_t col) const -> double
auto setVal(const std::size_t row, const std::size_t col, const double new_el) -> bool
auto rows() const -> std::size_t
auto cols() const -> std::size_t

Output helpers.

Output helpers.

auto toString() const -> std::string
auto reservedToString() const -> std::string

Function documentation

iDynTree::MatrixDynSize::MatrixDynSize(std::size_t _rows, std::size_t _cols)

Constructor from the rows and columns, all the element assigned to 0.

Parameters
_rows the desired rows of the matrix.
_cols the desired cols of the matrix.

iDynTree::MatrixDynSize::MatrixDynSize(const double* in_data, const std::size_t in_rows, const std::size_t in_cols)

Constructor from a C-style matrix.

iDynTree::MatrixDynSize::MatrixDynSize(const MatrixDynSize& other)

Copy constructor.

Parameters
other the object to copy

iDynTree::MatrixDynSize::MatrixDynSize(iDynTree::MatrixView<const double> other)

Constructor from MatrixView object.

Parameters
other MatrixView to copy

iDynTree::MatrixDynSize::~MatrixDynSize() virtual

Denstructor.

MatrixDynSize& iDynTree::MatrixDynSize::operator=(const MatrixDynSize& other)

Assignment operator.

Parameters
other the object to copy into self
Returns *this

MatrixDynSize& iDynTree::MatrixDynSize::operator=(iDynTree::MatrixView<const double> other)

Assignment operator.

Parameters
other the object to copy into self
Returns *this

const double* iDynTree::MatrixDynSize::data() const

Raw data accessor.

Returns a const pointer to a vector of size() doubles

double* iDynTree::MatrixDynSize::data()

Raw data accessor.

Returns a pointer to a vector of size() doubles

void iDynTree::MatrixDynSize::resize(const std::size_t _newRows, const std::size_t _newCols)

Change the size of the matrix, without preserving old content.

Parameters
_newRows the new rows of the matrix
_newCols the new cols of the matrix

void iDynTree::MatrixDynSize::reserve(const size_t _newCapacity)

Increase the capacity of the matrix, preserving old content.

void iDynTree::MatrixDynSize::shrink_to_fit()

Change the capacity of the matrix such that capacity() == rows()*cols(), preserving old content.

void iDynTree::MatrixDynSize::fillRowMajorBuffer(double* rowMajorBuf) const

Assume that rowMajorBuf is pointing to a buffer of rows()*cols() doubles, and fill it with the content of this matrix, using row major order.

Parameters
rowMajorBuf pointer to the buffer to fill

void iDynTree::MatrixDynSize::fillColMajorBuffer(double* colMajorBuf) const

Assume that colMajorBuf is pointing to a buffer of rows()*cols() doubles, and fill it with the content of this matrix, using column major order.

Parameters
colMajorBuf pointer to the buffer to fill

Variable documentation

double* iDynTree::MatrixDynSize::m_data protected

Storage for the MatrixDynSize.

Pointer to an area of capacity() doubles, managed by this class.