mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Require recent GCC and MSCV and removed EIGEN_HAS_CXX14 and some other feature test macros
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
085c2fc5d5
commit
ec2fd0f7ed
@@ -62,7 +62,7 @@ struct plain_array
|
||||
|
||||
#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
|
||||
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
|
||||
#elif EIGEN_GNUC_AT_LEAST(4,7)
|
||||
#elif EIGEN_COMP_GNUC
|
||||
// GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned.
|
||||
// See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900
|
||||
// Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined:
|
||||
|
||||
@@ -116,10 +116,9 @@ namespace Eigen
|
||||
#else
|
||||
template <typename Derived,typename ScalarExponent>
|
||||
EIGEN_DEVICE_FUNC inline
|
||||
EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(
|
||||
const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<typename Derived::Scalar
|
||||
EIGEN_COMMA ScalarExponent EIGEN_COMMA
|
||||
EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent)>::type,pow))
|
||||
EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent)>::type,pow)
|
||||
pow(const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent)
|
||||
{
|
||||
typedef typename internal::promote_scalar_arg<typename Derived::Scalar,ScalarExponent,
|
||||
@@ -170,10 +169,9 @@ namespace Eigen
|
||||
#else
|
||||
template <typename Scalar, typename Derived>
|
||||
EIGEN_DEVICE_FUNC inline
|
||||
EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(
|
||||
const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<typename Derived::Scalar
|
||||
EIGEN_COMMA Scalar EIGEN_COMMA
|
||||
EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar)>::type,Derived,pow))
|
||||
EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar)>::type,Derived,pow)
|
||||
pow(const Scalar& x, const Eigen::ArrayBase<Derived>& exponents) {
|
||||
typedef typename internal::promote_scalar_arg<typename Derived::Scalar,Scalar,
|
||||
EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar)>::type PromotedScalar;
|
||||
|
||||
@@ -21,15 +21,6 @@
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
// On WINCE, std::abs is defined for int only, so let's defined our own overloads:
|
||||
// This issue has been confirmed with MSVC 2008 only, but the issue might exist for more recent versions too.
|
||||
#if EIGEN_OS_WINCE && EIGEN_COMP_MSVC && EIGEN_COMP_MSVC<=1500
|
||||
long abs(long x) { return (labs(x)); }
|
||||
double abs(double x) { return (fabs(x)); }
|
||||
float abs(float x) { return (fabsf(x)); }
|
||||
long double abs(long double x) { return (fabsl(x)); }
|
||||
#endif
|
||||
|
||||
namespace internal {
|
||||
|
||||
/** \internal \class global_math_functions_filtering_base
|
||||
@@ -963,7 +954,7 @@ inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random()
|
||||
// Implementation of is* functions
|
||||
|
||||
// std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang.
|
||||
#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG)
|
||||
#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC) || (EIGEN_COMP_CLANG)
|
||||
#define EIGEN_USE_STD_FPCLASSIFY 1
|
||||
#else
|
||||
#define EIGEN_USE_STD_FPCLASSIFY 0
|
||||
@@ -1049,7 +1040,7 @@ EIGEN_DEVICE_FUNC inline bool isinf_impl(const float& x) { return isinf_ms
|
||||
|
||||
#elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC)
|
||||
|
||||
#if EIGEN_GNUC_AT_LEAST(5,0)
|
||||
#if EIGEN_COMP_GNUC
|
||||
#define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only")))
|
||||
#else
|
||||
// NOTE the inline qualifier and noinline attribute are both needed: the former is to avoid linking issue (duplicate symbol),
|
||||
|
||||
@@ -621,7 +621,7 @@ inline float trig_reduce_huge (float xf, int *quadrant)
|
||||
template<bool ComputeSine,typename Packet>
|
||||
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
EIGEN_UNUSED
|
||||
#if EIGEN_GNUC_AT_LEAST(4,4) && EIGEN_COMP_GNUC_STRICT
|
||||
#if EIGEN_COMP_GNUC_STRICT
|
||||
__attribute__((optimize("-fno-unsafe-math-optimizations")))
|
||||
#endif
|
||||
Packet psincos_float(const Packet& _x)
|
||||
|
||||
@@ -247,18 +247,9 @@ template<> struct scalar_div_cost<float,true> { enum { value = 7 }; };
|
||||
template<> struct scalar_div_cost<double,true> { enum { value = 8 }; };
|
||||
#endif
|
||||
|
||||
#if EIGEN_COMP_MSVC==1500
|
||||
// Workaround MSVC 9 internal compiler error.
|
||||
// TODO: It has been detected with win64 builds (amd64), so let's check whether it also happens in 32bits+SSE mode
|
||||
// TODO: let's check whether there does not exist a better fix, like adding a pset0() function. (it crashed on pset1(0)).
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set_ps(from,from,from,from); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set_pd(from,from); }
|
||||
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set_epi32(from,from,from,from); }
|
||||
#else
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set_ps1(from); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
|
||||
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set1_epi32(from); }
|
||||
#endif
|
||||
template<> EIGEN_STRONG_INLINE Packet16b pset1<Packet16b>(const bool& from) { return _mm_set1_epi8(static_cast<char>(from)); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pset1frombits<Packet4f>(unsigned int from) { return _mm_castsi128_ps(pset1<Packet4i>(from)); }
|
||||
@@ -721,15 +712,7 @@ template<> EIGEN_STRONG_INLINE Packet16b pload<Packet16b>(const bool* from)
|
||||
#if EIGEN_COMP_MSVC
|
||||
template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from) {
|
||||
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||
#if (EIGEN_COMP_MSVC==1600)
|
||||
// NOTE Some version of MSVC10 generates bad code when using _mm_loadu_ps
|
||||
// (i.e., it does not generate an unaligned load!!
|
||||
__m128 res = _mm_loadl_pi(_mm_set1_ps(0.0f), (const __m64*)(from));
|
||||
res = _mm_loadh_pi(res, (const __m64*)(from+2));
|
||||
return res;
|
||||
#else
|
||||
return _mm_loadu_ps(from);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// NOTE: with the code below, MSVC's compiler crashes!
|
||||
|
||||
@@ -154,7 +154,7 @@ template<typename Functor> struct functor_has_linear_access { enum { ret = !has_
|
||||
|
||||
// For unreliable compilers, let's specialize the has_*ary_operator
|
||||
// helpers so that at least built-in nullary functors work fine.
|
||||
#if !( (EIGEN_COMP_MSVC>1600) || (EIGEN_GNUC_AT_LEAST(4,8)) || (EIGEN_COMP_ICC>=1600))
|
||||
#if !( EIGEN_COMP_MSVC || EIGEN_COMP_GNUC || (EIGEN_COMP_ICC>=1600))
|
||||
template<typename Scalar,typename IndexType>
|
||||
struct has_nullary_operator<scalar_constant_op<Scalar>,IndexType> { enum { value = 1}; };
|
||||
template<typename Scalar,typename IndexType>
|
||||
|
||||
@@ -30,27 +30,13 @@
|
||||
*
|
||||
* If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
|
||||
* vectorized and non-vectorized code.
|
||||
*
|
||||
* FIXME: this code can be cleaned up once we switch to proper C++11 only.
|
||||
*/
|
||||
#if (defined EIGEN_CUDACC)
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n)
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#elif EIGEN_HAS_ALIGNAS
|
||||
#else
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) alignas(n)
|
||||
#define EIGEN_ALIGNOF(x) alignof(x)
|
||||
#elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#elif EIGEN_COMP_MSVC
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#elif EIGEN_COMP_SUNCC
|
||||
// FIXME not sure about this one:
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#else
|
||||
#error Please tell me what is the equivalent of alignas(n) and alignof(x) for your compiler
|
||||
#endif
|
||||
|
||||
// If the user explicitly disable vectorization, then we also disable alignment
|
||||
@@ -200,14 +186,12 @@
|
||||
// removed as gcc 4.1 and msvc 2008 are not supported anyways.
|
||||
#if EIGEN_COMP_MSVC
|
||||
#include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled
|
||||
#if (EIGEN_COMP_MSVC >= 1500) // 2008 or later
|
||||
// a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
|
||||
#if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || EIGEN_ARCH_x86_64
|
||||
#define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
|
||||
#endif
|
||||
// a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
|
||||
#if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || EIGEN_ARCH_x86_64
|
||||
#define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
|
||||
#endif
|
||||
#else
|
||||
#if (defined __SSE2__) && ( (!EIGEN_COMP_GNUC) || EIGEN_COMP_ICC || EIGEN_GNUC_AT_LEAST(4,2) )
|
||||
#if (defined __SSE2__) && ( (!EIGEN_COMP_GNUC) || EIGEN_COMP_ICC || EIGEN_COMP_GNUC )
|
||||
#define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -129,10 +129,6 @@
|
||||
|
||||
// For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC:
|
||||
// name ver MSC_VER
|
||||
// 2008 9 1500
|
||||
// 2010 10 1600
|
||||
// 2012 11 1700
|
||||
// 2013 12 1800
|
||||
// 2015 14 1900
|
||||
// "15" 15 1900
|
||||
// 2017-14.1 15.0 1910
|
||||
@@ -140,6 +136,9 @@
|
||||
// 2017-14.12 15.5 1912
|
||||
// 2017-14.13 15.6 1913
|
||||
// 2017-14.14 15.7 1914
|
||||
// 2017 15.8 1915
|
||||
// 2017 15.9 1916
|
||||
// 2019 RTW 16.0 1920
|
||||
|
||||
/// \internal EIGEN_COMP_MSVC_LANG set to _MSVC_LANG if the compiler is Microsoft Visual C++, 0 otherwise.
|
||||
#if defined(_MSVC_LANG)
|
||||
@@ -581,16 +580,6 @@
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
|
||||
// Some old compilers do not support template specializations like:
|
||||
// template<typename T,int N> void foo(const T x[N]);
|
||||
#if !( EIGEN_COMP_CLANG && ( (EIGEN_COMP_CLANG<309) \
|
||||
|| (defined(__apple_build_version__) && (__apple_build_version__ < 9000000))) \
|
||||
|| EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<49)
|
||||
#define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 1
|
||||
#else
|
||||
#define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 0
|
||||
#endif
|
||||
|
||||
// The macro EIGEN_CPLUSPLUS is a replacement for __cplusplus/_MSVC_LANG that
|
||||
// works for both platforms, indicating the C++ standard version number.
|
||||
//
|
||||
@@ -624,7 +613,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_HAS_CXX14_VARIABLE_TEMPLATES
|
||||
#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && EIGEN_MAX_CPP_VER>=14
|
||||
#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304
|
||||
#define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 1
|
||||
#else
|
||||
#define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 0
|
||||
@@ -636,17 +625,13 @@
|
||||
// but in practice we should not rely on them but rather on the availability of
|
||||
// individual features as defined later.
|
||||
// This is why there is no EIGEN_HAS_CXX17.
|
||||
// FIXME: get rid of EIGEN_HAS_CXX14.
|
||||
#if EIGEN_MAX_CPP_VER<11 || EIGEN_COMP_CXXVER<11 || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1700) || (EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1400)
|
||||
#if EIGEN_MAX_CPP_VER<14 || EIGEN_COMP_CXXVER<14 || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
|
||||
(EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || (EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
|
||||
(EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000)))) || \
|
||||
(EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<51)
|
||||
#error This compiler appears to be too old to be supported by Eigen
|
||||
#endif
|
||||
|
||||
#if EIGEN_MAX_CPP_VER>=14 && EIGEN_COMP_CXXVER>=14
|
||||
#define EIGEN_HAS_CXX14 1
|
||||
#else
|
||||
#define EIGEN_HAS_CXX14 0
|
||||
#endif
|
||||
|
||||
// Does the compiler support C99?
|
||||
// Need to include <cmath> to make sure _GLIBCXX_USE_C99 gets defined
|
||||
#include <cmath>
|
||||
@@ -654,7 +639,7 @@
|
||||
#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
|
||||
|| (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
|
||||
|| (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \
|
||||
|| (EIGEN_COMP_MSVC >= 1900) || defined(SYCL_DEVICE_ONLY))
|
||||
|| (EIGEN_COMP_MSVC) || defined(SYCL_DEVICE_ONLY))
|
||||
#define EIGEN_HAS_C99_MATH 1
|
||||
#else
|
||||
#define EIGEN_HAS_C99_MATH 0
|
||||
@@ -690,27 +675,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_HAS_ALIGNAS
|
||||
#if ( __has_feature(cxx_alignas) \
|
||||
|| EIGEN_HAS_CXX14 \
|
||||
|| (EIGEN_COMP_MSVC >= 1800) \
|
||||
|| (EIGEN_GNUC_AT_LEAST(4,8)) \
|
||||
|| (EIGEN_COMP_CLANG>=305) \
|
||||
|| (EIGEN_COMP_ICC>=1500) \
|
||||
|| (EIGEN_COMP_PGI>=1500) \
|
||||
|| (EIGEN_COMP_SUNCC>=0x5130))
|
||||
#define EIGEN_HAS_ALIGNAS 1
|
||||
#else
|
||||
#define EIGEN_HAS_ALIGNAS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Does the compiler support type_traits?
|
||||
// - full support of type traits was added only to GCC 5.1.0.
|
||||
// - 20150626 corresponds to the last release of 4.x libstdc++
|
||||
#ifndef EIGEN_HAS_TYPE_TRAITS
|
||||
#if ((!EIGEN_COMP_GNUC_STRICT) || EIGEN_GNUC_AT_LEAST(5, 1)) \
|
||||
&& ((!defined(__GLIBCXX__)) || __GLIBCXX__ > 20150626)
|
||||
#if (!defined(__GLIBCXX__)) || __GLIBCXX__ > 20150626
|
||||
#define EIGEN_HAS_TYPE_TRAITS 1
|
||||
#define EIGEN_INCLUDE_TYPE_TRAITS
|
||||
#else
|
||||
@@ -718,29 +687,14 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Does the compiler support variadic templates?
|
||||
#ifndef EIGEN_HAS_VARIADIC_TEMPLATES
|
||||
#if (!defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64 || (EIGEN_COMP_NVCC >= 80000) )
|
||||
// ^^ Disable the use of variadic templates when compiling with versions of nvcc older than 8.0 on ARM devices:
|
||||
// this prevents nvcc from crashing when compiling Eigen on Tegra X1
|
||||
#define EIGEN_HAS_VARIADIC_TEMPLATES 1
|
||||
#elif defined(SYCL_DEVICE_ONLY)
|
||||
#define EIGEN_HAS_VARIADIC_TEMPLATES 1
|
||||
#else
|
||||
#define EIGEN_HAS_VARIADIC_TEMPLATES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Does the compiler fully support const expressions? (as in c++14)
|
||||
#ifndef EIGEN_HAS_CONSTEXPR
|
||||
#if defined(EIGEN_CUDACC)
|
||||
// Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above
|
||||
#if EIGEN_MAX_CPP_VER>=14 && (EIGEN_COMP_CLANG || EIGEN_COMP_NVCC >= 70500)
|
||||
#if (EIGEN_COMP_CLANG || EIGEN_COMP_NVCC >= 70500)
|
||||
#define EIGEN_HAS_CONSTEXPR 1
|
||||
#endif
|
||||
#elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (EIGEN_COMP_CXXVER >= 14) || \
|
||||
(EIGEN_GNUC_AT_LEAST(4,8) && (EIGEN_COMP_CXXVER >= 11)) || \
|
||||
(EIGEN_COMP_CLANG >= 306 && (EIGEN_COMP_CXXVER >= 11)))
|
||||
#else
|
||||
#define EIGEN_HAS_CONSTEXPR 1
|
||||
#endif
|
||||
|
||||
@@ -759,8 +713,7 @@
|
||||
// Does the compiler support C++11 math?
|
||||
// Let's be conservative and enable the default C++11 implementation only if we are sure it exists
|
||||
#ifndef EIGEN_HAS_CXX11_MATH
|
||||
#if ((EIGEN_COMP_CXXVER > 11) || (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
||||
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC))
|
||||
#if (EIGEN_ARCH_i386_OR_x86_64 && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC))
|
||||
#define EIGEN_HAS_CXX11_MATH 1
|
||||
#else
|
||||
#define EIGEN_HAS_CXX11_MATH 0
|
||||
@@ -844,15 +797,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible
|
||||
// EIGEN_ALWAYS_INLINE is the strongest, it has the effect of making the function inline and adding every possible
|
||||
// attribute to maximize inlining. This should only be used when really necessary: in particular,
|
||||
// it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
|
||||
// FIXME with the always_inline attribute,
|
||||
// gcc 3.4.x and 4.1 reports the following compilation error:
|
||||
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
|
||||
// : function body not available
|
||||
// See also bug 1367
|
||||
#if EIGEN_GNUC_AT_LEAST(4,2) && !defined(SYCL_DEVICE_ONLY)
|
||||
#if EIGEN_COMP_GNUC && !defined(SYCL_DEVICE_ONLY)
|
||||
#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
|
||||
#else
|
||||
#define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
|
||||
@@ -1094,8 +1043,8 @@ namespace Eigen {
|
||||
#define EIGEN_USING_STD(FUNC) using std::FUNC;
|
||||
#endif
|
||||
|
||||
#if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || EIGEN_COMP_NVCC)
|
||||
// For older MSVC versions, as well as when compiling with NVCC, using the base operator is necessary,
|
||||
#if EIGEN_COMP_MSVC_STRICT && EIGEN_COMP_NVCC
|
||||
// Wwhen compiling with NVCC, using the base operator is necessary,
|
||||
// otherwise we get duplicate definition errors
|
||||
// For later MSVC versions, we require explicit operator= definition, otherwise we get
|
||||
// use of implicitly deleted operator errors.
|
||||
@@ -1251,16 +1200,9 @@ namespace Eigen {
|
||||
CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<SCALAR,typename internal::traits<EXPR>::Scalar>, \
|
||||
const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR>
|
||||
|
||||
// Workaround for MSVC 2010 (see ML thread "patch with compile for for MSVC 2010")
|
||||
#if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC_STRICT<=1600)
|
||||
#define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) typename internal::enable_if<true,X>::type
|
||||
#else
|
||||
#define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) X
|
||||
#endif
|
||||
|
||||
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) \
|
||||
template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
|
||||
EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type,OPNAME))\
|
||||
const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type,OPNAME)\
|
||||
(METHOD)(const T& scalar) const { \
|
||||
typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type PromotedT; \
|
||||
return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedT,OPNAME)(derived(), \
|
||||
@@ -1269,7 +1211,7 @@ namespace Eigen {
|
||||
|
||||
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
|
||||
template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend \
|
||||
EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type,Derived,OPNAME)) \
|
||||
const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type,Derived,OPNAME) \
|
||||
(METHOD)(const T& scalar, const StorageBaseType& matrix) { \
|
||||
typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type PromotedT; \
|
||||
return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedT,Derived,OPNAME)( \
|
||||
@@ -1314,7 +1256,6 @@ namespace Eigen {
|
||||
#define EIGEN_EXCEPTION_SPEC(X) noexcept(false)
|
||||
|
||||
|
||||
#if EIGEN_HAS_VARIADIC_TEMPLATES
|
||||
// The all function is used to enable a variadic version of eigen_assert which can take a parameter pack as its input.
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
@@ -1326,7 +1267,6 @@ bool all(T t, Ts ... ts){ return t && all(ts...); }
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// provide override and final specifiers if they are available:
|
||||
#define EIGEN_OVERRIDE override
|
||||
|
||||
@@ -936,7 +936,7 @@ public:
|
||||
__asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "0" (func), "2" (id) );
|
||||
# endif
|
||||
# elif EIGEN_COMP_MSVC
|
||||
# if (EIGEN_COMP_MSVC > 1500) && EIGEN_ARCH_i386_OR_x86_64
|
||||
# if EIGEN_ARCH_i386_OR_x86_64
|
||||
# define EIGEN_CPUID(abcd,func,id) __cpuidex((int*)abcd,func,id)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -371,7 +371,7 @@ struct invoke_result {
|
||||
#endif
|
||||
|
||||
// C++14 integer/index_sequence.
|
||||
#if defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304L && EIGEN_MAX_CPP_VER >= 14
|
||||
#if defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304L
|
||||
|
||||
using std::integer_sequence;
|
||||
using std::make_integer_sequence;
|
||||
|
||||
@@ -92,10 +92,8 @@ public:
|
||||
template<typename T>
|
||||
Index eval(const T& values) const { return derived().eval_impl(values); }
|
||||
|
||||
#if EIGEN_HAS_CXX14
|
||||
template<typename... Types>
|
||||
Index eval(Types&&... values) const { return derived().eval_impl(std::make_tuple(values...)); }
|
||||
#endif
|
||||
|
||||
NegateExpr<Derived> operator-() const { return NegateExpr<Derived>(derived()); }
|
||||
|
||||
@@ -143,34 +141,6 @@ public:
|
||||
friend QuotientExpr<ValueExpr<internal::FixedInt<N> >,Derived> operator/(internal::FixedInt<N>, const BaseExpr& b)
|
||||
{ return QuotientExpr<ValueExpr<internal::FixedInt<N> > ,Derived>(ValueExpr<internal::FixedInt<N> >(),b.derived()); }
|
||||
|
||||
#if (!EIGEN_HAS_CXX14)
|
||||
template<int N>
|
||||
AddExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator+(internal::FixedInt<N> (*)()) const
|
||||
{ return AddExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(), ValueExpr<internal::FixedInt<N> >()); }
|
||||
template<int N>
|
||||
AddExpr<Derived,ValueExpr<internal::FixedInt<-N> > > operator-(internal::FixedInt<N> (*)()) const
|
||||
{ return AddExpr<Derived,ValueExpr<internal::FixedInt<-N> > >(derived(), ValueExpr<internal::FixedInt<-N> >()); }
|
||||
template<int N>
|
||||
ProductExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator*(internal::FixedInt<N> (*)()) const
|
||||
{ return ProductExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(),ValueExpr<internal::FixedInt<N> >()); }
|
||||
template<int N>
|
||||
QuotientExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator/(internal::FixedInt<N> (*)()) const
|
||||
{ return QuotientExpr<Derived,ValueExpr<internal::FixedInt<N> > >(derived(),ValueExpr<internal::FixedInt<N> >()); }
|
||||
|
||||
template<int N>
|
||||
friend AddExpr<Derived,ValueExpr<internal::FixedInt<N> > > operator+(internal::FixedInt<N> (*)(), const BaseExpr& b)
|
||||
{ return AddExpr<Derived,ValueExpr<internal::FixedInt<N> > >(b.derived(), ValueExpr<internal::FixedInt<N> >()); }
|
||||
template<int N>
|
||||
friend AddExpr<NegateExpr<Derived>,ValueExpr<internal::FixedInt<N> > > operator-(internal::FixedInt<N> (*)(), const BaseExpr& b)
|
||||
{ return AddExpr<NegateExpr<Derived>,ValueExpr<internal::FixedInt<N> > >(-b.derived(), ValueExpr<internal::FixedInt<N> >()); }
|
||||
template<int N>
|
||||
friend ProductExpr<ValueExpr<internal::FixedInt<N> >,Derived> operator*(internal::FixedInt<N> (*)(), const BaseExpr& b)
|
||||
{ return ProductExpr<ValueExpr<internal::FixedInt<N> >,Derived>(ValueExpr<internal::FixedInt<N> >(),b.derived()); }
|
||||
template<int N>
|
||||
friend QuotientExpr<ValueExpr<internal::FixedInt<N> >,Derived> operator/(internal::FixedInt<N> (*)(), const BaseExpr& b)
|
||||
{ return QuotientExpr<ValueExpr<internal::FixedInt<N> > ,Derived>(ValueExpr<internal::FixedInt<N> >(),b.derived()); }
|
||||
#endif
|
||||
|
||||
|
||||
template<typename OtherDerived>
|
||||
AddExpr<Derived,OtherDerived> operator+(const BaseExpr<OtherDerived> &b) const
|
||||
@@ -232,11 +202,9 @@ public:
|
||||
|
||||
Index eval_impl(const SymbolValue<Tag> &values) const { return values.value(); }
|
||||
|
||||
#if EIGEN_HAS_CXX14
|
||||
// C++14 versions suitable for multiple symbols
|
||||
template<typename... Types>
|
||||
Index eval_impl(const std::tuple<Types...>& values) const { return std::get<SymbolValue<Tag> >(values).value(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Arg0>
|
||||
|
||||
@@ -288,10 +288,7 @@ class SparseMatrix
|
||||
#else
|
||||
template<class SizesType>
|
||||
inline void reserve(const SizesType& reserveSizes, const typename SizesType::value_type& enableif =
|
||||
#if (!EIGEN_COMP_MSVC) || (EIGEN_COMP_MSVC>=1500) // MSVC 2005 fails to compile with this typename
|
||||
typename
|
||||
#endif
|
||||
SizesType::value_type())
|
||||
typename SizesType::value_type())
|
||||
{
|
||||
EIGEN_UNUSED_VARIABLE(enableif);
|
||||
reserveInnerVectors(reserveSizes);
|
||||
|
||||
@@ -105,8 +105,6 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_IND
|
||||
return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||
|
||||
// The following three overloads are needed to handle raw Index[N] arrays.
|
||||
|
||||
template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
|
||||
@@ -133,7 +131,6 @@ operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&col
|
||||
(derived(), rowIndices, colIndices);
|
||||
}
|
||||
|
||||
#endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||
|
||||
// Overloads for 1D vectors/arrays
|
||||
|
||||
@@ -178,8 +175,6 @@ operator()(const IndexType& id) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
return Base::operator()(internal::eval_expr_given_size(id,size()));
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||
|
||||
template<typename IndicesT, std::size_t IndicesN>
|
||||
typename internal::enable_if<IsRowMajor,
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
|
||||
@@ -200,8 +195,6 @@ operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
(derived(), indices, IvcIndex(0));
|
||||
}
|
||||
|
||||
#endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||
|
||||
#undef EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
#undef EIGEN_INDEXED_VIEW_METHOD_TYPE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user