12 #ifndef BOGUS_BLOCKMATRIX_HPP
13 #define BOGUS_BLOCKMATRIX_HPP
15 #include "IterableBlockObject.hpp"
21 template <
typename Derived >
26 typedef typename Traits::Index Index ;
27 typedef typename Traits::Scalar Scalar ;
30 typedef typename Traits::BlockType BlockType ;
31 typedef typename Traits::BlockPtr BlockPtr ;
32 typedef typename Traits::BlocksArrayType BlocksArrayType ;
52 template <
typename RhsT,
typename ResT >
55 derived().splitRowMultiply( row, rhs, res ) ;
59 BlockPtr
blockPtr( Index row, Index col )
const
61 return derived().blockPtr( row, col ) ;
66 return derived().diagonalBlockPtr( row ) ;
70 const BlockType&
block( BlockPtr ptr )
const
75 BlockType&
block( BlockPtr ptr )
81 Index
rows()
const {
return m_rows ; }
83 Index
cols()
const {
return m_cols ; }
89 const typename Traits::BlocksArrayType&
blocks()
const {
return m_blocks ; }
91 const BlockType*
data()
const {
return data_pointer(m_blocks) ; }
93 BlockType*
data() {
return data_pointer(m_blocks) ; }
99 const BlockType&
diagonal(
const Index row )
const
103 BlockType&
block( Index row, Index col )
106 const BlockType&
block( Index row, Index col )
const
111 template <
typename Func>
113 {
derived().template eachBlockOf<false, Func>(row, func) ; }
116 template <
typename Func>
118 {
derived().template eachBlockOf<true ,Func>(col, func) ; }
123 RowsPerBlock = Traits::RowsPerBlock,
124 ColsPerBlock = Traits::ColsPerBlock,
126 has_square_or_dynamic_blocks = ColsPerBlock == RowsPerBlock,
127 has_fixed_rows_blocks = ((int) RowsPerBlock != internal::DYNAMIC ),
128 has_fixed_cols_blocks = ((int) ColsPerBlock != internal::DYNAMIC ),
129 has_fixed_size_blocks = has_fixed_cols_blocks && has_fixed_rows_blocks
136 BlocksArrayType m_blocks ;
141 #endif // BLOCKMATRIX_HPP
const Traits::BlocksArrayType & blocks() const
Access to blocks data.
Definition: BlockMatrixBase.hpp:89
Base class for dense and sparse block matrices, thought dense don't exist yet.
Definition: BlockMatrixBase.hpp:22
Definition: Traits.hpp:19
const Derived & derived() const
Returns a const reference to the implementation.
Definition: BlockObjectBase.hpp:25
BlockPtr diagonalBlockPtr(Index row) const
Return a BlockPtr to the block a (row, row) or InvalidBlockPtr if it does not exist.
Definition: BlockMatrixBase.hpp:64
Index cols() const
Returns the total number of columns of the matrix ( expanding blocks )
Definition: BlockMatrixBase.hpp:83
void splitRowMultiply(const Index row, const RhsT &rhs, ResT &res) const
Multiplies a given block-row of the matrix with rhs, omitting the diagonal block. ...
Definition: BlockMatrixBase.hpp:53
void eachBlockOfCol(const Index col, Func func) const
Iterates over each block of a given col. Calls func( row, block )
Definition: BlockMatrixBase.hpp:117
BlockType & block(BlockPtr ptr)
Returns a reference to a block using the result from blockPtr() or diagonalBlockPtr() ...
Definition: BlockMatrixBase.hpp:75
Base class for matrix-like objects that define a block structure, but not a block type...
Definition: IterableBlockObject.hpp:22
const BlockType & block(BlockPtr ptr) const
Returns a reference to a block using the result from blockPtr() or diagonalBlockPtr() ...
Definition: BlockMatrixBase.hpp:70
BlockPtr blockPtr(Index row, Index col) const
Return a BlockPtr to the block a (row, col) or InvalidBlockPtr if it does not exist.
Definition: BlockMatrixBase.hpp:59
const BlockType & block(Index row, Index col) const
Definition: BlockMatrixBase.hpp:106
BlockType & diagonal(const Index row)
Definition: BlockMatrixBase.hpp:96
static const BlockPtr InvalidBlockPtr
Return value of blockPtr( Index, Index ) for non-existing block.
Definition: BlockMatrixBase.hpp:38
Index rows() const
Returns the total number of rows of the matrix ( expanding blocks )
Definition: BlockMatrixBase.hpp:81
Definition: Traits.hpp:29
const BlockType & diagonal(const Index row) const
Definition: BlockMatrixBase.hpp:99
const BlockType * data() const
Access to blocks data as a raw pointer.
Definition: BlockMatrixBase.hpp:91
void eachBlockOfRow(const Index row, Func func) const
Iterates over each block of a given row. Calls func( col, block )
Definition: BlockMatrixBase.hpp:112
BlockType * data()
Access to blocks data as a raw pointer.
Definition: BlockMatrixBase.hpp:93
BlockType & block(Index row, Index col)
Definition: BlockMatrixBase.hpp:103
Index size() const
Returns the total number of blocks of the matrix.
CompileTimeProperties
Compile-time block properties.
Definition: BlockMatrixBase.hpp:121