stl_iterators.cpp File Reference
#include "main.h"
#include <iterator>
#include <numeric>

Functions

template<class Iterator >
std::reverse_iterator< Iterator > make_reverse_iterator (Iterator i)
 
template<typename XprType >
bool is_pointer_based_stl_iterator (const internal::pointer_based_stl_iterator< XprType > &)
 
template<typename XprType >
bool is_generic_randaccess_stl_iterator (const internal::generic_randaccess_stl_iterator< XprType > &)
 
template<typename Iter >
bool is_default_constructible_and_assignable (const Iter &it)
 
template<typename Xpr >
void check_begin_end_for_loop (Xpr xpr)
 
template<typename Scalar , int Rows, int Cols>
void test_stl_iterators (int rows=Rows, int cols=Cols)
 
template<class C , class Iterator = decltype(::std::declval<const C&>().begin()), class = decltype(::std::declval<const C&>().end()), class = decltype(++::std::declval<Iterator&>()), class = decltype(*::std::declval<Iterator>()), class = typename C::const_iterator>
bool IsContainerType (int)
 
template<class C >
bool IsContainerType (long)
 
template<typename Scalar , int Rows, int Cols>
void test_stl_container_detection (int rows=Rows, int cols=Cols)
 
 EIGEN_DECLARE_TEST (stl_iterators)
 

Function Documentation

◆ check_begin_end_for_loop()

template<typename Xpr >
void check_begin_end_for_loop ( Xpr  xpr)
41  {
42  const Xpr& cxpr(xpr);
43  Index i = 0;
44 
45  i = 0;
46  for (typename Xpr::iterator it = xpr.begin(); it != xpr.end(); ++it) {
47  VERIFY_IS_EQUAL(*it, xpr[i++]);
48  }
49 
50  i = 0;
51  for (typename Xpr::const_iterator it = xpr.cbegin(); it != xpr.cend(); ++it) {
52  VERIFY_IS_EQUAL(*it, xpr[i++]);
53  }
54 
55  i = 0;
56  for (typename Xpr::const_iterator it = cxpr.begin(); it != cxpr.end(); ++it) {
57  VERIFY_IS_EQUAL(*it, xpr[i++]);
58  }
59 
60  i = 0;
61  for (typename Xpr::const_iterator it = xpr.begin(); it != xpr.end(); ++it) {
62  VERIFY_IS_EQUAL(*it, xpr[i++]);
63  }
64 
65  {
66  // simple API check
67  typename Xpr::const_iterator cit = xpr.begin();
68  cit = xpr.cbegin();
69 
70  auto tmp1 = xpr.begin();
71  VERIFY(tmp1 == xpr.begin());
72  auto tmp2 = xpr.cbegin();
73  VERIFY(tmp2 == xpr.cbegin());
74  }
75 
76  VERIFY(xpr.end() - xpr.begin() == xpr.size());
77  VERIFY(xpr.cend() - xpr.begin() == xpr.size());
78  VERIFY(xpr.end() - xpr.cbegin() == xpr.size());
79  VERIFY(xpr.cend() - xpr.cbegin() == xpr.size());
80 
81  if (xpr.size() > 0) {
82  VERIFY(xpr.begin() != xpr.end());
83  VERIFY(xpr.begin() < xpr.end());
84  VERIFY(xpr.begin() <= xpr.end());
85  VERIFY(!(xpr.begin() == xpr.end()));
86  VERIFY(!(xpr.begin() > xpr.end()));
87  VERIFY(!(xpr.begin() >= xpr.end()));
88 
89  VERIFY(xpr.cbegin() != xpr.end());
90  VERIFY(xpr.cbegin() < xpr.end());
91  VERIFY(xpr.cbegin() <= xpr.end());
92  VERIFY(!(xpr.cbegin() == xpr.end()));
93  VERIFY(!(xpr.cbegin() > xpr.end()));
94  VERIFY(!(xpr.cbegin() >= xpr.end()));
95 
96  VERIFY(xpr.begin() != xpr.cend());
97  VERIFY(xpr.begin() < xpr.cend());
98  VERIFY(xpr.begin() <= xpr.cend());
99  VERIFY(!(xpr.begin() == xpr.cend()));
100  VERIFY(!(xpr.begin() > xpr.cend()));
101  VERIFY(!(xpr.begin() >= xpr.cend()));
102  }
103 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define VERIFY(a)
Definition: main.h:362
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83

References i, VERIFY, and VERIFY_IS_EQUAL.

Referenced by test_stl_iterators().

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( stl_iterators  )
582  {
583  for (int i = 0; i < g_repeat; i++) {
584  CALL_SUBTEST_1((test_stl_iterators<double, 2, 3>()));
585  CALL_SUBTEST_1((test_stl_iterators<float, 7, 5>()));
587  (test_stl_iterators<int, Dynamic, Dynamic>(internal::random<int>(5, 10), internal::random<int>(5, 10))));
589  (test_stl_iterators<int, Dynamic, Dynamic>(internal::random<int>(10, 200), internal::random<int>(10, 200))));
590  }
591 
592  CALL_SUBTEST_1((test_stl_container_detection<float, 1, 1>()));
593  CALL_SUBTEST_1((test_stl_container_detection<float, 5, 5>()));
594 }
static int g_repeat
Definition: main.h:191
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4

