11 #ifndef BOGUS_BLOCK_DYNAMIC_EXPRESSIONS_HPP
12 #define BOGUS_BLOCK_DYNAMIC_EXPRESSIONS_HPP
14 #include "Expressions.hpp"
15 #include "DynamicExpressions.hpp"
23 template <
typename Expression>
29 typedef typename Traits::Index Index ;
30 typedef typename Base::Scalar Scalar ;
33 typedef std::list< Scaling< Expression > > Sum ;
36 NarySum(
const Index rows,
const Index cols )
37 : m_rows( rows ), m_cols( cols )
40 NarySum (
const Expression &expr )
41 : m_rows( expr.rows() ), m_cols( expr.cols() )
46 : m_rows( expr.rows() ), m_cols( expr.cols() )
53 assert( expr.rows() == m_rows && expr.cols() == m_cols ) ;
54 members.push_back( expr ) ;
63 NarySum &operator+=(
const Expression &expr )
68 NarySum &operator-=(
const Expression &expr )
75 assert( other.rows() == m_rows && other.cols() == m_cols ) ;
76 members.insert( members.begin(), other.members.begin(), other.members.end() ) ;
82 assert( other.rows() == m_rows && other.cols() == m_cols ) ;
83 for(
typename Sum::const_iterator it = other.members.begin() ; it != other.members.end() ; ++ it )
92 for(
typename Sum::const_iterator it = members.begin() ; it != members.end() ; ++ it )
94 transposed_sum += it->transpose() ;
97 return transposed_sum ;
100 template <
bool DoTranspose,
typename RhsT,
typename ResT >
101 void multiply(
const RhsT& rhs, ResT& res, Scalar alpha = 1, Scalar beta = 0 )
const ;
103 bool empty()
const {
return members.begin() == members.end() ; }
105 Index rows()
const {
return m_rows ; }
106 Index cols()
const {
return m_cols ; }
108 Index rowsOfBlocks()
const { assert(!empty()) ;
return members.front().colsOfBlocks() ; }
109 Index colsOfBlocks()
const { assert(!empty()) ;
return members.front().rowsOfBlocks() ; }
110 Index blockRows( Index row )
const { assert(!empty()) ;
return members.front().blockCols( row ) ; }
111 Index blockCols( Index col )
const { assert(!empty()) ;
return members.front().blockRows( col ) ; }
112 const Index *rowOffsets( )
const { assert(!empty()) ;
return members.front().colOffsets( ) ; }
113 const Index *colOffsets( )
const { assert(!empty()) ;
return members.front().rowOffsets( ) ; }
121 template <
typename Expression>
129 typedef typename Expression::PlainObjectType PlainObjectType ;
Definition: Traits.hpp:19
Definition: Expressions.hpp:268
Base class for anything block.
Definition: BlockObjectBase.hpp:22
Sum of n similar expressions.
Definition: DynamicExpressions.hpp:24
Definition: DynamicExpressions.hpp:122