aligator  0.15.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Loading...
Searching...
No Matches
aligator::ArenaMatrix< MatrixType, Alignment > Class Template Reference

#include <aligator/memory/arena-matrix.hpp>

Inheritance diagram for aligator::ArenaMatrix< MatrixType, Alignment >:
[legend]
Collaboration diagram for aligator::ArenaMatrix< MatrixType, Alignment >:
[legend]

Public Types

using Scalar = typename std::decay_t<MatrixType>::Scalar
 
using PlainObject = std::decay_t<MatrixType>
 
using Base = Eigen::Map<PlainObject, Alignment>
 
using Index = Eigen::Index
 
using ConstMapType = Eigen::Map<const PlainObject, Alignment>
 
using allocator_type = polymorphic_allocator
 

Public Member Functions

 ArenaMatrix ()
 
 ArenaMatrix (const allocator_type &allocator)
 
allocator_type get_allocator () const noexcept
 
 ArenaMatrix (Index cols, Index rows, const allocator_type &allocator={})
 
 ArenaMatrix (Index size, const allocator_type &allocator={})
 
template<typename D, enable_if_eigen_t< D > * = nullptr>
 ArenaMatrix (const D &other, const allocator_type &alloc={})
 
 ArenaMatrix (const ArenaMatrix &other, const allocator_type &alloc={})
 
 ArenaMatrix (ArenaMatrix &&other) noexcept
 
 ArenaMatrix (ArenaMatrix &&other, const allocator_type &alloc)
 Extended move constructor.
 
template<typename D, enable_if_eigen_t< D > * = nullptr>
ArenaMatrixoperator= (const D &other)
 
ArenaMatrixoperator= (const ArenaMatrix &other)
 
ArenaMatrixoperator= (ArenaMatrix &&other)
 
 operator ConstMapType () const
 
 ~ArenaMatrix ()
 
void resize (Index size)
 Resize this matrix. This will reallocate.
 
void resize (Index rows, Index cols)
 Resize this matrix. This will reallocate.
 
void conservativeResize (Index size)
 
void conservativeResize (Index rows, Index cols)
 
Index allocatedSize () const noexcept
 Current allocated size for this matrix. This is what allows resizing without reallocation.
 
ArenaMatrixsetZero (Index newSize)
 
ArenaMatrixsetZero (Index rows, Index cols)
 
ArenaMatrixsetIdentity (Index rows, Index cols)
 

Static Public Attributes

static constexpr int RowsAtCompileTime = MatrixType::RowsAtCompileTime
 
static constexpr int ColsAtCompileTime = MatrixType::ColsAtCompileTime
 

Detailed Description

template<typename MatrixType, int Alignment>
class aligator::ArenaMatrix< MatrixType, Alignment >

A replacement for Eigen::Matrix but compatible with C++17 polymorphic allocators (through the aligator::polymorphic_allocator subclass which extends the API).

This is implemented a subclass of Eigen::Map.

The implementation is inspired from the arena_matrix class template in Stan's math library: See: https://mc-stan.org/math/classstan_1_1math_1_1arena__matrix_3_01_matrix_type_00_01require__eigen__dense__base__t_3_01_matrix_type_01_4_01_4.html

Template Parameters
MatrixTypeThe original plain Eigen matrix type.
AlignmentThe desired alignment for the data pointer.

Definition at line 25 of file arena-matrix.hpp.

Member Typedef Documentation

◆ Scalar

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::Scalar = typename std::decay_t<MatrixType>::Scalar

Definition at line 27 of file arena-matrix.hpp.

◆ PlainObject

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::PlainObject = std::decay_t<MatrixType>

Definition at line 28 of file arena-matrix.hpp.

◆ Base

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::Base = Eigen::Map<PlainObject, Alignment>

Definition at line 29 of file arena-matrix.hpp.

◆ Index

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::Index = Eigen::Index

Definition at line 30 of file arena-matrix.hpp.

◆ ConstMapType

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::ConstMapType = Eigen::Map<const PlainObject, Alignment>

Definition at line 31 of file arena-matrix.hpp.

◆ allocator_type

template<typename MatrixType, int Alignment>
using aligator::ArenaMatrix< MatrixType, Alignment >::allocator_type = polymorphic_allocator

Definition at line 34 of file arena-matrix.hpp.

Constructor & Destructor Documentation

