From 3900dbc3417a2968826498f30b5efce06546d180 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 27 Dec 2016 16:35:45 +0100 Subject: [PATCH] Make sure that traits::Flags reports the correct storage order so that methods like .outerSize()/.innerSize() work properly. (grafted from d32a43e33a01631745aa4c0e450153f2f3ac6b9e ) --- Eigen/src/Core/CwiseBinaryOp.h | 2 +- Eigen/src/Core/util/XprHelper.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 9ddbfe286..a36765e39 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -46,7 +46,7 @@ struct traits > typedef typename remove_reference::type _LhsNested; typedef typename remove_reference::type _RhsNested; enum { - Flags = _LhsNested::Flags & RowMajorBit + Flags = cwise_promote_storage_order::StorageKind,typename traits::StorageKind,_LhsNested::Flags & RowMajorBit,_RhsNested::Flags & RowMajorBit>::value }; }; } // end namespace internal diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index efd179b35..e88510dc7 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -532,6 +532,15 @@ template struct cwise_promote_s template struct cwise_promote_storage_type { typedef Sparse ret; }; template struct cwise_promote_storage_type { typedef Sparse ret; }; +template struct cwise_promote_storage_order { + enum { value = LhsOrder }; +}; + +template struct cwise_promote_storage_order { enum { value = RhsOrder }; }; +template struct cwise_promote_storage_order { enum { value = LhsOrder }; }; +template struct cwise_promote_storage_order { enum { value = Order }; }; + + /** \internal Specify the "storage kind" of multiplying an expression of kind A with kind B. * The template parameter ProductTag permits to specialize the resulting storage kind wrt to * some compile-time properties of the product: GemmProduct, GemvProduct, OuterProduct, InnerProduct.