mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
fix nesting in Arraywrapper and nesting_ops
This commit is contained in:
parent
905050b239
commit
71e580c4aa
@ -36,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
template<typename ExpressionType>
|
template<typename ExpressionType>
|
||||||
struct ei_traits<ArrayWrapper<ExpressionType> >
|
struct ei_traits<ArrayWrapper<ExpressionType> >
|
||||||
: public ei_traits<ExpressionType>
|
: public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
|
||||||
{
|
{
|
||||||
typedef DenseStorageArray DenseStorageType;
|
typedef DenseStorageArray DenseStorageType;
|
||||||
};
|
};
|
||||||
@ -49,6 +49,8 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
|
|||||||
EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
|
EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
|
||||||
|
|
||||||
|
typedef typename ei_nested<ExpressionType>::type NestedExpressionType;
|
||||||
|
|
||||||
inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
|
inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
|
||||||
|
|
||||||
inline int rows() const { return m_expression.rows(); }
|
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; }
|
inline void evalTo(Dest& dst) const { dst = m_expression; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const ExpressionType& m_expression;
|
const NestedExpressionType m_expression;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \class MatrixWrapper
|
/** \class MatrixWrapper
|
||||||
@ -118,7 +120,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
|
|||||||
|
|
||||||
template<typename ExpressionType>
|
template<typename ExpressionType>
|
||||||
struct ei_traits<MatrixWrapper<ExpressionType> >
|
struct ei_traits<MatrixWrapper<ExpressionType> >
|
||||||
: public ei_traits<ExpressionType>
|
: public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
|
||||||
{
|
{
|
||||||
typedef DenseStorageMatrix DenseStorageType;
|
typedef DenseStorageMatrix DenseStorageType;
|
||||||
};
|
};
|
||||||
@ -131,6 +133,8 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
|
|||||||
EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
|
EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper);
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper);
|
||||||
|
|
||||||
|
typedef typename ei_nested<ExpressionType>::type NestedExpressionType;
|
||||||
|
|
||||||
inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
|
inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
|
||||||
|
|
||||||
inline int rows() const { return m_expression.rows(); }
|
inline int rows() const { return m_expression.rows(); }
|
||||||
@ -182,7 +186,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const ExpressionType& m_expression;
|
const NestedExpressionType& m_expression;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EIGEN_ARRAYWRAPPER_H
|
#endif // EIGEN_ARRAYWRAPPER_H
|
||||||
|
@ -96,5 +96,6 @@ void test_inverse()
|
|||||||
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
|
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
|
||||||
s = ei_random<int>(25,100);
|
s = ei_random<int>(25,100);
|
||||||
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );
|
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );
|
||||||
|
CALL_SUBTEST_7( inverse(Matrix4d()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
|
|
||||||
#include "main.h"
|
#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;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user