remove EIGEN_HAS_CXX11

This commit is contained in:
Erik Schultheis
2021-11-24 20:08:49 +00:00
committed by Rasmus Munk Larsen
parent cfdb3ce3f0
commit ec4efbd696
30 changed files with 14 additions and 629 deletions

View File

@@ -37,9 +37,7 @@ class AnnoyingScalar
AnnoyingScalar(float _v) { init(); *v = _v; }
AnnoyingScalar(int _v) { init(); *v = _v; }
AnnoyingScalar(long _v) { init(); *v = _v; }
#if EIGEN_HAS_CXX11
AnnoyingScalar(long long _v) { init(); *v = _v; }
#endif
AnnoyingScalar(const AnnoyingScalar& other) { init(); *v = *(other.v); }
~AnnoyingScalar() {
if(v!=&data)

View File

@@ -176,7 +176,6 @@ template<typename ArrayType> void array(const ArrayType& m)
FixedArrayType f4(f1.data());
VERIFY_IS_APPROX(f4, f1);
}
#if EIGEN_HAS_CXX11
{
FixedArrayType f1{s1};
VERIFY_IS_APPROX(f1, FixedArrayType::Constant(s1));
@@ -188,7 +187,6 @@ template<typename ArrayType> void array(const ArrayType& m)
FixedArrayType f4{f1.data()};
VERIFY_IS_APPROX(f4, f1);
}
#endif
// pow
VERIFY_IS_APPROX(m1.pow(2), m1.square());
@@ -214,14 +212,12 @@ template<typename ArrayType> void array(const ArrayType& m)
OneDArrayType o2(static_cast<int>(rows));
VERIFY(o2.size()==rows);
}
#if EIGEN_HAS_CXX11
{
OneDArrayType o1{rows};
VERIFY(o1.size()==rows);
OneDArrayType o4{int(rows)};
VERIFY(o4.size()==rows);
}
#endif
// Check possible conflicts with 2D ctor
typedef Array<Scalar, Dynamic, Dynamic> TwoDArrayType;
typedef Array<Scalar, 2, 1> ArrayType2;
@@ -238,7 +234,6 @@ template<typename ArrayType> void array(const ArrayType& m)
ArrayType2 o4(static_cast<int>(rows),static_cast<int>(cols));
VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols));
}
#if EIGEN_HAS_CXX11
{
TwoDArrayType o1{rows,cols};
VERIFY(o1.rows()==rows);
@@ -252,7 +247,6 @@ template<typename ArrayType> void array(const ArrayType& m)
ArrayType2 o4{int(rows),int(cols)};
VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols));
}
#endif
}
template<typename ArrayType> void comparisons(const ArrayType& m)

View File

