diff options
author | 2011-04-13 09:49:10 +0100 | |
---|---|---|
committer | 2011-04-13 09:49:10 +0100 | |
commit | 7e863248987b06440742b1a02feaeb35cb1d75b6 (patch) | |
tree | 036e58c303a1dd18eef80368a4c48fb37d4bb730 /Eigen | |
parent | 11164830f54d0a8db32f1274f9c971115b5b2eee (diff) |
Implement evaluator for PartialReduxExpr as a dumb wrapper.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/CoreEvaluators.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index ef6913add..db6faca10 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -665,6 +665,39 @@ protected: }; +// -------------------- PartialReduxExpr -------------------- +// +// This is a wrapper around the expression object. +// TODO: Find out how to write a proper evaluator without duplicating +// the row() and col() member functions. + +template< typename XprType, typename MemberOp, int Direction> +struct evaluator_impl<PartialReduxExpr<XprType, MemberOp, Direction> > +{ + typedef PartialReduxExpr<XprType, MemberOp, Direction> PartialReduxExprType; + + evaluator_impl(const PartialReduxExprType expr) + : m_expr(expr) + { } + + typedef typename PartialReduxExprType::Index Index; + typedef typename PartialReduxExprType::CoeffReturnType CoeffReturnType; + + CoeffReturnType coeff(Index row, Index col) const + { + return m_expr.coeff(row, col); + } + + CoeffReturnType coeff(Index index) const + { + return m_expr.coeff(index); + } + +protected: + const PartialReduxExprType& m_expr; +}; + + } // namespace internal #endif // EIGEN_COREEVALUATORS_H |