◆ ArenaMatrix() [1/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( )
inline

Definition at line 37 of file arena-matrix.hpp.

◆ ArenaMatrix() [2/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( const allocator_type & allocator)
inlineexplicit

Definition at line 44 of file arena-matrix.hpp.

◆ ArenaMatrix() [3/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( Index cols,
Index rows,
const allocator_type & allocator = {} )
inline

Definition at line 55 of file arena-matrix.hpp.

◆ ArenaMatrix() [4/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( Index size,
const allocator_type & allocator = {} )
inlineexplicit

Definition at line 60 of file arena-matrix.hpp.

◆ ArenaMatrix() [5/8]

template<typename MatrixType, int Alignment>
template<typename D, enable_if_eigen_t< D > * = nullptr>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( const D & other,
const allocator_type & alloc = {} )
inline

Definition at line 66 of file arena-matrix.hpp.

◆ ArenaMatrix() [6/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( const ArenaMatrix< MatrixType, Alignment > & other,
const allocator_type & alloc = {} )
inlineexplicit

Definition at line 74 of file arena-matrix.hpp.

◆ ArenaMatrix() [7/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( ArenaMatrix< MatrixType, Alignment > && other)
inlinenoexcept

Definition at line 81 of file arena-matrix.hpp.

◆ ArenaMatrix() [8/8]

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::ArenaMatrix ( ArenaMatrix< MatrixType, Alignment > && other,
const allocator_type & alloc )
inline

Extended move constructor.

Definition at line 90 of file arena-matrix.hpp.

◆ ~ArenaMatrix()

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::~ArenaMatrix ( )
inline

Definition at line 143 of file arena-matrix.hpp.

Member Function Documentation

◆ get_allocator()

template<typename MatrixType, int Alignment>
allocator_type aligator::ArenaMatrix< MatrixType, Alignment >::get_allocator ( ) const
inlinenodiscardnoexcept

Definition at line 51 of file arena-matrix.hpp.

◆ operator=() [1/3]

template<typename MatrixType, int Alignment>
template<typename D, enable_if_eigen_t< D > * = nullptr>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::operator= ( const D & other)
inline

Definition at line 106 of file arena-matrix.hpp.

◆ operator=() [2/3]

template<typename MatrixType, int Alignment>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::operator= ( const ArenaMatrix< MatrixType, Alignment > & other)
inline

Explicitly define copy assignment operator. Required because polymorphic_allocator has its copy assignment operator implicitly deleted.

Definition at line 115 of file arena-matrix.hpp.

◆ operator=() [3/3]

template<typename MatrixType, int Alignment>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::operator= ( ArenaMatrix< MatrixType, Alignment > && other)
inline

Definition at line 123 of file arena-matrix.hpp.

◆ operator ConstMapType()

template<typename MatrixType, int Alignment>
aligator::ArenaMatrix< MatrixType, Alignment >::operator ConstMapType ( ) const
inline

Definition at line 139 of file arena-matrix.hpp.

◆ resize() [1/2]

template<typename MatrixType, int Alignment>
void aligator::ArenaMatrix< MatrixType, Alignment >::resize ( Index size)
inline

Resize this matrix. This will reallocate.

Definition at line 146 of file arena-matrix.hpp.

◆ resize() [2/2]

template<typename MatrixType, int Alignment>
void aligator::ArenaMatrix< MatrixType, Alignment >::resize ( Index rows,
Index cols )
inline

Resize this matrix. This will reallocate.

Definition at line 159 of file arena-matrix.hpp.

◆ conservativeResize() [1/2]

template<typename MatrixType, int Alignment>
void aligator::ArenaMatrix< MatrixType, Alignment >::conservativeResize ( Index size)
inline

Definition at line 173 of file arena-matrix.hpp.

◆ conservativeResize() [2/2]

template<typename MatrixType, int Alignment>
void aligator::ArenaMatrix< MatrixType, Alignment >::conservativeResize ( Index rows,
Index cols )
inline

Definition at line 185 of file arena-matrix.hpp.

◆ allocatedSize()

template<typename MatrixType, int Alignment>
Index aligator::ArenaMatrix< MatrixType, Alignment >::allocatedSize ( ) const
inlinenoexcept

Current allocated size for this matrix. This is what allows resizing without reallocation.

Definition at line 200 of file arena-matrix.hpp.

◆ setZero() [1/2]

template<typename MatrixType, int Alignment>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::setZero ( Index newSize)
inline

Definition at line 204 of file arena-matrix.hpp.

◆ setZero() [2/2]

template<typename MatrixType, int Alignment>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::setZero ( Index rows,
Index cols )
inline

Definition at line 209 of file arena-matrix.hpp.

◆ setIdentity()

template<typename MatrixType, int Alignment>
ArenaMatrix & aligator::ArenaMatrix< MatrixType, Alignment >::setIdentity ( Index rows,
Index cols )
inline

Definition at line 216 of file arena-matrix.hpp.

Member Data Documentation

◆ RowsAtCompileTime

template<typename MatrixType, int Alignment>
int aligator::ArenaMatrix< MatrixType, Alignment >::RowsAtCompileTime = MatrixType::RowsAtCompileTime
staticconstexpr

Definition at line 32 of file arena-matrix.hpp.

◆ ColsAtCompileTime

template<typename MatrixType, int Alignment>
int aligator::ArenaMatrix< MatrixType, Alignment >::ColsAtCompileTime = MatrixType::ColsAtCompileTime
staticconstexpr

Definition at line 33 of file arena-matrix.hpp.


The documentation for this class was generated from the following file: