Squashed 'third_party/eigen/' changes from 61d72f6..cf794d3
Change-Id: I9b814151b01f49af6337a8605d0c42a3a1ed4c72
git-subtree-dir: third_party/eigen
git-subtree-split: cf794d3b741a6278df169e58461f8529f43bce5d
diff --git a/test/array_reverse.cpp b/test/array_reverse.cpp
index fbe7a99..9d5b9a6 100644
--- a/test/array_reverse.cpp
+++ b/test/array_reverse.cpp
@@ -15,7 +15,6 @@
template<typename MatrixType> void reverse(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
@@ -24,7 +23,7 @@
// this test relies a lot on Random.h, and there's not much more that we can do
// to test it, hence I consider that we will have tested Random.h
- MatrixType m1 = MatrixType::Random(rows, cols);
+ MatrixType m1 = MatrixType::Random(rows, cols), m2;
VectorType v1 = VectorType::Random(rows);
MatrixType m1_r = m1.reverse();
@@ -96,14 +95,32 @@
m1.reverse()(r, c) = x;
VERIFY_IS_APPROX(x, m1(rows - 1 - r, cols - 1 - c));
+
+ m2 = m1;
+ m2.reverseInPlace();
+ VERIFY_IS_APPROX(m2,m1.reverse().eval());
+
+ m2 = m1;
+ m2.col(0).reverseInPlace();
+ VERIFY_IS_APPROX(m2.col(0),m1.col(0).reverse().eval());
+
+ m2 = m1;
+ m2.row(0).reverseInPlace();
+ VERIFY_IS_APPROX(m2.row(0),m1.row(0).reverse().eval());
+
+ m2 = m1;
+ m2.rowwise().reverseInPlace();
+ VERIFY_IS_APPROX(m2,m1.rowwise().reverse().eval());
+
+ m2 = m1;
+ m2.colwise().reverseInPlace();
+ VERIFY_IS_APPROX(m2,m1.colwise().reverse().eval());
- /*
m1.colwise().reverse()(r, c) = x;
VERIFY_IS_APPROX(x, m1(rows - 1 - r, c));
m1.rowwise().reverse()(r, c) = x;
VERIFY_IS_APPROX(x, m1(r, cols - 1 - c));
- */
}
void test_array_reverse()
@@ -113,11 +130,11 @@
CALL_SUBTEST_2( reverse(Matrix2f()) );
CALL_SUBTEST_3( reverse(Matrix4f()) );
CALL_SUBTEST_4( reverse(Matrix4d()) );
- CALL_SUBTEST_5( reverse(MatrixXcf(3, 3)) );
- CALL_SUBTEST_6( reverse(MatrixXi(6, 3)) );
- CALL_SUBTEST_7( reverse(MatrixXcd(20, 20)) );
+ CALL_SUBTEST_5( reverse(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
+ CALL_SUBTEST_6( reverse(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
+ CALL_SUBTEST_7( reverse(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
CALL_SUBTEST_8( reverse(Matrix<float, 100, 100>()) );
- CALL_SUBTEST_9( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(6,3)) );
+ CALL_SUBTEST_9( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
}
#ifdef EIGEN_TEST_PART_3
Vector4f x; x << 1, 2, 3, 4;