14 template<
class Iterator >
15 std::reverse_iterator<Iterator>
18 return std::reverse_iterator<Iterator>(
i);
22 template<
class ForwardIt>
25 if (firstIt != lastIt) {
26 ForwardIt next = firstIt;
27 while (++next != lastIt) {
35 template<
class ForwardIt>
44 template<
typename XprType>
47 template<
typename XprType>
50 template<
typename Iter>
62 template<
typename Xpr>
69 for(
typename Xpr::iterator it = xpr.begin(); it!=xpr.end(); ++it) {
VERIFY_IS_EQUAL(*it,xpr[i++]); }
72 for(
typename Xpr::const_iterator it = xpr.cbegin(); it!=xpr.cend(); ++it) {
VERIFY_IS_EQUAL(*it,xpr[i++]); }
75 for(
typename Xpr::const_iterator it = cxpr.begin(); it!=cxpr.end(); ++it) {
VERIFY_IS_EQUAL(*it,xpr[i++]); }
78 for(
typename Xpr::const_iterator it = xpr.begin(); it!=xpr.end(); ++it) {
VERIFY_IS_EQUAL(*it,xpr[i++]); }
82 typename Xpr::const_iterator cit = xpr.begin();
86 auto tmp1 = xpr.begin();
88 auto tmp2 = xpr.cbegin();
89 VERIFY(tmp2==xpr.cbegin());
93 VERIFY( xpr.end() -xpr.begin() == xpr.size() );
94 VERIFY( xpr.cend()-xpr.begin() == xpr.size() );
95 VERIFY( xpr.end() -xpr.cbegin() == xpr.size() );
96 VERIFY( xpr.cend()-xpr.cbegin() == xpr.size() );
99 VERIFY(xpr.begin() != xpr.end());
100 VERIFY(xpr.begin() < xpr.end());
101 VERIFY(xpr.begin() <= xpr.end());
102 VERIFY(!(xpr.begin() == xpr.end()));
103 VERIFY(!(xpr.begin() > xpr.end()));
104 VERIFY(!(xpr.begin() >= xpr.end()));
106 VERIFY(xpr.cbegin() != xpr.end());
107 VERIFY(xpr.cbegin() < xpr.end());
108 VERIFY(xpr.cbegin() <= xpr.end());
109 VERIFY(!(xpr.cbegin() == xpr.end()));
110 VERIFY(!(xpr.cbegin() > xpr.end()));
111 VERIFY(!(xpr.cbegin() >= xpr.end()));
113 VERIFY(xpr.begin() != xpr.cend());
114 VERIFY(xpr.begin() < xpr.cend());
115 VERIFY(xpr.begin() <= xpr.cend());
116 VERIFY(!(xpr.begin() == xpr.cend()));
117 VERIFY(!(xpr.begin() > xpr.cend()));
118 VERIFY(!(xpr.begin() >= xpr.cend()));
122 template<
typename Scalar,
int Rows,
int Cols>
131 VectorType
v = VectorType::Random(
rows);
132 const VectorType& cv(v);
133 ColMatrixType
A = ColMatrixType::Random(
rows,
cols);
134 const ColMatrixType& cA(A);
135 RowMatrixType
B = RowMatrixType::Random(
rows,
cols);
162 j = internal::random<Index>(0,A.cols()-1);
168 i = internal::random<Index>(0,A.rows()-1);
199 VectorType v_copy =
v;
212 RowMatrixType B_copy =
B;
213 auto Br = B.reshaped();
230 j = internal::random<Index>(0,A.cols()-1);
238 i = internal::random<Index>(0,A.rows()-1);
254 i = internal::random<Index>(0,A.rows()-1);
267 VectorType
w(v.size());
269 for(
auto&
x :
w) {
x =
v(i++); }
277 j = internal::random<Index>(0,A.cols()-1);
278 auto it = A.col(j).begin();
279 for(i=0;i<
rows;++
i) {
286 i = internal::random<Index>(0,A.rows()-1);
287 auto it = A.row(i).begin();
292 j = internal::random<Index>(0,A.cols()-1);
296 auto tmp = (A+2*
A).
col(j);
297 auto it = tmp.begin();
298 for(i=0;i<
rows;++
i) {
307 for (
auto it = A.colwise().cbegin(); it != A.colwise().cend(); ++it, ++
j) {
312 for (
auto it = A.colwise().begin(); it != A.colwise().end(); ++it, ++
j) {
313 (*it).coeffRef(0) = (*it).coeff(0);
314 it->coeffRef(0) = it->coeff(0);
321 for (
auto it = A.colwise().cbegin(); it != A.colwise().cend(); ++it, ++
j) {
322 typename decltype(it)::value_type tmp = *it;
355 std::sort(v.begin(),v.end());
362 j = internal::random<Index>(0,A.cols()-1);
365 std::sort(Acol.begin(),Acol.end());
369 std::sort(A.col(j).begin(),A.col(j).end());
376 i = internal::random<Index>(0,A.rows()-1);
379 std::sort(Arow.begin(),Arow.end());
383 std::sort(A.row(i).begin(),A.row(i).end());
391 std::sort(B1.begin(),B1.end());
404 j = internal::random<Index>(0,A.cols()-1);
406 std::partial_sum(Acol.begin(), Acol.end(), v.begin());
410 std::partial_sum(Acol.begin(), Acol.end(), Acol.begin());
419 std::sort(v1.begin(),v1.end());
420 std::nth_element(v.begin(), v.begin()+
rows/2, v.end());
425 std::sort(v1.begin()+
rows/2,v1.end());
426 std::nth_element(v.begin()+
rows/2, v.begin()+
rows/4, v.end());
439 for(
auto c : B.colwise()) {
460 RowVectorType
row = RowVectorType::Random(
cols);
465 VectorType
col = VectorType::Random(
rows);
472 i = internal::random<Index>(0,A.rows()-1);
478 j = internal::random<Index>(0,A.cols()-1);
487 STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cbegin())>::
value ));
488 STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cend ())>::
value ));
489 #if EIGEN_COMP_CXXVER>=14 490 STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cbegin(std::declval<const VecOp&>()))>::
value ));
491 STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cend (std::declval<const VecOp&>()))>::
value ));
509 class Iterator = decltype(::std::declval<const C&>().begin()),
510 class = decltype(::std::declval<const C&>().
end()),
511 class = decltype(++::std::declval<Iterator&>()),
512 class = decltype(*::std::declval<Iterator>()),
513 class =
typename C::const_iterator>
514 bool IsContainerType(
int ) {
return true; }
517 bool IsContainerType(
long ) {
return false; }
519 template <
typename Scalar,
int Rows,
int Cols>
520 void test_stl_container_detection(
int rows=Rows,
int cols=
Cols)
526 ColMatrixType
A = ColMatrixType::Random(
rows,
cols);
527 RowMatrixType
B = RowMatrixType::Random(
rows,
cols);
531 using ColMatrixColType = decltype(A.col(i));
532 using ColMatrixRowType = decltype(A.row(i));
533 using RowMatrixColType = decltype(B.col(i));
534 using RowMatrixRowType = decltype(B.row(i));
554 CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(5,10), internal::random<int>(5,10)) ));
555 CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(10,200), internal::random<int>(10,200)) ));
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Block< Derived, 1, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > RowXpr
#define VERIFY_IS_NOT_EQUAL(a, b)
void test_stl_iterators(int rows=Rows, int cols=Cols)
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ConstColXpr
#define STATIC_CHECK(COND)
Double_ distance(const OrientedPlane3_ &p)
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ColXpr
Pseudo expression providing broadcasting and partial reduction operations.
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
bool is_default_constructible_and_assignable(const Iter &it)
void check_begin_end_for_loop(Xpr xpr)
static const symbolic::SymbolExpr< internal::symbolic_last_tag > last
std::reverse_iterator< Iterator > make_reverse_iterator(Iterator i)
bool is_sorted(ForwardIt firstIt, ForwardIt lastIt)
#define VERIFY_IS_APPROX(a, b)
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
#define VERIFY_IS_EQUAL(a, b)
#define CALL_SUBTEST_1(FUNC)
bool is_generic_randaccess_stl_iterator(const internal::generic_randaccess_stl_iterator< XprType > &)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Array< int, Dynamic, 1 > v
bool is_pointer_based_stl_iterator(const internal::pointer_based_stl_iterator< XprType > &)
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
Matrix< Scalar, Dynamic, Dynamic > C
std::is_same< bools< Ts::value..., true >, bools< true, Ts::value... > > all_of
internal::enable_if<!(symbolic::is_symbolic< FirstType >::value||symbolic::is_symbolic< LastType >::value), ArithmeticSequence< typename internal::cleanup_index_type< FirstType >::type, Index > >::type seq(FirstType f, LastType l)
static EIGEN_DEPRECATED const end_t end
ForwardIt is_sorted_until(ForwardIt firstIt, ForwardIt lastIt)
Expression of a fixed-size or dynamic-size reshape.
EIGEN_DECLARE_TEST(stl_iterators)
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x