aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-09-15 14:35:10 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-09-15 14:35:10 +0200
commit2014c7ae28c592063f6887632682231ed862cfc5 (patch)
tree6499725a5db05bab76108a8d2bb6fa2a531e06e8 /test
parent8e2be7777eb9b8e75bc40abaa585656e34915565 (diff)
Move all, last, end from Eigen::placeholders namespace to Eigen::, and rename end to lastp1 to avoid conflicts with std::end.
Diffstat (limited to 'test')
-rw-r--r--test/indexed_view.cpp10
-rw-r--r--test/symbolic_index.cpp20
2 files changed, 11 insertions, 19 deletions
diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp
index e6ffe5a74..9a284cf0a 100644
--- a/test/indexed_view.cpp
+++ b/test/indexed_view.cpp
@@ -82,10 +82,6 @@ enum DummyEnum { XX=0, YY=1 };
void check_indexed_view()
{
- using Eigen::placeholders::all;
- using Eigen::placeholders::last;
- using Eigen::placeholders::end;
-
Index n = 10;
ArrayXd a = ArrayXd::LinSpaced(n,0,n-1);
@@ -239,7 +235,7 @@ void check_indexed_view()
VERIFY_IS_APPROX( A(seq(n-1,2,-2), seqN(n-1-6,4)), A(seq(last,2,-2), seqN(last-6,4)) );
VERIFY_IS_APPROX( A(seq(n-1-6,n-1-2), seqN(n-1-6,4)), A(seq(last-6,last-2), seqN(6+last-6-6,4)) );
VERIFY_IS_APPROX( A(seq((n-1)/2,(n)/2+3), seqN(2,4)), A(seq(last/2,(last+1)/2+3), seqN(last+2-last,4)) );
- VERIFY_IS_APPROX( A(seq(n-2,2,-2), seqN(n-8,4)), A(seq(end-2,2,-2), seqN(end-8,4)) );
+ VERIFY_IS_APPROX( A(seq(n-2,2,-2), seqN(n-8,4)), A(seq(lastp1-2,2,-2), seqN(lastp1-8,4)) );
// Check all combinations of seq:
VERIFY_IS_APPROX( A(seq(1,n-1-2,2), seq(1,n-1-2,2)), A(seq(1,last-2,2), seq(1,last-2,fix<2>)) );
@@ -249,7 +245,7 @@ void check_indexed_view()
VERIFY_IS_APPROX( A(seq(n-1-5,n-1-2), seq(n-1-5,n-1-2)), A(seq(last-5,last-2), seq(last-5,last-2)) );
VERIFY_IS_APPROX( A.col(A.cols()-1), A(all,last) );
- VERIFY_IS_APPROX( A(A.rows()-2, A.cols()/2), A(last-1, end/2) );
+ VERIFY_IS_APPROX( A(A.rows()-2, A.cols()/2), A(last-1, lastp1/2) );
VERIFY_IS_APPROX( a(a.size()-2), a(last-1) );
VERIFY_IS_APPROX( a(a.size()/2), a((last+1)/2) );
@@ -272,7 +268,7 @@ void check_indexed_view()
VERIFY( is_same_eq(a.head(4), a(seq(0,3))) );
VERIFY( is_same_eq(a.tail(4), a(seqN(last-3,4))) );
- VERIFY( is_same_eq(a.tail(4), a(seq(end-4,last))) );
+ VERIFY( is_same_eq(a.tail(4), a(seq(lastp1-4,last))) );
VERIFY( is_same_eq(a.segment<4>(3), a(seqN(3,fix<4>))) );
}
diff --git a/test/symbolic_index.cpp b/test/symbolic_index.cpp
index 02db2eb51..bccf1b884 100644
--- a/test/symbolic_index.cpp
+++ b/test/symbolic_index.cpp
@@ -54,7 +54,6 @@ is_same_type(const T1&, const T2&)
template<typename T1,typename T2>
bool is_same_symb(const T1& a, const T2& b, Index size)
{
- using Eigen::placeholders::last;
return a.eval(last=size-1) == b.eval(last=size-1);
}
@@ -72,14 +71,11 @@ void check_isnot_symbolic(const T&) {
void check_symbolic_index()
{
- using Eigen::placeholders::last;
- using Eigen::placeholders::end;
-
check_is_symbolic(last);
- check_is_symbolic(end);
+ check_is_symbolic(lastp1);
check_is_symbolic(last+1);
- check_is_symbolic(last-end);
- check_is_symbolic(2*last-end/2);
+ check_is_symbolic(last-lastp1);
+ check_is_symbolic(2*last-lastp1/2);
check_isnot_symbolic(fix<3>());
Index size=100;
@@ -93,14 +89,14 @@ void check_symbolic_index()
VERIFY( is_same_type( fix<9>()|fix<2>(), fix<9|2>() ) );
VERIFY( is_same_type( fix<9>()/2, int(9/2) ) );
- VERIFY( is_same_symb( end-1, last, size) );
- VERIFY( is_same_symb( end-fix<1>, last, size) );
+ VERIFY( is_same_symb( lastp1-1, last, size) );
+ VERIFY( is_same_symb( lastp1-fix<1>, last, size) );
VERIFY_IS_EQUAL( ( (last*5-2)/3 ).eval(last=size-1), ((size-1)*5-2)/3 );
VERIFY_IS_EQUAL( ( (last*fix<5>-fix<2>)/fix<3> ).eval(last=size-1), ((size-1)*5-2)/3 );
- VERIFY_IS_EQUAL( ( -last*end ).eval(last=size-1), -(size-1)*size );
- VERIFY_IS_EQUAL( ( end-3*last ).eval(last=size-1), size- 3*(size-1) );
- VERIFY_IS_EQUAL( ( (end-3*last)/end ).eval(last=size-1), (size- 3*(size-1))/size );
+ VERIFY_IS_EQUAL( ( -last*lastp1 ).eval(last=size-1), -(size-1)*size );
+ VERIFY_IS_EQUAL( ( lastp1-3*last ).eval(last=size-1), size- 3*(size-1) );
+ VERIFY_IS_EQUAL( ( (lastp1-3*last)/lastp1 ).eval(last=size-1), (size- 3*(size-1))/size );
#if EIGEN_HAS_CXX14
{