From fa8fd4b4d57323384644394c651ca106d299695f Mon Sep 17 00:00:00 2001 From: Christopher Moore Date: Thu, 14 May 2020 22:11:19 +0000 Subject: [PATCH] Indexed view should have RowMajorBit when there is staticly a single row --- Eigen/src/Core/IndexedView.h | 4 +++- test/indexed_view.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/IndexedView.h b/Eigen/src/Core/IndexedView.h index 5c2c72496a..08476251d3 100644 --- a/Eigen/src/Core/IndexedView.h +++ b/Eigen/src/Core/IndexedView.h @@ -171,7 +171,9 @@ struct unary_evaluator, IndexBased> FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1) ? LinearAccessBit : 0, - Flags = (evaluator::Flags & (HereditaryBits /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit, + FlagsRowMajorBit = traits::FlagsRowMajorBit, + + Flags = (evaluator::Flags & (HereditaryBits & ~RowMajorBit /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit | FlagsRowMajorBit, Alignment = 0 }; diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp index 1dff972d2d..3ac6706efe 100644 --- a/test/indexed_view.cpp +++ b/test/indexed_view.cpp @@ -439,6 +439,12 @@ void check_indexed_view() VERIFY( MATCH( A(all,1)(1), "101")); } + //Bug IndexView with a single static row should be RowMajor: + { + // A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval(); + STATIC_CHECK(( (internal::evaluator::Flags & RowMajorBit) == RowMajorBit )); + } + } EIGEN_DECLARE_TEST(indexed_view)