diff options
-rw-r--r-- | test/stl_iterators.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/stl_iterators.cpp b/test/stl_iterators.cpp index 4e04d28b7..5d501dcd6 100644 --- a/test/stl_iterators.cpp +++ b/test/stl_iterators.cpp @@ -30,6 +30,7 @@ void test_range_for_loop(int rows=Rows, int cols=Cols) using std::end; typedef Matrix<Scalar,Rows,1> VectorType; + typedef Matrix<Scalar,1,Cols> RowVectorType; typedef Matrix<Scalar,Rows,Cols,ColMajor> ColMatrixType; typedef Matrix<Scalar,Rows,Cols,RowMajor> RowMatrixType; VectorType v = VectorType::Random(rows); @@ -62,6 +63,9 @@ void test_range_for_loop(int rows=Rows, int cols=Cols) VERIFY( is_PointerBasedStlIterator(cA.reshaped().begin()) ); VERIFY( is_PointerBasedStlIterator(cA.reshaped().end()) ); + VERIFY( is_PointerBasedStlIterator(B.template reshaped<AutoOrder>().begin()) ); + VERIFY( is_PointerBasedStlIterator(B.template reshaped<AutoOrder>().end()) ); + VERIFY( is_DenseStlIterator(A.template reshaped<RowMajor>().begin()) ); VERIFY( is_DenseStlIterator(A.template reshaped<RowMajor>().end()) ); @@ -252,6 +256,17 @@ void test_range_for_loop(int rows=Rows, int cols=Cols) i = 0; for(auto r : B.allRows()) { VERIFY_IS_APPROX(r.sum(), B.row(i).sum()); ++i; } + + { + RowVectorType row = RowVectorType::Random(cols); + A.rowwise() = row; + VERIFY( std::all_of(A.allRows().begin(), A.allRows().end(), [&row](typename ColMatrixType::RowXpr x) { return internal::isApprox(x.norm(),row.norm()); }) ); + + VectorType col = VectorType::Random(rows); + A.colwise() = col; + VERIFY( std::all_of(A.allCols().begin(), A.allCols().end(), [&col](typename ColMatrixType::ColXpr x) { return internal::isApprox(x.norm(),col.norm()); }) ); + } + #endif } |