@@ -69,10 +69,8 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
x = v1(static_cast<unsigned int>(r1));
x = v1(static_cast<signed long>(r1));
x = v1(static_cast<unsigned long>(r1));
#if EIGEN_HAS_CXX11
x = v1(static_cast<long long int>(r1));
x = v1(static_cast<unsigned long long int>(r1));
#endif
VERIFY_IS_APPROX( v1, v1);
VERIFY_IS_NOT_APPROX( v1, 2*v1);
@@ -231,10 +229,8 @@ struct casting_test_runner {
casting_test<SrcScalar, uint16_t>::run();
casting_test<SrcScalar, int32_t>::run();
casting_test<SrcScalar, uint32_t>::run();
#if EIGEN_HAS_CXX11
casting_test<SrcScalar, int64_t>::run();
casting_test<SrcScalar, uint64_t>::run();
#endif
casting_test<SrcScalar, half>::run();
casting_test<SrcScalar, bfloat16>::run();
casting_test<SrcScalar, float>::run();
@@ -264,10 +260,8 @@ void casting_all() {
casting_test_runner<uint16_t>::run();
casting_test_runner<int32_t>::run();
casting_test_runner<uint32_t>::run();
#if EIGEN_HAS_CXX11
casting_test_runner<int64_t>::run();
casting_test_runner<uint64_t>::run();
#endif
casting_test_runner<half>::run();
casting_test_runner<bfloat16>::run();
casting_test_runner<float>::run();

View File

@@ -196,12 +196,7 @@ EIGEN_DECLARE_TEST(blasutil)
// TODO: Replace this by a call to numext::int64_t as soon as we have a way to
// detect the typedef for int64_t on all platforms
#if EIGEN_HAS_CXX11
CALL_SUBTEST_4(run_test<signed long long>());
#else
CALL_SUBTEST_4(run_test<signed long>());
#endif
CALL_SUBTEST_5(run_test<float_t>());
CALL_SUBTEST_6(run_test<double_t>());
CALL_SUBTEST_7(run_test<std::complex<float> >());

View File

@@ -13,7 +13,7 @@
#include <Eigen/Core>
#if EIGEN_HAS_TYPE_TRAITS && EIGEN_HAS_CXX11
#if EIGEN_HAS_TYPE_TRAITS
using DenseStorageD3x3 = Eigen::DenseStorage<double, 3, 3, 3, 3>;
static_assert(std::is_trivially_move_constructible<DenseStorageD3x3>::value, "DenseStorage not trivially_move_constructible");
static_assert(std::is_trivially_move_assignable<DenseStorageD3x3>::value, "DenseStorage not trivially_move_assignable");

View File

@@ -12,26 +12,6 @@
#define EIGEN_MAX_CPP_VER 11
#endif
#ifdef EIGEN_TEST_PART_3
// Make sure we also check c++98 max implementation
#define EIGEN_MAX_CPP_VER 03
// We need to disable this warning when compiling with c++11 while limiting Eigen to c++98
// Ideally we would rather configure the compiler to build in c++98 mode but this needs
// to be done at the CMakeLists.txt level.
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif
#if defined(__GNUC__) && (__GNUC__ >=9)
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif
#if defined(__clang__) && (__clang_major__ >= 10)
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#endif
#include <valarray>
#include <vector>
#include "main.h"
@@ -39,11 +19,8 @@
using Eigen::placeholders::all;
using Eigen::placeholders::last;
using Eigen::placeholders::lastp1;
#if EIGEN_HAS_CXX11
using Eigen::placeholders::lastN;
#include <array>
#endif
typedef std::pair<Index,Index> IndexPair;
@@ -225,7 +202,6 @@ void check_indexed_view()
VERIFY( is_same_seq_type( seqN(2,fix<5>(5),fix<-2>), seqN(2,fix<5>,fix<-2>()) ) );
VERIFY( is_same_seq_type( seq(2,fix<5>), seqN(2,4) ) );
#if EIGEN_HAS_CXX11
VERIFY( is_same_seq_type( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) );
VERIFY( is_same_seq( seqN(2,std::integral_constant<int,5>(),std::integral_constant<int,-2>()), seqN(2,fix<5>,fix<-2>()) ) );
VERIFY( is_same_seq( seq(std::integral_constant<int,1>(),std::integral_constant<int,5>(),std::integral_constant<int,2>()),
@@ -236,10 +212,6 @@ void check_indexed_view()
VERIFY( is_same_seq_type( seqN(2,std::integral_constant<int,5>()), seqN(2,fix<5>) ) );
VERIFY( is_same_seq_type( seq(std::integral_constant<int,1>(),std::integral_constant<int,5>()), seq(fix<1>,fix<5>) ) );
#else
// sorry, no compile-time size recovery in c++98/03
VERIFY( is_same_seq( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) );
#endif
VERIFY( (A(seqN(2,fix<5>), 5)).RowsAtCompileTime == 5);
VERIFY( (A(4, all)).ColsAtCompileTime == Dynamic);
@@ -315,7 +287,6 @@ void check_indexed_view()
A(seq(last-5,last-1,2), seqN(last-3,3,fix<-2>)).reverse() );
}
#if EIGEN_HAS_CXX11
// check lastN
VERIFY_IS_APPROX( a(lastN(3)), a.tail(3) );
VERIFY( MATCH( a(lastN(3)), "7\n8\n9" ) );
@@ -341,8 +312,6 @@ void check_indexed_view()
VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) );
VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 );
#endif
#endif
// check mat(i,j) with weird types for i and j
@@ -401,13 +370,11 @@ void check_indexed_view()
a(XX) = 1;
A(XX,YY) = 1;
// Anonymous enums only work with C++11
#if EIGEN_HAS_CXX11
enum { X=0, Y=1 };
a(X) = 1;
A(X,Y) = 1;
A(XX,Y) = 1;
A(X,YY) = 1;
#endif
// Check compilation of varying integer types as index types:
Index i = n/2;
@@ -447,13 +414,11 @@ void check_indexed_view()
VERIFY( MATCH( A(all,1)(1), "101"));
}
#if EIGEN_HAS_CXX11
//Bug IndexView with a single static row should be RowMajor:
{
// A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval();
STATIC_CHECK(( (internal::evaluator<decltype( A(1,seq(0,2,1)) )>::Flags & RowMajorBit) == RowMajorBit ));
}
#endif
}
@@ -462,7 +427,6 @@ EIGEN_DECLARE_TEST(indexed_view)
// for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( check_indexed_view() );
CALL_SUBTEST_2( check_indexed_view() );
CALL_SUBTEST_3( check_indexed_view() );
// }
// static checks of some internals:

View File

