aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Eigen/src/plugins/ReshapedMethods.h9
-rw-r--r--test/reshape.cpp8
2 files changed, 16 insertions, 1 deletions
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,9 +73,16 @@ reshaped(NRowsType nRows, NColsType nCols, OrderType) const
// Views as linear vectors
EIGEN_DEVICE_FUNC
-inline const Reshaped<const Derived,SizeAtCompileTime,1>
+inline const Reshaped<Derived,SizeAtCompileTime,1>
operator()(const Eigen::internal::all_t&)
{
+ return Reshaped<Derived,SizeAtCompileTime,1>(derived(),size(),1);
+}
+
+EIGEN_DEVICE_FUNC
+inline const Reshaped<const Derived,SizeAtCompileTime,1>
+operator()(const Eigen::internal::all_t&) const
+{
return Reshaped<const Derived,SizeAtCompileTime,1>(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 T1,typename T2>
+typename internal::enable_if<internal::is_same<T1,T2>::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 <typename MatType>
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<MatType::SizeAtCompileTime>(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));