humoto
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num > Class Template Reference

Detailed Description

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
class etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >

Block matrix basic functions.

Template Parameters
t_MatrixTypetype of raw matrix
t_block_rows_numnumber of rows in one block
t_block_cols_numnumber of columns in one block

Definition at line 107 of file blockmatrix_base.h.

#include <blockmatrix_base.h>

Inheritance diagram for etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >:
Inheritance graph

Public Types

typedef const Eigen::Block< const EIGENTOOLS_DYNAMIC_MATRIX(Scalar) > ConstDynamicMatrixBlock
 Shorthand for Eigen block. More...
 
typedef TypeDecayed< t_MatrixType >::Type DecayedRawMatrix
 Raw matrix without 'const' and '&'. More...
 
typedef Eigen::Block< EIGENTOOLS_DYNAMIC_MATRIX(Scalar) > DynamicMatrixBlock
 Shorthand for Eigen block. More...
 
typedef DecayedRawMatrix::Scalar Scalar
 Scalar type of raw matrix (from Eigen) More...
 

Public Member Functions

DynamicMatrixBlock column (const std::ptrdiff_t index_col, const std::ptrdiff_t index_row_first, const std::ptrdiff_t index_num_rows)
 Access column of a matrix. More...
 
DynamicMatrixBlock column (const std::ptrdiff_t index_col, const std::ptrdiff_t index_row_first=0)
 Access column of a matrix. More...
 
ConstDynamicMatrixBlock column (const std::ptrdiff_t index_col, const std::ptrdiff_t index_row_first, const std::ptrdiff_t index_num_rows) const
 Access column of a matrix. More...
 
ConstDynamicMatrixBlock column (const std::ptrdiff_t index_col, const std::ptrdiff_t index_row_first=0) const
 Access column of a matrix. More...
 
std::ptrdiff_t getBlockColsNum () const
 Returns dimension of the matrix block. More...
 
std::ptrdiff_t getBlockRowsNum () const
 Returns dimension of the matrix block. More...
 
std::ptrdiff_t getNumberOfBlocksHorizontal () const
 Get number of blocks (horizontal/vertical) More...
 
std::ptrdiff_t getNumberOfBlocksVertical () const
 Get number of blocks (horizontal/vertical) More...
 
std::ptrdiff_t getNumberOfColumns () const
 Get total number of rows / columns. More...
 
std::ptrdiff_t getNumberOfRows () const
 Get total number of rows / columns. More...
 
const DecayedRawMatrixgetRaw () const
 Get raw matrix. More...
 
void resize (const std::ptrdiff_t num_blocks_vert, const std::ptrdiff_t num_blocks_hor)
 Resize matrix. More...
 
void resize (const std::ptrdiff_t num_blocks)
 Resize square matrix. More...
 
DynamicMatrixBlock row (const std::ptrdiff_t index_row, const std::ptrdiff_t index_col_first, const std::ptrdiff_t index_num_cols)
 Access row of a matrix. More...
 
DynamicMatrixBlock row (const std::ptrdiff_t index_row, const std::ptrdiff_t index_col_first=0)
 Access row of a matrix. More...
 
ConstDynamicMatrixBlock row (const std::ptrdiff_t index_row, const std::ptrdiff_t index_col_first, const std::ptrdiff_t index_num_cols) const
 Access row of a matrix. More...
 
ConstDynamicMatrixBlock row (const std::ptrdiff_t index_row, const std::ptrdiff_t index_col_first=0) const
 Access row of a matrix. More...
 
DecayedRawMatrix selectRowInBlocksAsMatrix (const std::ptrdiff_t row_in_a_block)
 Selects rows from the matrix. More...
 
template<class t_Derived >
void set (const Eigen::DenseBase< t_Derived > &matrix)
 Set raw matrix. More...
 
void setBlockSize (const std::ptrdiff_t block_rows_num, const std::ptrdiff_t block_cols_num)
 Returns dimension of the matrix block. More...
 
void setZero (const std::ptrdiff_t num_blocks_vert, const std::ptrdiff_t num_blocks_hor)
 Resize matrix and initialize it with zeros. More...
 
