aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-10-14 10:12:58 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-10-14 10:12:58 +0200
commit2598f3987edc704d9c95e1c207d3533e26314ca0 (patch)
tree54bc135033df686b293b6e4fcde298c2ccad560c /Eigen/src/Core
parentb4c79ee1d3d7b44e58f2bea48cd597aa0fa7e007 (diff)
Add a plain_object_eval<> helper returning a plain object type based on evaluator's Flags,
and base nested_eval on it.
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/util/XprHelper.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index c85a6be80..624d8a83b 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -233,33 +233,33 @@ template<typename XprType> struct size_of_xpr_at_compile_time
*/
template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct plain_matrix_type;
-template<typename T, typename BaseClassType> struct plain_matrix_type_dense;
+template<typename T, typename BaseClassType, int Flags> struct plain_matrix_type_dense;
template<typename T> struct plain_matrix_type<T,Dense>
{
- typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind>::type type;
+ typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind, traits<T>::Flags>::type type;
};
template<typename T> struct plain_matrix_type<T,DiagonalShape>
{
typedef typename T::PlainObject type;
};
-template<typename T> struct plain_matrix_type_dense<T,MatrixXpr>
+template<typename T, int Flags> struct plain_matrix_type_dense<T,MatrixXpr,Flags>
{
typedef Matrix<typename traits<T>::Scalar,
traits<T>::RowsAtCompileTime,
traits<T>::ColsAtCompileTime,
- AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ AutoAlign | (Flags&RowMajorBit ? RowMajor : ColMajor),
traits<T>::MaxRowsAtCompileTime,
traits<T>::MaxColsAtCompileTime
> type;
};
-template<typename T> struct plain_matrix_type_dense<T,ArrayXpr>
+template<typename T, int Flags> struct plain_matrix_type_dense<T,ArrayXpr,Flags>
{
typedef Array<typename traits<T>::Scalar,
traits<T>::RowsAtCompileTime,
traits<T>::ColsAtCompileTime,
- AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ AutoAlign | (Flags&RowMajorBit ? RowMajor : ColMajor),
traits<T>::MaxRowsAtCompileTime,
traits<T>::MaxColsAtCompileTime
> type;
@@ -303,6 +303,15 @@ struct eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
};
+/* similar to plain_matrix_type, but using the evaluator's Flags */
+template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct plain_object_eval;
+
+template<typename T>
+struct plain_object_eval<T,Dense>
+{
+ typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind, evaluator<T>::Flags>::type type;
+};
+
/* plain_matrix_type_column_major : same as plain_matrix_type but guaranteed to be column-major
*/
@@ -385,7 +394,7 @@ struct transfer_constness
* \param n the number of coefficient accesses in the nested expression for each coefficient access in the bigger expression.
* \param PlainObject the type of the temporary if needed.
*/
-template<typename T, int n, typename PlainObject = typename eval<T>::type> struct nested_eval
+template<typename T, int n, typename PlainObject = typename plain_object_eval<T>::type> struct nested_eval
{
enum {
// For the purpose of this test, to keep it reasonably simple, we arbitrarily choose a value of Dynamic values.