@@ -160,12 +160,10 @@ EIGEN_DECLARE_TEST(integer_types)
CALL_SUBTEST_6( integer_type_tests(Matrix<unsigned short, 4, 4>()) );
#if EIGEN_HAS_CXX11
CALL_SUBTEST_7( integer_type_tests(Matrix<long long, 11, 13>()) );
CALL_SUBTEST_7( signed_integer_type_tests(Matrix<long long, 11, 13>()) );
CALL_SUBTEST_8( integer_type_tests(Matrix<unsigned long long, Dynamic, 5>(1, 5)) );
#endif
}
CALL_SUBTEST_9( integer_types_extra<0>() );
}

View File

@@ -433,10 +433,8 @@ EIGEN_TEST_SCALAR_TEST_OVERLOAD(int)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned int)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(long)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long)
#if EIGEN_HAS_CXX11
EIGEN_TEST_SCALAR_TEST_OVERLOAD(long long)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long long)
#endif
EIGEN_TEST_SCALAR_TEST_OVERLOAD(float)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(double)
EIGEN_TEST_SCALAR_TEST_OVERLOAD(half)

View File

@@ -15,7 +15,6 @@ void check_dim(const Xpr& ) {
STATIC_CHECK( Xpr::NumDimensions == ExpectedDim );
}
#if EIGEN_HAS_CXX11
template<template <typename,int,int> class Object>
void map_num_dimensions()
{
@@ -58,8 +57,6 @@ using TArray = Array<Scalar,Rows,Cols>;
template<typename Scalar, int Rows, int Cols>
using TMatrix = Matrix<Scalar,Rows,Cols>;
#endif
EIGEN_DECLARE_TEST(num_dimensions)
{
int n = 10;
@@ -81,10 +78,7 @@ EIGEN_DECLARE_TEST(num_dimensions)
SparseVector<double> s(n);
CALL_SUBTEST( check_dim<1>(s) );
CALL_SUBTEST( check_dim<1>(s.head(2)) );
#if EIGEN_HAS_CXX11
CALL_SUBTEST( map_num_dimensions<TArray>() );
CALL_SUBTEST( map_num_dimensions<TMatrix>() );
#endif
}

View File

@@ -10,9 +10,7 @@
#define EIGEN_RUNTIME_NO_MALLOC
#include "main.h"
#if EIGEN_HAS_CXX11
#include "MovableScalar.h"
#endif
#include "SafeScalar.h"
#include <Eigen/Core>
@@ -148,10 +146,8 @@ EIGEN_DECLARE_TEST(rvalue_types)
CALL_SUBTEST_4((rvalue_transpositions<Transpositions<Dynamic, Dynamic, int> >(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));
CALL_SUBTEST_4((rvalue_transpositions<Transpositions<Dynamic, Dynamic, Index> >(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));
#if EIGEN_HAS_CXX11
CALL_SUBTEST_5(rvalue_move(Eigen::Matrix<MovableScalar<float>,1,3>::Random().eval()));
CALL_SUBTEST_5(rvalue_move(Eigen::Matrix<SafeScalar<float>,1,3>::Random().eval()));
CALL_SUBTEST_5(rvalue_move(Eigen::Matrix<SafeScalar<float>,Eigen::Dynamic,Eigen::Dynamic>::Random(1,3).eval()));
#endif
}
}

View File

@@ -14,8 +14,6 @@
#include "main.h"
#if EIGEN_HAS_CXX11
#ifdef min
#undef min
#endif
@@ -27,8 +25,6 @@
#include <unordered_map>
#define EIGEN_UNORDERED_MAP_SUPPORT
#endif
#include <Eigen/Cholesky>
#include <Eigen/LU>
#include <Eigen/Sparse>

View File

@@ -18,28 +18,7 @@ make_reverse_iterator( Iterator i )
return std::reverse_iterator<Iterator>(i);
}
#if !EIGEN_HAS_CXX11
template<class ForwardIt>
ForwardIt is_sorted_until(ForwardIt firstIt, ForwardIt lastIt)
{
if (firstIt != lastIt) {
ForwardIt next = firstIt;
while (++next != lastIt) {
if (*next < *firstIt)
return next;
firstIt = next;
}
}
return lastIt;
}
template<class ForwardIt>
bool is_sorted(ForwardIt firstIt, ForwardIt lastIt)
{
return ::is_sorted_until(firstIt, lastIt) == lastIt;
}
#else
using std::is_sorted;
#endif
template<typename XprType>
bool is_pointer_based_stl_iterator(const internal::pointer_based_stl_iterator<XprType> &) { return true; }
@@ -50,10 +29,8 @@ bool is_generic_randaccess_stl_iterator(const internal::generic_randaccess_stl_i
template<typename Iter>
bool is_default_constructible_and_assignable(const Iter& it)
{
#if EIGEN_HAS_CXX11
VERIFY(std::is_default_constructible<Iter>::value);
VERIFY(std::is_nothrow_default_constructible<Iter>::value);
#endif
Iter it2;
it2 = it;
return (it==it2);
@@ -82,12 +59,10 @@ void check_begin_end_for_loop(Xpr xpr)
typename Xpr::const_iterator cit = xpr.begin();
cit = xpr.cbegin();
#if EIGEN_HAS_CXX11
auto tmp1 = xpr.begin();
VERIFY(tmp1==xpr.begin());
auto tmp2 = xpr.cbegin();
VERIFY(tmp2==xpr.cbegin());
#endif
}
VERIFY( xpr.end() -xpr.begin() == xpr.size() );
@@ -123,9 +98,7 @@ template<typename Scalar, int Rows, int Cols>
void test_stl_iterators(int rows=Rows, int cols=Cols)
{
typedef Matrix<Scalar,Rows,1> VectorType;
#if EIGEN_HAS_CXX11
typedef Matrix<Scalar,1,Cols> RowVectorType;
#endif
typedef Matrix<Scalar,Rows,Cols,ColMajor> ColMatrixType;
typedef Matrix<Scalar,Rows,Cols,RowMajor> RowMatrixType;
VectorType v = VectorType::Random(rows);
@@ -191,7 +164,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
check_begin_end_for_loop(v+v);
}
#if EIGEN_HAS_CXX11
// check swappable
{
using std::swap;
@@ -326,8 +298,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
}
}
#endif
if(rows>=3) {
VERIFY_IS_EQUAL((v.begin()+rows/2)[1], v(rows/2+1));
@@ -344,11 +314,7 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
if(rows>=2)
{
v(1) = v(0)-Scalar(1);
#if EIGEN_HAS_CXX11
VERIFY(!is_sorted(std::begin(v),std::end(v)));
#else
VERIFY(!is_sorted(v.cbegin(),v.cend()));
#endif
}
// on a vector
@@ -428,7 +394,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
VERIFY_IS_APPROX(v1(rows/4), v(rows/4));
}
#if EIGEN_HAS_CXX11
// check rows/cols iterators with range-for loops
{
j = 0;
@@ -492,12 +457,9 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cend (std::declval<const VecOp&>()))>::value ));
#endif
}
#endif
}
#if EIGEN_HAS_CXX11
// When the compiler sees expression IsContainerTest<C>(0), if C is an
// STL-style container class, the first overload of IsContainerTest
// will be viable (since both C::iterator* and C::const_iterator* are
@@ -545,7 +507,6 @@ void test_stl_container_detection(int rows=Rows, int cols=Cols)
VERIFY_IS_EQUAL(IsContainerType<ColMatrixType>(0), rows == 1 || cols == 1);
VERIFY_IS_EQUAL(IsContainerType<RowMatrixType>(0), rows == 1 || cols == 1);
}
#endif
EIGEN_DECLARE_TEST(stl_iterators)
{
@@ -555,9 +516,7 @@ EIGEN_DECLARE_TEST(stl_iterators)
CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(5,10), internal::random<int>(5,10)) ));
CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(10,200), internal::random<int>(10,200)) ));
}
#if EIGEN_HAS_CXX11
CALL_SUBTEST_1(( test_stl_container_detection<float,1,1>() ));
CALL_SUBTEST_1(( test_stl_container_detection<float,5,5>() ));
#endif
}