References CALL_SUBTEST_1, Eigen::g_repeat, and i.

◆ is_default_constructible_and_assignable()

template<typename Iter >
bool is_default_constructible_and_assignable ( const Iter &  it)
32  {
35  Iter it2;
36  it2 = it;
37  return (it == it2);
38 }
squared absolute value
Definition: GlobalFunctions.h:87

References Eigen::value, and VERIFY.

Referenced by test_stl_iterators().

◆ is_generic_randaccess_stl_iterator()

template<typename XprType >
bool is_generic_randaccess_stl_iterator ( const internal::generic_randaccess_stl_iterator< XprType > &  )
27  {
28  return true;
29 }

Referenced by test_stl_iterators().

◆ is_pointer_based_stl_iterator()

template<typename XprType >
bool is_pointer_based_stl_iterator ( const internal::pointer_based_stl_iterator< XprType > &  )
22  {
23  return true;
24 }

Referenced by test_stl_iterators().

◆ IsContainerType() [1/2]

template<class C , class Iterator = decltype(::std::declval<const C&>().begin()), class = decltype(::std::declval<const C&>().end()), class = decltype(++::std::declval<Iterator&>()), class = decltype(*::std::declval<Iterator>()), class = typename C::const_iterator>
bool IsContainerType ( int  )
545  {
546  return true;
547 }

◆ IsContainerType() [2/2]

template<class C >
bool IsContainerType ( long  )
550  {
551  return false;
552 }

◆ make_reverse_iterator()

template<class Iterator >
std::reverse_iterator<Iterator> make_reverse_iterator ( Iterator  i)
15  {
16  return std::reverse_iterator<Iterator>(i);
17 }

References i.

Referenced by test_stl_iterators().

◆ test_stl_container_detection()

template<typename Scalar , int Rows, int Cols>
void test_stl_container_detection ( int  rows = Rows,
int  cols = Cols 
)
555  {
557  typedef Matrix<Scalar, Rows, Cols, ColMajor> ColMatrixType;
558  typedef Matrix<Scalar, Rows, Cols, RowMajor> RowMatrixType;
559 
560  ColMatrixType A = ColMatrixType::Random(rows, cols);
561  RowMatrixType B = RowMatrixType::Random(rows, cols);
562 
563  Index i = 1;
564 
565  using ColMatrixColType = decltype(A.col(i));
566  using ColMatrixRowType = decltype(A.row(i));
567  using RowMatrixColType = decltype(B.col(i));
568  using RowMatrixRowType = decltype(B.row(i));
569 
570  // Vector and matrix col/row are valid Stl-style container.
571  VERIFY_IS_EQUAL(IsContainerType<VectorType>(0), true);
572  VERIFY_IS_EQUAL(IsContainerType<ColMatrixColType>(0), true);
573  VERIFY_IS_EQUAL(IsContainerType<ColMatrixRowType>(0), true);
574  VERIFY_IS_EQUAL(IsContainerType<RowMatrixColType>(0), true);
575  VERIFY_IS_EQUAL(IsContainerType<RowMatrixRowType>(0), true);
576 
577  // But the matrix itself is not a valid Stl-style container.
578  VERIFY_IS_EQUAL(IsContainerType<ColMatrixType>(0), rows == 1 || cols == 1);
579  VERIFY_IS_EQUAL(IsContainerType<RowMatrixType>(0), rows == 1 || cols == 1);
580 }
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: matrices.h:74
Definition: fft_test_shared.h:66

References cols, i, rows, and VERIFY_IS_EQUAL.

◆ test_stl_iterators()

template<typename Scalar , int Rows, int Cols>
void test_stl_iterators ( int  rows = Rows,
int  cols = Cols 
)
106  {
108  typedef Matrix<Scalar, 1, Cols> RowVectorType;
109  typedef Matrix<Scalar, Rows, Cols, ColMajor> ColMatrixType;
110  typedef Matrix<Scalar, Rows, Cols, RowMajor> RowMatrixType;
111  VectorType v = VectorType::Random(rows);
112  const VectorType& cv(v);
113  ColMatrixType A = ColMatrixType::Random(rows, cols);
114  const ColMatrixType& cA(A);
115  RowMatrixType B = RowMatrixType::Random(rows, cols);
117 
118  Index i, j;
119 
120  // Verify that iterators are default constructible (See bug #1900)
121  {
126 
131 
134  }
135 
136  // Check we got a fast pointer-based iterator when expected
137  {
142 
143  j = internal::random<Index>(0, A.cols() - 1);
144  VERIFY(is_pointer_based_stl_iterator(A.col(j).begin()));
146  VERIFY(is_pointer_based_stl_iterator(cA.col(j).begin()));
147  VERIFY(is_pointer_based_stl_iterator(cA.col(j).end()));
148 
149  i = internal::random<Index>(0, A.rows() - 1);
150  VERIFY(is_pointer_based_stl_iterator(A.row(i).begin()));
152  VERIFY(is_pointer_based_stl_iterator(cA.row(i).begin()));
153  VERIFY(is_pointer_based_stl_iterator(cA.row(i).end()));
154 
155  VERIFY(is_pointer_based_stl_iterator(A.reshaped().begin()));
156  VERIFY(is_pointer_based_stl_iterator(A.reshaped().end()));
157  VERIFY(is_pointer_based_stl_iterator(cA.reshaped().begin()));
158  VERIFY(is_pointer_based_stl_iterator(cA.reshaped().end()));
159 
160  VERIFY(is_pointer_based_stl_iterator(B.template reshaped<AutoOrder>().begin()));
161  VERIFY(is_pointer_based_stl_iterator(B.template reshaped<AutoOrder>().end()));
162 
163  VERIFY(is_generic_randaccess_stl_iterator(A.template reshaped<RowMajor>().begin()));
164  VERIFY(is_generic_randaccess_stl_iterator(A.template reshaped<RowMajor>().end()));
165  }
166 
167  {
169  check_begin_end_for_loop(A.col(internal::random<Index>(0, A.cols() - 1)));
170  check_begin_end_for_loop(A.row(internal::random<Index>(0, A.rows() - 1)));
172  }
173 
174  // check swappable
175  {
176  using std::swap;
177  // pointer-based
178  {
179  VectorType v_copy = v;
180  auto a = v.begin();
181  auto b = v.end() - 1;
182  swap(a, b);
183  VERIFY_IS_EQUAL(v, v_copy);
184  VERIFY_IS_EQUAL(*b, *v.begin());
185  VERIFY_IS_EQUAL(*b, v(0));
186  VERIFY_IS_EQUAL(*a, v.end()[-1]);
187  VERIFY_IS_EQUAL(*a, v(last));
188  }
189 
190  // generic
191  {
192  RowMatrixType B_copy = B;
193  auto Br = B.reshaped();
194  auto a = Br.begin();
195  auto b = Br.end() - 1;
196  swap(a, b);
197  VERIFY_IS_EQUAL(B, B_copy);
198  VERIFY_IS_EQUAL(*b, *Br.begin());
199  VERIFY_IS_EQUAL(*b, Br(0));
200  VERIFY_IS_EQUAL(*a, Br.end()[-1]);
201  VERIFY_IS_EQUAL(*a, Br(last));
202  }
203  }
204 
205  // check non-const iterator with for-range loops
206  {
207  i = 0;
208  for (auto x : v) {
209  VERIFY_IS_EQUAL(x, v[i++]);
210  }
211 
212  j = internal::random<Index>(0, A.cols() - 1);
213  i = 0;
214  for (auto x : A.col(j)) {
215  VERIFY_IS_EQUAL(x, A(i++, j));
216  }
217 
218  i = 0;
219  for (auto x : (v + A.col(j))) {
220  VERIFY_IS_APPROX(x, v(i) + A(i, j));
221  ++i;
222  }
223 
224  j = 0;
225  i = internal::random<Index>(0, A.rows() - 1);
226  for (auto x : A.row(i)) {
227  VERIFY_IS_EQUAL(x, A(i, j++));
228  }
229 
230  i = 0;
231  for (auto x : A.reshaped()) {
232  VERIFY_IS_EQUAL(x, A(i++));
233  }
234  }
235 
236  // same for const_iterator
237  {
238  i = 0;
239  for (auto x : cv) {
240  VERIFY_IS_EQUAL(x, v[i++]);
241  }
242 
243  i = 0;
244  for (auto x : cA.reshaped()) {
245  VERIFY_IS_EQUAL(x, A(i++));
246  }
247 
248  j = 0;
249  i = internal::random<Index>(0, A.rows() - 1);
250  for (auto x : cA.row(i)) {
251  VERIFY_IS_EQUAL(x, A(i, j++));
252  }
253  }
254 
255  // check reshaped() on row-major
256  {
257  i = 0;
259  for (auto x : B.reshaped()) {
260  VERIFY_IS_EQUAL(x, Bc(i++));
261  }
262  }
263 
264  // check write access
265  {
266  VectorType w(v.size());
267  i = 0;
268  for (auto& x : w) {
269  x = v(i++);
270  }
271  VERIFY_IS_EQUAL(v, w);
272  }
273 
274  // check for dangling pointers
275  {
276  // no dangling because pointer-based
277  {
278  j = internal::random<Index>(0, A.cols() - 1);
279  auto it = A.col(j).begin();
280  for (i = 0; i < rows; ++i) {
281  VERIFY_IS_EQUAL(it[i], A(i, j));
282  }
283  }
284 
285  // no dangling because pointer-based
286  {
287  i = internal::random<Index>(0, A.rows() - 1);
288  auto it = A.row(i).begin();
289  for (j = 0; j < cols; ++j) {
290  VERIFY_IS_EQUAL(it[j], A(i, j));
291  }
292  }
293 
294  {
295  j = internal::random<Index>(0, A.cols() - 1);
296  // this would produce a dangling pointer:
297  // auto it = (A+2*A).col(j).begin();
298  // we need to name the temporary expression:
299  auto tmp = (A + 2 * A).col(j);
300  auto it = tmp.begin();
301  for (i = 0; i < rows; ++i) {
302  VERIFY_IS_APPROX(it[i], 3 * A(i, j));
303  }
304  }
305  }
306 
307  {
308  // check basic for loop on vector-wise iterators
309  j = 0;
310  for (auto it = A.colwise().cbegin(); it != A.colwise().cend(); ++it, ++j) {
311  VERIFY_IS_APPROX(it->coeff(0), A(0, j));
312  VERIFY_IS_APPROX((*it).coeff(0), A(0, j));
313  }
314  j = 0;
315  for (auto it = A.colwise().begin(); it != A.colwise().end(); ++it, ++j) {
316  (*it).coeffRef(0) = (*it).coeff(0); // compilation check
317  it->coeffRef(0) = it->coeff(0); // compilation check
318  VERIFY_IS_APPROX(it->coeff(0), A(0, j));
319  VERIFY_IS_APPROX((*it).coeff(0), A(0, j));
320  }
321 
322  // check valuetype gives us a copy
323  j = 0;
324  for (auto it = A.colwise().cbegin(); it != A.colwise().cend(); ++it, ++j) {
325  typename decltype(it)::value_type tmp = *it;
326  VERIFY_IS_NOT_EQUAL(tmp.data(), it->data());
327  VERIFY_IS_APPROX(tmp, A.col(j));
328  }
329  }
330 
331  if (rows >= 3) {
332  VERIFY_IS_EQUAL((v.begin() + rows / 2)[1], v(rows / 2 + 1));
333 
334  VERIFY_IS_EQUAL((A.rowwise().begin() + rows / 2)[1], A.row(rows / 2 + 1));
335  }
336 
337  if (cols >= 3) {
338  VERIFY_IS_EQUAL((A.colwise().begin() + cols / 2)[1], A.col(cols / 2 + 1));
339  }
340 
341  // check std::sort
342  {
343  // first check that is_sorted returns false when required
344  if (rows >= 2) {
345  v(1) = v(0) - Scalar(1);
346  VERIFY(!is_sorted(std::begin(v), std::end(v)));
347  }
348 
349  // on a vector
350  {
351  std::sort(v.begin(), v.end());
352  VERIFY(is_sorted(v.begin(), v.end()));
354  }
355 
356  // on a column of a column-major matrix -> pointer-based iterator and default increment
357  {
358  j = internal::random<Index>(0, A.cols() - 1);
359  // std::sort(begin(A.col(j)),end(A.col(j))); // does not compile because this returns const iterators
360  typename ColMatrixType::ColXpr Acol = A.col(j);
361  std::sort(Acol.begin(), Acol.end());
362  VERIFY(is_sorted(Acol.cbegin(), Acol.cend()));
363  A.setRandom();
364 
365  std::sort(A.col(j).begin(), A.col(j).end());
366  VERIFY(is_sorted(A.col(j).cbegin(), A.col(j).cend()));
367  A.setRandom();
368  }
369 
370  // on a row of a rowmajor matrix -> pointer-based iterator and runtime increment
371  {
372  i = internal::random<Index>(0, A.rows() - 1);
373  typename ColMatrixType::RowXpr Arow = A.row(i);
374  VERIFY_IS_EQUAL(std::distance(Arow.begin(), Arow.end()), cols);
375  std::sort(Arow.begin(), Arow.end());
376  VERIFY(is_sorted(Arow.cbegin(), Arow.cend()));
377  A.setRandom();
378 
379  std::sort(A.row(i).begin(), A.row(i).end());
380  VERIFY(is_sorted(A.row(i).cbegin(), A.row(i).cend()));
381  A.setRandom();
382  }
383 
384  // with a generic iterator
385  {
387  std::sort(B1.begin(), B1.end());
388  VERIFY(is_sorted(B1.cbegin(), B1.cend()));
389  B.setRandom();
390 
391  // assertion because nested expressions are different
392  // std::sort(B.reshaped().begin(),B.reshaped().end());
393  // VERIFY(is_sorted(B.reshaped().cbegin(),B.reshaped().cend()));
394  // B.setRandom();
395  }
396  }
397 
398  // check with partial_sum
399  {
400  j = internal::random<Index>(0, A.cols() - 1);
401  typename ColMatrixType::ColXpr Acol = A.col(j);
402  std::partial_sum(Acol.begin(), Acol.end(), v.begin());
403  VERIFY_IS_APPROX(v(seq(1, last)), v(seq(0, last - 1)) + Acol(seq(1, last)));
404 
405  // inplace
406  std::partial_sum(Acol.begin(), Acol.end(), Acol.begin());
407  VERIFY_IS_APPROX(v, Acol);
408  }
409 
410  // stress random access as required by std::nth_element
411  if (rows >= 3) {
412  v.setRandom();
413  VectorType v1 = v;
414  std::sort(v1.begin(), v1.end());
415  std::nth_element(v.begin(), v.begin() + rows / 2, v.end());
416  VERIFY_IS_APPROX(v1(rows / 2), v(rows / 2));
417 
418  v.setRandom();
419  v1 = v;
420  std::sort(v1.begin() + rows / 2, v1.end());
421  std::nth_element(v.begin() + rows / 2, v.begin() + rows / 4, v.end());
422  VERIFY_IS_APPROX(v1(rows / 4), v(rows / 4));
423  }
424 
425  // check rows/cols iterators with range-for loops
426  {
427  j = 0;
428  for (auto c : A.colwise()) {
429  VERIFY_IS_APPROX(c.sum(), A.col(j).sum());
430  ++j;
431  }
432  j = 0;
433  for (auto c : B.colwise()) {
434  VERIFY_IS_APPROX(c.sum(), B.col(j).sum());
435  ++j;
436  }
437 
438  j = 0;
439  for (auto c : B.colwise()) {
440  i = 0;
441  for (auto& x : c) {
442  VERIFY_IS_EQUAL(x, B(i, j));
443  x = A(i, j);
444  ++i;
445  }
446  ++j;
447  }
448  VERIFY_IS_APPROX(A, B);
449  B.setRandom();
450 
451  i = 0;
452  for (auto r : A.rowwise()) {
453  VERIFY_IS_APPROX(r.sum(), A.row(i).sum());
454  ++i;
455  }
456  i = 0;
457  for (auto r : B.rowwise()) {
458  VERIFY_IS_APPROX(r.sum(), B.row(i).sum());
459  ++i;
460  }
461  }
462 
463  // check rows/cols iterators with STL algorithms
464  {
465  RowVectorType row = RowVectorType::Random(cols);
466  VectorType col = VectorType::Random(rows);
467  // Prevent overflows for integer types.
469  Scalar kMaxVal = Scalar(1000);
470  row.array() = row.array() - kMaxVal * (row.array() / kMaxVal);
471  col.array() = col.array() - kMaxVal * (col.array() / kMaxVal);
472  }
473  A.rowwise() = row;
474  VERIFY(std::all_of(A.rowwise().begin(), A.rowwise().end(), [&row](typename ColMatrixType::RowXpr x) {
475  return internal::isApprox(x.squaredNorm(), row.squaredNorm());
476  }));
477  VERIFY(std::all_of(A.rowwise().rbegin(), A.rowwise().rend(), [&row](typename ColMatrixType::RowXpr x) {
478  return internal::isApprox(x.squaredNorm(), row.squaredNorm());
479  }));
480 
481  A.colwise() = col;
482  VERIFY(std::all_of(A.colwise().begin(), A.colwise().end(), [&col](typename ColMatrixType::ColXpr x) {
483  return internal::isApprox(x.squaredNorm(), col.squaredNorm());
484  }));
485  VERIFY(std::all_of(A.colwise().rbegin(), A.colwise().rend(), [&col](typename ColMatrixType::ColXpr x) {
486  return internal::isApprox(x.squaredNorm(), col.squaredNorm());
487  }));
488  VERIFY(std::all_of(A.colwise().cbegin(), A.colwise().cend(), [&col](typename ColMatrixType::ConstColXpr x) {
489  return internal::isApprox(x.squaredNorm(), col.squaredNorm());
490  }));
491  VERIFY(std::all_of(A.colwise().crbegin(), A.colwise().crend(), [&col](typename ColMatrixType::ConstColXpr x) {
492  return internal::isApprox(x.squaredNorm(), col.squaredNorm());
493  }));
494 
495  i = internal::random<Index>(0, A.rows() - 1);
496  A.setRandom();
497  A.row(i).setZero();
499  std::find_if(A.rowwise().begin(), A.rowwise().end(),
500  [](typename ColMatrixType::RowXpr x) { return numext::is_exactly_zero(x.squaredNorm()); }) -
501  A.rowwise().begin(),
502  i);
504  std::find_if(A.rowwise().rbegin(), A.rowwise().rend(),
505  [](typename ColMatrixType::RowXpr x) { return numext::is_exactly_zero(x.squaredNorm()); }) -
506  A.rowwise().rbegin(),
507  (A.rows() - 1) - i);
508 
509  j = internal::random<Index>(0, A.cols() - 1);
510  A.setRandom();
511  A.col(j).setZero();
513  std::find_if(A.colwise().begin(), A.colwise().end(),
514  [](typename ColMatrixType::ColXpr x) { return numext::is_exactly_zero(x.squaredNorm()); }) -
515  A.colwise().begin(),
516  j);
518  std::find_if(A.colwise().rbegin(), A.colwise().rend(),
519  [](typename ColMatrixType::ColXpr x) { return numext::is_exactly_zero(x.squaredNorm()); }) -
520  A.colwise().rbegin(),
521  (A.cols() - 1) - j);
522  }
523 
524  {
525  using VecOp = VectorwiseOp<ArrayXXi, 0>;
526  STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cbegin())>::value));
527  STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cend())>::value));
528  STATIC_CHECK(
529  (internal::is_same<VecOp::const_iterator, decltype(std::cbegin(std::declval<const VecOp&>()))>::value));
530  STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::cend(std::declval<const VecOp&>()))>::value));
531  }
532 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
m col(1)
m row(1)
RowVector3d w
Definition: Matrix_resize_int.cpp:3
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:48
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
Derived & setRandom(Index size)
Definition: Random.h:147
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:191
Expression of a fixed-size or dynamic-size reshape.
Definition: Reshaped.h:99
Pseudo expression providing broadcasting and partial reduction operations.
Definition: VectorwiseOp.h:192
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
static constexpr const last_t last
Definition: IndexedViewHelper.h:48
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13
EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:117
const Scalar * a
Definition: level2_cplx_impl.h:32
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
#define VERIFY_IS_NOT_EQUAL(a, b)
Definition: main.h:368
#define STATIC_CHECK(COND)
Definition: main.h:380
auto seq(FirstType f, LastType l) -> decltype(seqN(typename internal::cleanup_index_type< FirstType >::type(f),(typename internal::cleanup_index_type< LastType >::type(l) - typename internal::cleanup_index_type< FirstType >::type(f)+fix< 1 >())))
Definition: ArithmeticSequence.h:152
r
Definition: UniformPSDSelfTest.py:20
int c
Definition: calibrate.py:100
list x
Definition: plotDoE.py:28
bool is_sorted(const T &mat)
Definition: sparse_permutations.cpp:35
void check_begin_end_for_loop(Xpr xpr)
Definition: stl_iterators.cpp:41
bool is_generic_randaccess_stl_iterator(const internal::generic_randaccess_stl_iterator< XprType > &)
Definition: stl_iterators.cpp:27
bool is_default_constructible_and_assignable(const Iter &it)
Definition: stl_iterators.cpp:32
std::reverse_iterator< Iterator > make_reverse_iterator(Iterator i)
Definition: stl_iterators.cpp:15
bool is_pointer_based_stl_iterator(const internal::pointer_based_stl_iterator< XprType > &)
Definition: stl_iterators.cpp:22
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References a, b, calibrate::c, check_begin_end_for_loop(), col(), cols, Eigen::PlainObjectBase< Derived >::cols(), Eigen::PlainObjectBase< Derived >::data(), Eigen::placeholders::end, i, is_default_constructible_and_assignable(), is_generic_randaccess_stl_iterator(), is_pointer_based_stl_iterator(), is_sorted(), j, Eigen::placeholders::last, make_reverse_iterator(), UniformPSDSelfTest::r, row(), rows, Eigen::PlainObjectBase< Derived >::rows(), Eigen::seq(), Eigen::PlainObjectBase< Derived >::setRandom(), Eigen::PlainObjectBase< Derived >::setZero(), STATIC_CHECK, swap(), tmp, v, v1(), Eigen::value, VERIFY, VERIFY_IS_APPROX, VERIFY_IS_EQUAL, VERIFY_IS_NOT_EQUAL, w, and plotDoE::x.