From 311c5b87a3cba60dd83273212228b5ce800d398c Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 6 Apr 2012 00:22:13 +0200 Subject: [PATCH] Replicate now makes use of the cost model to evaluate its nested expression --- Eigen/src/Core/Replicate.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/Replicate.h b/Eigen/src/Core/Replicate.h index 5dc8fccaf..79882ea43 100644 --- a/Eigen/src/Core/Replicate.h +++ b/Eigen/src/Core/Replicate.h @@ -48,7 +48,10 @@ struct traits > typedef typename MatrixType::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - typedef typename nested::type MatrixTypeNested; + enum { + Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor + }; + typedef typename nested::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; enum { RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic @@ -72,6 +75,8 @@ struct traits > template class Replicate : public internal::dense_xpr_base< Replicate >::type { + typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; + typedef typename internal::traits::_MatrixTypeNested _MatrixTypeNested; public: typedef typename internal::dense_xpr_base::type Base; @@ -122,13 +127,13 @@ template class Replicate return m_matrix.template packet(actual_row, actual_col); } - const typename internal::remove_all::type& nestedExpression() const + const _MatrixTypeNested& nestedExpression() const { return m_matrix; } protected: - typename MatrixType::Nested m_matrix; + MatrixTypeNested m_matrix; const internal::variable_if_dynamic m_rowFactor; const internal::variable_if_dynamic m_colFactor; };