aligator  0.16.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Loading...
Searching...
No Matches
aligator::BlkMatrix< _MatrixType, _N, _M > Class Template Reference

Block matrix class, with a fixed or dynamic-size number of row and column blocks. More...

#include <aligator/core/blk-matrix.hpp>

Public Types

using MatrixType = _MatrixType
 
using PlainObject = typename MatrixType::PlainObject
 
using Scalar = typename MatrixType::Scalar
 
using Index = Eigen::Index
 
using RowDimsType
 
using ColDimsType
 

Public Member Functions

 BlkMatrix ()
 
 BlkMatrix (const RowDimsType &rowDims, const ColDimsType &colDims)
 
template<typename Other>
 BlkMatrix (const Eigen::MatrixBase< Other > &data, const RowDimsType &rowDims, const ColDimsType &colDims)
 
template<typename Other>
 BlkMatrix (Eigen::MatrixBase< Other > &data, const RowDimsType &rowDims, const ColDimsType &colDims)
 
template<typename Other>
 BlkMatrix (const Eigen::MatrixBase< Other > &data, const RowDimsType &dims)
 Only-rows constructor (only for vectors)
 
template<typename Other>
 BlkMatrix (Eigen::MatrixBase< Other > &data, const RowDimsType &dims)
 Only-rows constructor (only for vectors)
 
 operator Eigen::Ref< PlainObject > ()
 
 operator Eigen::Ref< const PlainObject > () const
 
 BlkMatrix (const RowDimsType &dims)
 Only-rows constructor (only for vectors)
 
auto operator() (size_t i, size_t j)
 Get the block in position ( i, j )
 
auto operator() (size_t i, size_t j) const
 
auto blockRow (size_t i)
 
auto blockRow (size_t i) const
 
auto blockCol (size_t j) const
 
auto blockCol (size_t j)
 
auto blockSegment (size_t i)
 
auto blockSegment (size_t i) const
 
auto operator[] (size_t i)
 
auto operator[] (size_t i) const
 
template<typename Other>
BlkMatrixoperator= (const Eigen::MatrixBase< Other > &other)
 Set the data to be equal to some other Eigen object.
 
void setZero ()
 
template<typename Other>
void swap (BlkMatrix< Other, N, M > &other)
 
MatrixTypematrix ()
 
const MatrixTypematrix () const
 
