diff --git a/Eigen/src/Core/IndexedView.h b/Eigen/src/Core/IndexedView.h index 51e28b9c3..d27ec8037 100644 --- a/Eigen/src/Core/IndexedView.h +++ b/Eigen/src/Core/IndexedView.h @@ -23,8 +23,8 @@ struct traits > enum { RowsAtCompileTime = int(array_size::value), ColsAtCompileTime = int(array_size::value), - MaxRowsAtCompileTime = RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : Dynamic, - MaxColsAtCompileTime = ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : Dynamic, + MaxRowsAtCompileTime = RowsAtCompileTime, + MaxColsAtCompileTime = ColsAtCompileTime, XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 @@ -44,8 +44,8 @@ struct traits > IsBlockAlike = InnerIncr==1 && OuterIncr==1, IsInnerPannel = HasSameStorageOrderAsXprType && is_same,typename conditional::type>::value, - InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic ? Dynamic : XprInnerStride * InnerIncr, - OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic ? Dynamic : XprOuterstride * OuterIncr, + InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic || InnerIncr==UndefinedIncr ? Dynamic : XprInnerStride * InnerIncr, + OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic || OuterIncr==UndefinedIncr ? Dynamic : XprOuterstride * OuterIncr, ReturnAsScalar = is_same::value && is_same::value, ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike, diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp index b9a7acca9..a3b336c3f 100644 --- a/test/indexed_view.cpp +++ b/test/indexed_view.cpp @@ -414,6 +414,18 @@ void check_indexed_view() VERIFY( MATCH( A(all,1)(1), "101")); } +#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE + // bug #2375: indexing over matrices of dim >128 should compile on gcc + { + Matrix large_mat = Matrix::Random(); + std::array test_indices = {0, 1}; + Matrix thin_slice = large_mat(all, test_indices); + for(int col = 0; col < int(test_indices.size()); ++col) + for(int row = 0; row < large_mat.rows(); ++row) + VERIFY_IS_EQUAL( thin_slice(row, col), large_mat(row, col) ); + } +#endif + //Bug IndexView with a single static row should be RowMajor: { // A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval();