diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index 5f1dc8477..311cb5a3d 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -43,6 +43,8 @@ template class NestByValue public: typedef typename internal::dense_xpr_base::type Base; + static constexpr bool HasDirectAccess = internal::has_direct_access::ret; + EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} @@ -54,6 +56,18 @@ template class NestByValue EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } + EIGEN_DEVICE_FUNC typename std::enable_if::type data() const { + return m_expression.data(); + } + + EIGEN_DEVICE_FUNC typename std::enable_if::type innerStride() const { + return m_expression.innerStride(); + } + + EIGEN_DEVICE_FUNC typename std::enable_if::type outerStride() const { + return m_expression.outerStride(); + } + protected: const ExpressionType m_expression; }; diff --git a/test/nestbyvalue.cpp b/test/nestbyvalue.cpp index 3a86bea50..c25f0bf0b 100644 --- a/test/nestbyvalue.cpp +++ b/test/nestbyvalue.cpp @@ -33,5 +33,7 @@ EIGEN_DECLARE_TEST(nestbyvalue) MatrixXd b = x; VERIFY_IS_EQUAL(nb_temporaries,6+1); VERIFY_IS_APPROX(b, a.rowwise().reverse().eval() + (a+a).eval()); + // Block expressions work with dense NestByValue. + VERIFY_IS_APPROX(b, a.nestByValue().rowwise().reverse().eval() + (a.nestByValue()+a.nestByValue()).eval()); } }