diff --git a/Eigen/src/plugins/ReshapedMethods.h b/Eigen/src/plugins/ReshapedMethods.h index 3a1b20301..fc7cdcfa7 100644 --- a/Eigen/src/plugins/ReshapedMethods.h +++ b/Eigen/src/plugins/ReshapedMethods.h @@ -73,8 +73,15 @@ reshaped(NRowsType nRows, NColsType nCols, OrderType) const // Views as linear vectors EIGEN_DEVICE_FUNC -inline const Reshaped +inline const Reshaped operator()(const Eigen::internal::all_t&) +{ + return Reshaped(derived(),size(),1); +} + +EIGEN_DEVICE_FUNC +inline const Reshaped +operator()(const Eigen::internal::all_t&) const { return Reshaped(derived(),size(),1); } diff --git a/test/reshape.cpp b/test/reshape.cpp index 40d98ca1f..a38f5e098 100644 --- a/test/reshape.cpp +++ b/test/reshape.cpp @@ -10,6 +10,13 @@ #include "main.h" +template +typename internal::enable_if::value,bool>::type +is_same_eq(const T1& a, const T2& b) +{ + return (a.array() == b.array()).all(); +} + // just test a 4x4 matrix, enumerate all combination manually template void reshape4x4(MatType m) @@ -75,6 +82,7 @@ void reshape4x4(MatType m) VERIFY_IS_EQUAL( m28r1, m28r2); using placeholders::all; + VERIFY(is_same_eq(m.reshaped(fix(m.size()),fix<1>), m(all))); VERIFY_IS_EQUAL(m.reshaped(16,1), m(all)); VERIFY_IS_EQUAL(m.reshaped(1,16), m(all).transpose()); VERIFY_IS_EQUAL(m(all).reshaped(2,8), m.reshaped(2,8));