View File

@@ -7,16 +7,6 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifdef EIGEN_TEST_PART_2
#define EIGEN_MAX_CPP_VER 03
// see indexed_view.cpp
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif
#endif
#include "main.h"
using Eigen::placeholders::last;
@@ -84,5 +74,4 @@ void check_symbolic_index()
EIGEN_DECLARE_TEST(symbolic_index)
{
CALL_SUBTEST_1( check_symbolic_index() );
CALL_SUBTEST_2( check_symbolic_index() );
}

View File

@@ -18,8 +18,6 @@ EIGEN_DECLARE_TEST(type_alias)
STATIC_CHECK((is_same<Matrix2f,Matrix<float,2,2> >::value));
STATIC_CHECK((is_same<Array33i,Array<int,3,3> >::value));
#if EIGEN_HAS_CXX11
STATIC_CHECK((is_same<MatrixX<double>, MatrixXd>::value));
STATIC_CHECK((is_same<MatrixX<int>, MatrixXi>::value));
STATIC_CHECK((is_same<Matrix2<int>, Matrix2i>::value));
@@ -42,7 +40,4 @@ EIGEN_DECLARE_TEST(type_alias)
STATIC_CHECK((is_same<RowVector<float,3>, RowVector3f>::value));
STATIC_CHECK((is_same<RowVector<int,Dynamic>, RowVectorXi>::value));
#else
std::cerr << "WARNING: c++11 type aliases not tested.\n";
#endif
}