aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-02-09 16:38:36 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-02-09 16:38:36 +0100
commit71e580c4aa1f321aa453add4a279ee8d31914590 (patch)
tree1c172687092989b407d8788d03bea5dcf391d601
parent905050b2392681ffb9b0f98b9fd6e738a562ae76 (diff)
fix nesting in Arraywrapper and nesting_ops
-rw-r--r--Eigen/src/Array/ArrayWrapper.h12
-rw-r--r--test/inverse.cpp1
-rw-r--r--test/nesting_ops.cpp5
3 files changed, 12 insertions, 6 deletions
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<typename ExpressionType>
struct ei_traits<ArrayWrapper<ExpressionType> >
- : public ei_traits<ExpressionType>
+ : public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
{
typedef DenseStorageArray DenseStorageType;
};
@@ -49,6 +49,8 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
+ typedef typename ei_nested<ExpressionType>::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<ArrayWrapper<ExpressionType> >
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<ArrayWrapper<ExpressionType> >
template<typename ExpressionType>
struct ei_traits<MatrixWrapper<ExpressionType> >
- : public ei_traits<ExpressionType>
+ : public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
{
typedef DenseStorageMatrix DenseStorageType;
};
@@ -131,6 +133,8 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper);
+ typedef typename ei_nested<ExpressionType>::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<MatrixWrapper<ExpressionType> >
}
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<int>(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 <typename MatrixType> void run_nesting_ops(const MatrixType& m)
+template <typename MatrixType> void run_nesting_ops(const MatrixType& _m)
{
+ typename MatrixType::Nested m(_m);
typedef typename MatrixType::Scalar Scalar;
#ifdef NDEBUG
@@ -38,7 +39,7 @@ template <typename MatrixType> 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() );