diff --git a/Eigen/src/Core/Reshaped.h b/Eigen/src/Core/Reshaped.h index c90e61f2c..81355ace5 100644 --- a/Eigen/src/Core/Reshaped.h +++ b/Eigen/src/Core/Reshaped.h @@ -251,7 +251,7 @@ class ReshapedImpl_dense EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { - return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows(); + return (((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows()) * m_xpr.innerStride(); } protected: diff --git a/test/reshape.cpp b/test/reshape.cpp index d248f01cb..ca7a73e61 100644 --- a/test/reshape.cpp +++ b/test/reshape.cpp @@ -196,6 +196,24 @@ void reshape4x4(MatType m) } } +template +void reshape_block(const BlockType& M) { + auto dense = M.eval(); + Index rows = M.size() / 2; + Index cols = M.size() / rows; + VERIFY_IS_EQUAL(dense.reshaped(rows, cols), M.reshaped(rows, cols)); + + for (Index i=0; i RowMatrixXi; @@ -216,4 +234,5 @@ EIGEN_DECLARE_TEST(reshape) CALL_SUBTEST(reshape4x4(rmx)); CALL_SUBTEST(reshape4x4(rm4)); + CALL_SUBTEST(reshape_block(rm4.col(1))); }