aligator  0.14.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
 
Loading...
Searching...
No Matches
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > Class Template Reference

Thin wrapper around Eigen::Map representing a matrix object with memory managed by a C++17 polymorphic allocator. More...

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

Public Types

using Scalar = _Scalar
 
using MatrixType = Eigen::Matrix<Scalar, Rows, Cols, Options>
 
using MapType = Eigen::Map<MatrixType, Alignment>
 
using ConstMapType = Eigen::Map<const MatrixType, Alignment>
 
using Index = Eigen::Index
 
using allocator_type = polymorphic_allocator
 

Public Member Functions

 ManagedMatrix (const allocator_type &allocator={})
 Extended default constructor.
 
 ManagedMatrix (Index size, const allocator_type &allocator)
 
 ManagedMatrix (Index rows, Index cols, const allocator_type &allocator)
 
 ManagedMatrix (const ManagedMatrix &other, const allocator_type &alloc={})
 
 ManagedMatrix (ManagedMatrix &&other, const allocator_type &alloc)
 Extended move constructor, will use the provided allocator.
 
 ManagedMatrix (ManagedMatrix &&other) noexcept
 Nonextended move constructor, will use moved-from object's allocator.
 
template<typename Derived>
 ManagedMatrix (const Eigen::MatrixBase< Derived > &mat, const allocator_type &alloc={})
 Copy constructor from another Eigen matrix.
 
ManagedMatrixoperator= (const ManagedMatrix &other)
 
ManagedMatrixoperator= (ManagedMatrix &&other)
 
template<typename Derived>
ManagedMatrixoperator= (const Eigen::MatrixBase< Derived > &mat)
 
void resize (Index size)
 
void resize (Index rows, Index cols)
 
Index rows () const noexcept
 
Index cols () const noexcept
 
Index size () const noexcept
 
Index allocated_size () const noexcept
 Get current allocated size.
 
allocator_type get_allocator () const noexcept
 Accessor to retrieve the allocator used for this matrix.
 
 operator MapType ()
 
 operator ConstMapType () const
 
 ~ManagedMatrix ()
 
MapType to_map ()
 Obtain mutable map.
 
ConstMapType to_map () const
 Obtain const map since this is const.
 
ConstMapType to_const_map () const
 Obtain a const map.
 
void setZero ()
 
void setZero (Index rows, Index cols)
 
void setZero (Index size)
 
void setRandom ()
 
void setIdentity ()
 
void setConstant (Scalar s)
 
auto noalias ()
 
auto diagonal ()
 
auto diagonal () const
 
auto topRows (Index n)
 
auto topRows (Index n) const
 
auto head (Index n)
 
auto head (Index n) const
 
auto tail (Index n)
 
auto tail (Index n) const
 
bool isApprox (const ManagedMatrix &other, Scalar prec=std::numeric_limits< Scalar >::epsilon()) const
 
template<typename Derived>
bool isApprox (const Eigen::DenseBase< Derived > &mat, Scalar prec=std::numeric_limits< Scalar >::epsilon()) const
 
Scalardata ()
 Pointer to stored data.
 
const Scalardata () const
 Pointer to stored data.
 

Static Public Attributes

static constexpr int Rows = _Rows
 
static constexpr int Cols = _Cols
 
static constexpr int Options = _Options
 
static constexpr bool IsVectorAtCompileTime
 

Detailed Description

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
class aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >

Thin wrapper around Eigen::Map representing a matrix object with memory managed by a C++17 polymorphic allocator.

This is an allocator-aware (AA) type, meaning it contains a allocator_type typedef.

We follow the std::pmr::polymorphic_allocator style, thus the STL traits propagate_on_container_copy_assignment, propagate_on_container_move_assignment, and propagate_on_container_swap all evaluate to false. The object's allocator does not change during its lifetime.

Definition at line 22 of file managed-matrix.hpp.

Member Typedef Documentation

