Indexed view should have RowMajorBit when there is staticly a single row

This commit is contained in:
Christopher Moore 2020-05-14 22:11:19 +00:00 committed by Rasmus Munk Larsen
parent a187ffea28
commit fa8fd4b4d5
2 changed files with 9 additions and 1 deletions

View File

@ -171,7 +171,9 @@ struct unary_evaluator<IndexedView<ArgType, RowIndices, ColIndices>, IndexBased>
FlagsLinearAccessBit = (traits<XprType>::RowsAtCompileTime == 1 || traits<XprType>::ColsAtCompileTime == 1) ? LinearAccessBit : 0,
Flags = (evaluator<ArgType>::Flags & (HereditaryBits /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit,
FlagsRowMajorBit = traits<XprType>::FlagsRowMajorBit,
Flags = (evaluator<ArgType>::Flags & (HereditaryBits & ~RowMajorBit /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit | FlagsRowMajorBit,
Alignment = 0
};

View File

@ -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<decltype( A(1,seq(0,2,1)) )>::Flags & RowMajorBit) == RowMajorBit ));
}
}
EIGEN_DECLARE_TEST(indexed_view)