diff --git a/Eigen/src/Array/ArrayWrapper.h b/Eigen/src/Array/ArrayWrapper.h index 9b7c83951..75bc33770 100644 --- a/Eigen/src/Array/ArrayWrapper.h +++ b/Eigen/src/Array/ArrayWrapper.h @@ -36,7 +36,7 @@ */ template struct ei_traits > - : public ei_traits + : public ei_traits::type > { typedef DenseStorageArray DenseStorageType; }; @@ -49,6 +49,8 @@ class ArrayWrapper : public ArrayBase > EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename ei_nested::type NestedExpressionType; + inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} inline int rows() const { return m_expression.rows(); } @@ -103,7 +105,7 @@ class ArrayWrapper : public ArrayBase > inline void evalTo(Dest& dst) const { dst = m_expression; } protected: - const ExpressionType& m_expression; + const NestedExpressionType m_expression; }; /** \class MatrixWrapper @@ -118,7 +120,7 @@ class ArrayWrapper : public ArrayBase > template struct ei_traits > - : public ei_traits + : public ei_traits::type > { typedef DenseStorageMatrix DenseStorageType; }; @@ -131,6 +133,8 @@ class MatrixWrapper : public MatrixBase > EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper); + typedef typename ei_nested::type NestedExpressionType; + inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} inline int rows() const { return m_expression.rows(); } @@ -182,7 +186,7 @@ class MatrixWrapper : public MatrixBase > } protected: - const ExpressionType& m_expression; + const NestedExpressionType& m_expression; }; #endif // EIGEN_ARRAYWRAPPER_H diff --git a/test/inverse.cpp b/test/inverse.cpp index b80e139e0..713caf4a6 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp @@ -96,5 +96,6 @@ void test_inverse() CALL_SUBTEST_5( inverse(MatrixXf(s,s)) ); s = ei_random(25,100); CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) ); + CALL_SUBTEST_7( inverse(Matrix4d()) ); } } diff --git a/test/nesting_ops.cpp b/test/nesting_ops.cpp index 565bc3644..831c71da7 100644 --- a/test/nesting_ops.cpp +++ b/test/nesting_ops.cpp @@ -24,8 +24,9 @@ #include "main.h" -template void run_nesting_ops(const MatrixType& m) +template void run_nesting_ops(const MatrixType& _m) { + typename MatrixType::Nested m(_m); typedef typename MatrixType::Scalar Scalar; #ifdef NDEBUG @@ -38,7 +39,7 @@ template void run_nesting_ops(const MatrixType& m) // inlining for these tests to pass. VERIFY(is_debug); - // The only intention of these tests is to ensure that this code does + // The only intention of these tests is to ensure that this code does // not trigger any asserts or segmentation faults... more to come. VERIFY( (m.transpose() * m).diagonal().sum() == (m.transpose() * m).diagonal().sum() ); VERIFY( (m.transpose() * m).diagonal().array().abs().sum() == (m.transpose() * m).diagonal().array().abs().sum() );