mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-30 15:54:13 +08:00
Enable C++11 math function in a more conservative manner.
This commit is contained in:
parent
916ef52fff
commit
84d103bee8
@ -367,7 +367,7 @@ inline NewType cast(const OldType& x)
|
|||||||
* Implementation of round *
|
* Implementation of round *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct round_impl {
|
struct round_impl {
|
||||||
static inline Scalar run(const Scalar& x)
|
static inline Scalar run(const Scalar& x)
|
||||||
@ -401,7 +401,7 @@ struct round_retval
|
|||||||
* Implementation of arg *
|
* Implementation of arg *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct arg_impl {
|
struct arg_impl {
|
||||||
static inline Scalar run(const Scalar& x)
|
static inline Scalar run(const Scalar& x)
|
||||||
@ -458,7 +458,7 @@ struct log1p_impl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct log1p_impl<Scalar, false> {
|
struct log1p_impl<Scalar, false> {
|
||||||
static inline Scalar run(const Scalar& x)
|
static inline Scalar run(const Scalar& x)
|
||||||
@ -784,7 +784,7 @@ template<typename T>
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
bool (isfinite)(const T& x)
|
bool (isfinite)(const T& x)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
using std::isfinite;
|
using std::isfinite;
|
||||||
return isfinite(x);
|
return isfinite(x);
|
||||||
#else
|
#else
|
||||||
@ -803,7 +803,7 @@ template<typename T>
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
bool (isnan)(const T& x)
|
bool (isnan)(const T& x)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
using std::isnan;
|
using std::isnan;
|
||||||
return isnan(x);
|
return isnan(x);
|
||||||
#else
|
#else
|
||||||
@ -822,7 +822,7 @@ template<typename T>
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
bool (isinf)(const T& x)
|
bool (isinf)(const T& x)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_HAS_C99_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
using std::isinf;
|
using std::isinf;
|
||||||
return isinf(x);
|
return isinf(x);
|
||||||
#else
|
#else
|
||||||
|
@ -415,12 +415,15 @@
|
|||||||
#define EIGEN_HAS_CONSTEXPR 1
|
#define EIGEN_HAS_CONSTEXPR 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Does the compiler support C99 math?
|
// 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
|
// Let's be conservative and enable the default C++11 implementation only if we are sure it exists
|
||||||
#if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
#ifndef EIGEN_HAS_CXX11_MATH
|
||||||
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) || \
|
#if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
||||||
(EIGEN_COMP_GNUC_STRICT || (EIGEN_COMP_ICC && EIGEN_COMP_GNUC) || (EIGEN_COMP_CLANG) || (EIGEN_COMP_MSVC >= 1800))
|
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC)
|
||||||
#define EIGEN_HAS_C99_MATH 1
|
#define EIGEN_HAS_CXX11_MATH 1
|
||||||
|
#else
|
||||||
|
#define EIGEN_HAS_CXX11_MATH 0
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user