template<typename D>
bool isApprox (const Eigen::EigenBase< D > &other, const Scalar prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
 
template<typename D, int N2, int M2>
bool isApprox (const BlkMatrix< D, N2, M2 > &other, const Scalar prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
 
const RowDimsTyperowDims () const
 
const RowDimsTyperowIndices () const
 
const ColDimsTypecolDims () const
 
const ColDimsTypecolIndices () const
 
Index rows () const
 
Index cols () const
 
auto topBlkRows (size_t n)
 Take the top n block rows of the block matrix.
 
template<size_t n>
auto topBlkRows ()
 This version returns a fixed-size block. This version returns a fixed-size block.
 

Static Public Member Functions

static BlkMatrix Zero (const RowDimsType &rowDims, const ColDimsType &colDims)
 

Static Public Attributes

static constexpr int N = _N
 
static constexpr int M = _M
 
static constexpr int Options = PlainObject::Options
 
static constexpr bool IsVectorAtCompileTime
 

Protected Member Functions

void initialize ()
 

Protected Attributes

MatrixType m_data
 
RowDimsType m_rowDims
 
ColDimsType m_colDims
 
RowDimsType m_rowIndices
 
ColDimsType m_colIndices
 
Index m_totalRows
 
Index m_totalCols
 

Friends

std::ostream & operator<< (std::ostream &oss, const BlkMatrix &self)
 

Detailed Description

template<typename _MatrixType, int _N, int _M>
class aligator::BlkMatrix< _MatrixType, _N, _M >

Block matrix class, with a fixed or dynamic-size number of row and column blocks.

Template Parameters
Baselinematrix type; the user can use an Eigen::Ref type to create a blocked view to an existing matrix.
Nnumber of block rows.
Mnumber of block columns.

Definition at line 19 of file blk-matrix.hpp.

Member Typedef Documentation

◆ MatrixType

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::MatrixType = _MatrixType

Definition at line 21 of file blk-matrix.hpp.

◆ PlainObject

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::PlainObject = typename MatrixType::PlainObject

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

◆ Scalar

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::Scalar = typename MatrixType::Scalar

Definition at line 23 of file blk-matrix.hpp.

◆ Index

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::Index = Eigen::Index

Definition at line 24 of file blk-matrix.hpp.

◆ RowDimsType

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::RowDimsType
Initial value:
std::conditional_t<N != -1, std::array<Index, size_t(N)>,
std::vector<Index>>
Eigen::Index Index
static constexpr int N

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

◆ ColDimsType

template<typename _MatrixType, int _N, int _M>
using aligator::BlkMatrix< _MatrixType, _N, _M >::ColDimsType
Initial value:
std::conditional_t<M != -1, std::array<Index, size_t(M)>,
std::vector<Index>>
static constexpr int M

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

Constructor & Destructor Documentation

◆ BlkMatrix() [1/7]

template<typename _MatrixType, int _N, int _M>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( )
inline

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

◆ BlkMatrix() [2/7]

template<typename _MatrixType, int _N, int _M>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( const RowDimsType & rowDims,
const ColDimsType & colDims )
inline

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

◆ BlkMatrix() [3/7]

template<typename _MatrixType, int _N, int _M>
template<typename Other>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( const Eigen::MatrixBase< Other > & data,
const RowDimsType & rowDims,
const ColDimsType & colDims )
inline

Definition at line 64 of file blk-matrix.hpp.

◆ BlkMatrix() [4/7]

template<typename _MatrixType, int _N, int _M>
template<typename Other>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( Eigen::MatrixBase< Other > & data,
const RowDimsType & rowDims,
const ColDimsType & colDims )
inline

Definition at line 77 of file blk-matrix.hpp.

◆ BlkMatrix() [5/7]

template<typename _MatrixType, int _N, int _M>
template<typename Other>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( const Eigen::MatrixBase< Other > & data,
const RowDimsType & dims )
inline

Only-rows constructor (only for vectors)

Definition at line 91 of file blk-matrix.hpp.

◆ BlkMatrix() [6/7]

template<typename _MatrixType, int _N, int _M>
template<typename Other>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( Eigen::MatrixBase< Other > & data,
const RowDimsType & dims )
inline

Only-rows constructor (only for vectors)

Definition at line 96 of file blk-matrix.hpp.

◆ BlkMatrix() [7/7]

template<typename _MatrixType, int _N, int _M>
aligator::BlkMatrix< _MatrixType, _N, _M >::BlkMatrix ( const RowDimsType & dims)
inlineexplicit

Only-rows constructor (only for vectors)

Definition at line 103 of file blk-matrix.hpp.

Member Function Documentation

◆ operator Eigen::Ref< PlainObject >()

template<typename _MatrixType, int _N, int _M>
aligator::BlkMatrix< _MatrixType, _N, _M >::operator Eigen::Ref< PlainObject > ( )
inline

Definition at line 99 of file blk-matrix.hpp.

◆ operator Eigen::Ref< const PlainObject >()

template<typename _MatrixType, int _N, int _M>
aligator::BlkMatrix< _MatrixType, _N, _M >::operator Eigen::Ref< const PlainObject > ( ) const
inline

Definition at line 100 of file blk-matrix.hpp.

◆ operator()() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::operator() ( size_t i,
size_t j )
inline

Get the block in position ( i, j )

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

◆ operator()() [2/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::operator() ( size_t i,
size_t j ) const
inline

Definition at line 116 of file blk-matrix.hpp.

◆ blockRow() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockRow ( size_t i)
inline

Definition at line 121 of file blk-matrix.hpp.

◆ blockRow() [2/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockRow ( size_t i) const
inline

Definition at line 125 of file blk-matrix.hpp.

◆ blockCol() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockCol ( size_t j) const
inline

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

◆ blockCol() [2/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockCol ( size_t j)
inline

Definition at line 133 of file blk-matrix.hpp.

◆ blockSegment() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockSegment ( size_t i)
inline

Definition at line 137 of file blk-matrix.hpp.

◆ blockSegment() [2/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::blockSegment ( size_t i) const
inline

Definition at line 142 of file blk-matrix.hpp.

◆ operator[]() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::operator[] ( size_t i)
inline

Definition at line 147 of file blk-matrix.hpp.

◆ operator[]() [2/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::operator[] ( size_t i) const
inline

Definition at line 149 of file blk-matrix.hpp.

◆ operator=()

template<typename _MatrixType, int _N, int _M>
template<typename Other>
BlkMatrix & aligator::BlkMatrix< _MatrixType, _N, _M >::operator= ( const Eigen::MatrixBase< Other > & other)
inline

Set the data to be equal to some other Eigen object.

Definition at line 153 of file blk-matrix.hpp.

◆ setZero()

template<typename _MatrixType, int _N, int _M>
void aligator::BlkMatrix< _MatrixType, _N, _M >::setZero ( )
inline

Definition at line 160 of file blk-matrix.hpp.

◆ Zero()

template<typename _MatrixType, int _N, int _M>
static BlkMatrix aligator::BlkMatrix< _MatrixType, _N, _M >::Zero ( const RowDimsType & rowDims,
const ColDimsType & colDims )
inlinestatic

Definition at line 161 of file blk-matrix.hpp.

◆ swap()

template<typename _MatrixType, int _N, int _M>
template<typename Other>
void aligator::BlkMatrix< _MatrixType, _N, _M >::swap ( BlkMatrix< Other, N, M > & other)
inline

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

◆ matrix() [1/2]

template<typename _MatrixType, int _N, int _M>
MatrixType & aligator::BlkMatrix< _MatrixType, _N, _M >::matrix ( )
inline

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

◆ matrix() [2/2]

template<typename _MatrixType, int _N, int _M>
const MatrixType & aligator::BlkMatrix< _MatrixType, _N, _M >::matrix ( ) const
inline

Definition at line 174 of file blk-matrix.hpp.

◆ isApprox() [1/2]

template<typename _MatrixType, int _N, int _M>
template<typename D>
bool aligator::BlkMatrix< _MatrixType, _N, _M >::isApprox ( const Eigen::EigenBase< D > & other,
const Scalar prec = Eigen::NumTraits<Scalar>::dummy_precision() ) const
inline

Definition at line 177 of file blk-matrix.hpp.

◆ isApprox() [2/2]

template<typename _MatrixType, int _N, int _M>
template<typename D, int N2, int M2>
bool aligator::BlkMatrix< _MatrixType, _N, _M >::isApprox ( const BlkMatrix< D, N2, M2 > & other,
const Scalar prec = Eigen::NumTraits<Scalar>::dummy_precision() ) const
inline

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

◆ rowDims()

template<typename _MatrixType, int _N, int _M>
const RowDimsType & aligator::BlkMatrix< _MatrixType, _N, _M >::rowDims ( ) const
inline

Definition at line 190 of file blk-matrix.hpp.

◆ rowIndices()

template<typename _MatrixType, int _N, int _M>
const RowDimsType & aligator::BlkMatrix< _MatrixType, _N, _M >::rowIndices ( ) const
inline

Definition at line 191 of file blk-matrix.hpp.

◆ colDims()

template<typename _MatrixType, int _N, int _M>
const ColDimsType & aligator::BlkMatrix< _MatrixType, _N, _M >::colDims ( ) const
inline

Definition at line 192 of file blk-matrix.hpp.

◆ colIndices()

template<typename _MatrixType, int _N, int _M>
const ColDimsType & aligator::BlkMatrix< _MatrixType, _N, _M >::colIndices ( ) const
inline

Definition at line 193 of file blk-matrix.hpp.

◆ rows()

template<typename _MatrixType, int _N, int _M>
Index aligator::BlkMatrix< _MatrixType, _N, _M >::rows ( ) const
inline

Definition at line 195 of file blk-matrix.hpp.

◆ cols()

template<typename _MatrixType, int _N, int _M>
Index aligator::BlkMatrix< _MatrixType, _N, _M >::cols ( ) const
inline

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

◆ topBlkRows() [1/2]

template<typename _MatrixType, int _N, int _M>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::topBlkRows ( size_t n)
inline

Take the top n block rows of the block matrix.

Definition at line 199 of file blk-matrix.hpp.

◆ topBlkRows() [2/2]

template<typename _MatrixType, int _N, int _M>
template<size_t n>
auto aligator::BlkMatrix< _MatrixType, _N, _M >::topBlkRows ( )
inline

This version returns a fixed-size block. This version returns a fixed-size block.

Definition at line 210 of file blk-matrix.hpp.

◆ initialize()

template<typename _MatrixType, int _N, int _M>
void aligator::BlkMatrix< _MatrixType, _N, _M >::initialize ( )
inlineprotected

Definition at line 234 of file blk-matrix.hpp.

Friends And Related Symbol Documentation

◆ operator<<

template<typename _MatrixType, int _N, int _M>
std::ostream & operator<< ( std::ostream & oss,
const BlkMatrix< _MatrixType, _N, _M > & self )
friend

Definition at line 221 of file blk-matrix.hpp.

Member Data Documentation

◆ N

template<typename _MatrixType, int _N, int _M>
int aligator::BlkMatrix< _MatrixType, _N, _M >::N = _N
staticconstexpr

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

◆ M

template<typename _MatrixType, int _N, int _M>
int aligator::BlkMatrix< _MatrixType, _N, _M >::M = _M
staticconstexpr

Definition at line 26 of file blk-matrix.hpp.

◆ Options

template<typename _MatrixType, int _N, int _M>
int aligator::BlkMatrix< _MatrixType, _N, _M >::Options = PlainObject::Options
staticconstexpr

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

◆ IsVectorAtCompileTime

template<typename _MatrixType, int _N, int _M>
bool aligator::BlkMatrix< _MatrixType, _N, _M >::IsVectorAtCompileTime
staticconstexpr
Initial value:
=
MatrixType::IsVectorAtCompileTime

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

◆ m_data

template<typename _MatrixType, int _N, int _M>
MatrixType aligator::BlkMatrix< _MatrixType, _N, _M >::m_data
protected

Definition at line 226 of file blk-matrix.hpp.

◆ m_rowDims

template<typename _MatrixType, int _N, int _M>
RowDimsType aligator::BlkMatrix< _MatrixType, _N, _M >::m_rowDims
protected

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

◆ m_colDims

template<typename _MatrixType, int _N, int _M>
ColDimsType aligator::BlkMatrix< _MatrixType, _N, _M >::m_colDims
protected

Definition at line 228 of file blk-matrix.hpp.

◆ m_rowIndices

template<typename _MatrixType, int _N, int _M>
RowDimsType aligator::BlkMatrix< _MatrixType, _N, _M >::m_rowIndices
protected

Definition at line 229 of file blk-matrix.hpp.

◆ m_colIndices

template<typename _MatrixType, int _N, int _M>
ColDimsType aligator::BlkMatrix< _MatrixType, _N, _M >::m_colIndices
protected

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

◆ m_totalRows

template<typename _MatrixType, int _N, int _M>
Index aligator::BlkMatrix< _MatrixType, _N, _M >::m_totalRows
protected

Definition at line 231 of file blk-matrix.hpp.

◆ m_totalCols

template<typename _MatrixType, int _N, int _M>
Index aligator::BlkMatrix< _MatrixType, _N, _M >::m_totalCols
protected

Definition at line 232 of file blk-matrix.hpp.


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