Implement evaluators for sparse Block.

This commit is contained in:
Gael Guennebaud
2014-06-25 09:58:26 +02:00
parent 17f119689e
commit e3ba5329ff
5 changed files with 175 additions and 7 deletions

View File

@@ -122,6 +122,8 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> class
typedef Impl Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(Block)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
typedef typename internal::remove_all<XprType>::type NestedExpression;
/** Column or Row constructor
*/

View File

@@ -737,13 +737,25 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
evaluator(const XprType& block) : block_evaluator_type(block) {}
};
// no direct-access => dispatch to a unary evaluator
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAccess*/ false>
: evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
: unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
{
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
block_evaluator(const XprType& block)
: unary_evaluator<XprType>(block)
{}
};
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBased>
: evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
{
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
unary_evaluator(const XprType& block)
: m_argImpl(block.nestedExpression()),
m_startRow(block.startRow()),
m_startCol(block.startCol())