void setZero (const std::ptrdiff_t num_blocks)
 Resize square matrix and set it to zero. More...
 

Protected Member Functions

 BlockMatrixAccessBase (const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
 Default constructor. More...
 
 BlockMatrixAccessBase (const DecayedRawMatrix &matrix, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
 Constructor with matrix initialization. More...
 
 BlockMatrixAccessBase (DecayedRawMatrix &matrix, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
 Constructor with matrix initialization. More...
 
 ~BlockMatrixAccessBase ()
 Protected destructor: prevent destruction of the child classes through a base pointer. More...
 
void finalize ()
 Compute humber of blocks in matrix and check size consistency. More...
 
void initializeBlockSize (const std::ptrdiff_t block_rows_num, const std::ptrdiff_t block_cols_num)
 Compute humber of blocks in matrix and check size consistency. More...
 

Protected Attributes

std::ptrdiff_t block_cols_num_
 
std::ptrdiff_t block_rows_num_
 
t_MatrixType matrix_
 
std::ptrdiff_t num_blocks_hor_
 
std::ptrdiff_t num_blocks_vert_
 

Member Typedef Documentation

◆ ConstDynamicMatrixBlock

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
typedef const Eigen::Block< const EIGENTOOLS_DYNAMIC_MATRIX( Scalar ) > etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::ConstDynamicMatrixBlock

Shorthand for Eigen block.

Definition at line 120 of file blockmatrix_base.h.

◆ DecayedRawMatrix

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
typedef TypeDecayed<t_MatrixType>::Type etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::DecayedRawMatrix

Raw matrix without 'const' and '&'.

Definition at line 111 of file blockmatrix_base.h.

◆ DynamicMatrixBlock

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
typedef Eigen::Block< EIGENTOOLS_DYNAMIC_MATRIX( Scalar ) > etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::DynamicMatrixBlock

Shorthand for Eigen block.

Definition at line 117 of file blockmatrix_base.h.

◆ Scalar

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
typedef DecayedRawMatrix::Scalar etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::Scalar

Scalar type of raw matrix (from Eigen)

Definition at line 114 of file blockmatrix_base.h.

Constructor & Destructor Documentation

◆ ~BlockMatrixAccessBase()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::~BlockMatrixAccessBase ( )
inlineprotected

Protected destructor: prevent destruction of the child classes through a base pointer.

Definition at line 422 of file blockmatrix_base.h.

◆ BlockMatrixAccessBase() [1/3]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::BlockMatrixAccessBase ( const std::ptrdiff_t  block_rows_num = MatrixBlockSizeType::UNDEFINED,
const std::ptrdiff_t  block_cols_num = MatrixBlockSizeType::UNDEFINED 
)
inlineprotected

Default constructor.

Definition at line 428 of file blockmatrix_base.h.

◆ BlockMatrixAccessBase() [2/3]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::BlockMatrixAccessBase ( const DecayedRawMatrix matrix,
const std::ptrdiff_t  block_rows_num = MatrixBlockSizeType::UNDEFINED,
const std::ptrdiff_t  block_cols_num = MatrixBlockSizeType::UNDEFINED 
)
inlineprotected

Constructor with matrix initialization.

Parameters
[in]matrixmatrix
[in]block_rows_numnumber of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
[in]block_cols_numnumber of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC

Definition at line 443 of file blockmatrix_base.h.

◆ BlockMatrixAccessBase() [3/3]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::BlockMatrixAccessBase ( DecayedRawMatrix matrix,
const std::ptrdiff_t  block_rows_num = MatrixBlockSizeType::UNDEFINED,
const std::ptrdiff_t  block_cols_num = MatrixBlockSizeType::UNDEFINED 
)
inlineprotected

Constructor with matrix initialization.

Parameters
[in]matrixmatrix
[in]block_rows_numnumber of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
[in]block_cols_numnumber of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC

Definition at line 460 of file blockmatrix_base.h.

Member Function Documentation

◆ column() [1/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
DynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::column ( const std::ptrdiff_t  index_col,
const std::ptrdiff_t  index_row_first,
const std::ptrdiff_t  index_num_rows 
)
inline

Access column of a matrix.

Parameters
[in]index_colindex of the column
[in]index_row_firstsegment of the column starts at this row
[in]index_num_rowsnumber of blocks
Returns
column or a part of it

Definition at line 238 of file blockmatrix_base.h.

◆ column() [2/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
DynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::column ( const std::ptrdiff_t  index_col,
const std::ptrdiff_t  index_row_first = 0 
)
inline

Access column of a matrix.

Parameters
[in]index_colindex of the column
[in]index_row_firstsegment of the column starts at this row if index_row_first is not specified => return the whole column
Returns
column or a part of it

Definition at line 260 of file blockmatrix_base.h.

◆ column() [3/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
ConstDynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::column ( const std::ptrdiff_t  index_col,
const std::ptrdiff_t  index_row_first,
const std::ptrdiff_t  index_num_rows 
) const
inline

Access column of a matrix.

Parameters
[in]index_colindex of the column
[in]index_row_firstsegment of the column starts at this row
[in]index_num_rowsnumber of blocks
Returns
column or a part of it

Definition at line 268 of file blockmatrix_base.h.

◆ column() [4/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
ConstDynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::column ( const std::ptrdiff_t  index_col,
const std::ptrdiff_t  index_row_first = 0 
) const
inline

Access column of a matrix.

Parameters
[in]index_colindex of the column
[in]index_row_firstsegment of the column starts at this row if index_row_first is not specified => return the whole column
Returns
column or a part of it

Definition at line 281 of file blockmatrix_base.h.

◆ finalize()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::finalize ( )
inlineprotected

Compute humber of blocks in matrix and check size consistency.

Definition at line 504 of file blockmatrix_base.h.

◆ getBlockColsNum()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getBlockColsNum ( ) const
inline

Returns dimension of the matrix block.

Returns
number of rows / columns

Definition at line 384 of file blockmatrix_base.h.

◆ getBlockRowsNum()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getBlockRowsNum ( ) const
inline

Returns dimension of the matrix block.

Returns
number of rows / columns

Definition at line 377 of file blockmatrix_base.h.

◆ getNumberOfBlocksHorizontal()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getNumberOfBlocksHorizontal ( ) const
inline

Get number of blocks (horizontal/vertical)

Returns
number of blocks

Definition at line 136 of file blockmatrix_base.h.

◆ getNumberOfBlocksVertical()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getNumberOfBlocksVertical ( ) const
inline

Get number of blocks (horizontal/vertical)

Returns
number of blocks

Definition at line 129 of file blockmatrix_base.h.

◆ getNumberOfColumns()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getNumberOfColumns ( ) const
inline

Get total number of rows / columns.

Returns
number of rows / columns

Definition at line 155 of file blockmatrix_base.h.

◆ getNumberOfRows()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getNumberOfRows ( ) const
inline

Get total number of rows / columns.

Returns
number of rows / columns

Definition at line 148 of file blockmatrix_base.h.

◆ getRaw()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
const DecayedRawMatrix& etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::getRaw ( ) const
inline

Get raw matrix.

Returns
matrix

Definition at line 353 of file blockmatrix_base.h.

◆ initializeBlockSize()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::initializeBlockSize ( const std::ptrdiff_t  block_rows_num,
const std::ptrdiff_t  block_cols_num 
)
inlineprotected

Compute humber of blocks in matrix and check size consistency.

Definition at line 474 of file blockmatrix_base.h.

◆ resize() [1/2]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::resize ( const std::ptrdiff_t  num_blocks_vert,
const std::ptrdiff_t  num_blocks_hor 
)
inline

Resize matrix.

Parameters
[in]num_blocks_vert
[in]num_blocks_hor

Definition at line 182 of file blockmatrix_base.h.

◆ resize() [2/2]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::resize ( const std::ptrdiff_t  num_blocks)
inline

Resize square matrix.

Parameters
[in]num_blocksnumber of diagonal blocks

Definition at line 211 of file blockmatrix_base.h.

◆ row() [1/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
DynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::row ( const std::ptrdiff_t  index_row,
const std::ptrdiff_t  index_col_first,
const std::ptrdiff_t  index_num_cols 
)
inline

Access row of a matrix.

Parameters
[in]index_rowindex of the row
[in]index_col_firstsegment of the row starts at this column
[in]index_num_colsnumber of blocks
Returns
row or a part of it

Definition at line 297 of file blockmatrix_base.h.

◆ row() [2/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
DynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::row ( const std::ptrdiff_t  index_row,
const std::ptrdiff_t  index_col_first = 0 
)
inline

Access row of a matrix.

Parameters
[in]index_rowindex of the row
[in]index_col_firstsegment of the row starts at this column if index_col_first is not specified => return the whole row
Returns
row or a part of it

Definition at line 319 of file blockmatrix_base.h.

◆ row() [3/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
ConstDynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::row ( const std::ptrdiff_t  index_row,
const std::ptrdiff_t  index_col_first,
const std::ptrdiff_t  index_num_cols 
) const
inline

Access row of a matrix.

Parameters
[in]index_rowindex of the row
[in]index_col_firstsegment of the row starts at this column
[in]index_num_colsnumber of blocks
Returns
row or a part of it

Definition at line 327 of file blockmatrix_base.h.

◆ row() [4/4]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
ConstDynamicMatrixBlock etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::row ( const std::ptrdiff_t  index_row,
const std::ptrdiff_t  index_col_first = 0 
) const
inline

Access row of a matrix.

Parameters
[in]index_rowindex of the row
[in]index_col_firstsegment of the row starts at this column if index_col_first is not specified => return the whole row
Returns
row or a part of it

Definition at line 340 of file blockmatrix_base.h.

◆ selectRowInBlocksAsMatrix()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
DecayedRawMatrix etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::selectRowInBlocksAsMatrix ( const std::ptrdiff_t  row_in_a_block)
inline

Selects rows from the matrix.

Parameters
[in]row_in_a_blockrow number in a block
Returns
selected rows

Definition at line 366 of file blockmatrix_base.h.

◆ set()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
template<class t_Derived >
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::set ( const Eigen::DenseBase< t_Derived > &  matrix)
inline

Set raw matrix.

Template Parameters
t_DerivedEigen parameter
Parameters
[in]matrix

Definition at line 169 of file blockmatrix_base.h.

◆ setBlockSize()

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::setBlockSize ( const std::ptrdiff_t  block_rows_num,
const std::ptrdiff_t  block_cols_num 
)
inline

Returns dimension of the matrix block.

Returns
number of rows / columns

Definition at line 395 of file blockmatrix_base.h.

◆ setZero() [1/2]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::setZero ( const std::ptrdiff_t  num_blocks_vert,
const std::ptrdiff_t  num_blocks_hor 
)
inline

Resize matrix and initialize it with zeros.

Parameters
[in]num_blocks_vert
[in]num_blocks_hor

Definition at line 197 of file blockmatrix_base.h.

◆ setZero() [2/2]

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
void etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::setZero ( const std::ptrdiff_t  num_blocks)
inline

Resize square matrix and set it to zero.

Parameters
[in]num_blocksnumber of diagonal blocks

Definition at line 222 of file blockmatrix_base.h.

Member Data Documentation

◆ block_cols_num_

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::block_cols_num_
protected

Definition at line 414 of file blockmatrix_base.h.

◆ block_rows_num_

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::block_rows_num_
protected

Definition at line 413 of file blockmatrix_base.h.

◆ matrix_

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
t_MatrixType etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::matrix_
protected

Definition at line 408 of file blockmatrix_base.h.

◆ num_blocks_hor_

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::num_blocks_hor_
protected

Definition at line 411 of file blockmatrix_base.h.

◆ num_blocks_vert_

template<typename t_MatrixType, int t_block_rows_num, int t_block_cols_num>
std::ptrdiff_t etools::BlockMatrixAccessBase< t_MatrixType, t_block_rows_num, t_block_cols_num >::num_blocks_vert_
protected

Definition at line 410 of file blockmatrix_base.h.


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