◆ Scalar

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::Scalar = _Scalar

Definition at line 38 of file managed-matrix.hpp.

◆ MatrixType

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::MatrixType = Eigen::Matrix<Scalar, Rows, Cols, Options>

Definition at line 42 of file managed-matrix.hpp.

◆ MapType

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::MapType = Eigen::Map<MatrixType, Alignment>

Definition at line 43 of file managed-matrix.hpp.

◆ ConstMapType

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ConstMapType = Eigen::Map<const MatrixType, Alignment>

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

◆ Index

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::Index = Eigen::Index

Definition at line 45 of file managed-matrix.hpp.

◆ allocator_type

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
using aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::allocator_type = polymorphic_allocator

Definition at line 46 of file managed-matrix.hpp.

Constructor & Destructor Documentation

◆ ManagedMatrix() [1/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( const allocator_type & allocator = {})
inlineexplicit

Extended default constructor.

Definition at line 52 of file managed-matrix.hpp.

◆ ManagedMatrix() [2/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( Index size,
const allocator_type & allocator )
inlineexplicit

Definition at line 58 of file managed-matrix.hpp.

◆ ManagedMatrix() [3/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( Index rows,
Index cols,
const allocator_type & allocator )
inlineexplicit

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

◆ ManagedMatrix() [4/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( const ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > & other,
const allocator_type & alloc = {} )
inline

Definition at line 83 of file managed-matrix.hpp.

◆ ManagedMatrix() [5/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > && other,
const allocator_type & alloc )
inline

Extended move constructor, will use the provided allocator.

Definition at line 89 of file managed-matrix.hpp.

◆ ManagedMatrix() [6/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > && other)
inlinenoexcept

Nonextended move constructor, will use moved-from object's allocator.

Definition at line 110 of file managed-matrix.hpp.

◆ ManagedMatrix() [7/7]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
template<typename Derived>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::ManagedMatrix ( const Eigen::MatrixBase< Derived > & mat,
const allocator_type & alloc = {} )
inline

Copy constructor from another Eigen matrix.

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

◆ ~ManagedMatrix()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::~ManagedMatrix ( )
inline

Definition at line 224 of file managed-matrix.hpp.

Member Function Documentation

◆ operator=() [1/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
ManagedMatrix & aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::operator= ( const ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > & other)
inline

Definition at line 129 of file managed-matrix.hpp.

◆ operator=() [2/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
ManagedMatrix & aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::operator= ( ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > && other)
inline

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

◆ operator=() [3/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
template<typename Derived>
ManagedMatrix & aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::operator= ( const Eigen::MatrixBase< Derived > & mat)
inline

Definition at line 163 of file managed-matrix.hpp.

◆ resize() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::resize ( Index size)
inline

Definition at line 169 of file managed-matrix.hpp.

◆ resize() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::resize ( Index rows,
Index cols )
inline

Definition at line 184 of file managed-matrix.hpp.

◆ rows()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
Index aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::rows ( ) const
inlinenoexcept

Definition at line 194 of file managed-matrix.hpp.

◆ cols()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
Index aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::cols ( ) const
inlinenoexcept

Definition at line 196 of file managed-matrix.hpp.

◆ size()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
Index aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::size ( ) const
inlinenoexcept

Definition at line 198 of file managed-matrix.hpp.

◆ allocated_size()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
Index aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::allocated_size ( ) const
inlinenoexcept

Get current allocated size.

Definition at line 201 of file managed-matrix.hpp.

◆ get_allocator()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
allocator_type aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::get_allocator ( ) const
inlinenodiscardnoexcept

Accessor to retrieve the allocator used for this matrix.

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

◆ operator MapType()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::operator MapType ( )
inlineexplicitnodiscard

Definition at line 208 of file managed-matrix.hpp.

◆ operator ConstMapType()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::operator ConstMapType ( ) const
inlineexplicitnodiscard

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

◆ to_map() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
MapType aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::to_map ( )
inline

Obtain mutable map.

Definition at line 227 of file managed-matrix.hpp.

◆ to_map() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
ConstMapType aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::to_map ( ) const
inline

Obtain const map since this is const.

Definition at line 230 of file managed-matrix.hpp.

◆ to_const_map()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
ConstMapType aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::to_const_map ( ) const
inline

Obtain a const map.

Definition at line 233 of file managed-matrix.hpp.

◆ setZero() [1/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setZero ( )
inline

Definition at line 235 of file managed-matrix.hpp.

◆ setZero() [2/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setZero ( Index rows,
Index cols )
inline

Definition at line 237 of file managed-matrix.hpp.

◆ setZero() [3/3]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setZero ( Index size)
inline

Definition at line 242 of file managed-matrix.hpp.

◆ setRandom()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setRandom ( )
inline

Definition at line 247 of file managed-matrix.hpp.

◆ setIdentity()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setIdentity ( )
inline

Definition at line 249 of file managed-matrix.hpp.

◆ setConstant()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
void aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::setConstant ( Scalar s)
inline

Definition at line 251 of file managed-matrix.hpp.

◆ noalias()

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::noalias ( )
inline

Definition at line 253 of file managed-matrix.hpp.

◆ diagonal() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::diagonal ( )
inline

Definition at line 255 of file managed-matrix.hpp.

◆ diagonal() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::diagonal ( ) const
inline

Definition at line 256 of file managed-matrix.hpp.

◆ topRows() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::topRows ( Index n)
inline

Definition at line 258 of file managed-matrix.hpp.

◆ topRows() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::topRows ( Index n) const
inline

Definition at line 259 of file managed-matrix.hpp.

◆ head() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::head ( Index n)
inline

Definition at line 261 of file managed-matrix.hpp.

◆ head() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::head ( Index n) const
inline

Definition at line 262 of file managed-matrix.hpp.

◆ tail() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::tail ( Index n)
inline

Definition at line 264 of file managed-matrix.hpp.

◆ tail() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
auto aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::tail ( Index n) const
inline

Definition at line 265 of file managed-matrix.hpp.

◆ isApprox() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
bool aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::isApprox ( const ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment > & other,
Scalar prec = std::numeric_limits<Scalar>::epsilon() ) const
inline

Definition at line 267 of file managed-matrix.hpp.

◆ isApprox() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
template<typename Derived>
bool aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::isApprox ( const Eigen::DenseBase< Derived > & mat,
Scalar prec = std::numeric_limits<Scalar>::epsilon() ) const
inline

Definition at line 273 of file managed-matrix.hpp.

◆ data() [1/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
Scalar * aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::data ( )
inlinenodiscard

Pointer to stored data.

Definition at line 279 of file managed-matrix.hpp.

◆ data() [2/2]

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
const Scalar * aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::data ( ) const
inlinenodiscard

Pointer to stored data.

Definition at line 282 of file managed-matrix.hpp.

Member Data Documentation

◆ Rows

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
int aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::Rows = _Rows
staticconstexpr

Definition at line 39 of file managed-matrix.hpp.

◆ Cols

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
int aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::Cols = _Cols
staticconstexpr

Definition at line 40 of file managed-matrix.hpp.

◆ Options

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
int aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::Options = _Options
staticconstexpr

Definition at line 41 of file managed-matrix.hpp.

◆ IsVectorAtCompileTime

template<typename _Scalar, int _Rows, int _Cols, int _Options = Eigen::ColMajor, int Alignment = Eigen::AlignedMax>
bool aligator::ManagedMatrix< _Scalar, _Rows, _Cols, _Options, Alignment >::IsVectorAtCompileTime
staticconstexpr
Initial value:
=
MatrixType::IsVectorAtCompileTime

Definition at line 48 of file managed-matrix.hpp.


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