Go to the documentation of this file.
11 #ifndef EIGEN_MATHFUNCTIONS_H
12 #define EIGEN_MATHFUNCTIONS_H
16 #define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L
17 #define EIGEN_LOG2E 1.442695040888963407359924681001892137426645954152985934135449406931109219L
18 #define EIGEN_LN2 0.693147180559945309417232121458176568075500134360255254120680009493393621L
24 #if EIGEN_OS_WINCE && EIGEN_COMP_MSVC && EIGEN_COMP_MSVC<=1500
25 long abs(
long x) {
return (labs(
x)); }
26 double abs(
double x) {
return (
fabs(
x)); }
27 float abs(
float x) {
return (fabsf(
x)); }
28 long double abs(
long double x) {
return (fabsl(
x)); }
53 template<
typename T,
typename dummy =
void>
64 typename
always_void<typename
T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl>
::type
67 typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl
type;
70 #define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl<typename Eigen::internal::global_math_functions_filtering_base<scalar>::type>
71 #define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval<typename Eigen::internal::global_math_functions_filtering_base<scalar>::type>::type
88 template<
typename Scalar>
102 #if defined(EIGEN_GPU_COMPILE_PHASE)
108 static inline T run(
const std::complex<T>&
x)
115 template<
typename Scalar>
136 template<
typename Scalar>
150 #if defined(EIGEN_GPU_COMPILE_PHASE)
156 static inline T run(
const std::complex<T>&
x)
163 template<
typename Scalar>
173 template<
typename Scalar>
189 template<
typename Scalar>
199 template<
typename Scalar,
bool IsComplex>
215 template<
typename Scalar>
230 template<
typename Scalar>
233 template<
typename Scalar>
253 template<
typename Scalar>
267 template<
typename Scalar>
277 template<
typename Scalar,
bool IsComplex>
288 template<
typename Scalar>
295 return x.real()*
x.real() +
x.imag()*
x.imag();
299 template<
typename Scalar>
310 template<
typename Scalar>
320 template<
typename Scalar>
342 return complex_sqrt<T>(
x);
346 template<
typename Scalar>
365 return complex_rsqrt<T>(
x);
369 template<
typename Scalar>
379 template<
typename Scalar,
bool IsComplex>
382 template<
typename Scalar>
390 return abs(
x.real()) +
abs(
x.imag());
394 template<
typename Scalar>
405 template<
typename Scalar>
408 template<
typename Scalar>
420 template<
typename Scalar>
430 template<
typename OldType,
typename NewType,
typename EnableIf =
void>
434 static inline NewType
run(
const OldType&
x)
436 return static_cast<NewType
>(
x);
442 template<
typename OldType,
typename NewType>
445 !NumTraits<OldType>::IsComplex && NumTraits<NewType>::IsComplex
449 static inline NewType
run(
const OldType&
x)
452 return static_cast<NewType
>(
static_cast<NewReal
>(
x));
458 template<
typename OldType,
typename NewType>
460 inline NewType
cast(
const OldType&
x)
469 template<
typename Scalar>
476 #if EIGEN_HAS_CXX11_MATH
483 #if !EIGEN_HAS_CXX11_MATH
484 #if EIGEN_HAS_C99_MATH
487 struct round_impl<
float> {
489 static inline float run(
const float&
x)
495 template<
typename Scalar>
508 if (
x >= limit ||
x <= -limit) {
520 #endif // EIGEN_HAS_C99_MATH
521 #endif // !EIGEN_HAS_CXX11_MATH
523 template<
typename Scalar>
533 template<
typename Scalar>
539 #if EIGEN_HAS_CXX11_MATH
546 #if !EIGEN_HAS_CXX11_MATH
550 static inline double run(
const double&
x)
558 static inline float run(
const float&
x)
565 template<
typename Scalar>
577 #if EIGEN_HAS_CXX11_MATH && (!EIGEN_COMP_MSVC || EIGEN_COMP_MSVC >= 1920)
585 template<
typename Scalar>
591 #if defined(EIGEN_HIP_DEVICE_COMPILE)
602 template<
typename Scalar>
603 struct arg_default_impl<
Scalar, false> {
623 template<
typename Scalar>
637 template<
typename Scalar>
648 namespace std_fallback {
652 template<
typename Scalar>
673 template<
typename Scalar>
678 #if EIGEN_HAS_CXX11_MATH
687 template<
typename Scalar>
700 template<
typename Scalar>
709 template<
typename Scalar>
721 namespace std_fallback {
724 template<
typename Scalar>
742 #if EIGEN_HAS_CXX11_MATH
752 template <
typename RealScalar>
755 const std::complex<RealScalar>&
x) {
761 template<
typename Scalar>
783 template<
typename ScalarX,
typename ScalarY>
812 template<
typename Scalar>
815 template<
typename Scalar>
824 template<
typename Scalar>
846 enum { middle = (
lower + upper) / 2,
854 template<
unsigned int n,
856 int upper =
sizeof(
unsigned int) * CHAR_BIT - 1,
860 template<
unsigned int n,
int lower,
int upper>
866 template<
unsigned int n,
int lower,
int upper>
872 template<
unsigned int n,
int lower,
int upper>
878 template<
unsigned int n,
int lower,
int upper>
884 template<
typename Scalar>
896 typedef typename conditional<(ScalarU(-1) > unsigned(-1)), ScalarU,
unsigned>::
type ScalarX;
900 ScalarX
range = ScalarX(
y) - ScalarX(
x);
903 ScalarX multiplier = 1;
904 const unsigned rand_max = RAND_MAX;
905 if (
range <= rand_max) divisor = (rand_max + 1) / (
range + 1);
906 else multiplier = 1 +
range / (rand_max + 1);
909 offset = (unsigned(std::rand()) * multiplier) / divisor;
916 #ifdef EIGEN_MAKING_DOCS
920 scalar_bits =
sizeof(
Scalar) * CHAR_BIT,
929 template<
typename Scalar>
934 return Scalar(random(
x.real(),
y.real()),
935 random(
x.imag(),
y.imag()));
940 return Scalar(random<RealScalar>(), random<RealScalar>());
944 template<
typename Scalar>
950 template<
typename Scalar>
959 #if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG)
960 #define EIGEN_USE_STD_FPCLASSIFY 1
962 #define EIGEN_USE_STD_FPCLASSIFY 0
985 #if defined(EIGEN_GPU_COMPILE_PHASE)
987 #elif EIGEN_USE_STD_FPCLASSIFY
1000 #if defined(EIGEN_GPU_COMPILE_PHASE)
1002 #elif EIGEN_USE_STD_FPCLASSIFY
1010 template<
typename T>
1015 #if defined(EIGEN_GPU_COMPILE_PHASE)
1017 #elif EIGEN_USE_STD_FPCLASSIFY
1025 #if (!EIGEN_USE_STD_FPCLASSIFY)
1031 return _fpclass(
x)==_FPCLASS_NINF || _fpclass(
x)==_FPCLASS_PINF;
1043 #elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC)
1045 #if EIGEN_GNUC_AT_LEAST(5,0)
1046 #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only")))
1050 #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((noinline,optimize("no-finite-math-only")))
1053 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isnan_impl(
const long double&
x) {
return __builtin_isnan(
x); }
1054 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isnan_impl(
const double&
x) {
return __builtin_isnan(
x); }
1055 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isnan_impl(
const float&
x) {
return __builtin_isnan(
x); }
1056 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isinf_impl(
const double&
x) {
return __builtin_isinf(
x); }
1057 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isinf_impl(
const float&
x) {
return __builtin_isinf(
x); }
1058 template<> EIGEN_TMP_NOOPT_ATTRIB
bool isinf_impl(
const long double&
x) {
return __builtin_isinf(
x); }
1060 #undef EIGEN_TMP_NOOPT_ATTRIB
1080 #if (!defined(EIGEN_GPUCC) || defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
1081 template<
typename T>
1089 template<
typename T>
1097 template<
typename T>
1101 return y <
x ?
y :
x;
1119 #if defined(EIGEN_HIPCC)
1121 return (
x <
y) ?
x :
y;
1127 template<
typename T>
1131 return x <
y ?
y :
x;
1149 #if defined(EIGEN_HIPCC)
1151 return (
x >
y) ?
x :
y;
1158 #if defined(SYCL_DEVICE_ONLY)
1161 #define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \
1162 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \
1163 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \
1164 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \
1165 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_long)
1166 #define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \
1167 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \
1168 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \
1169 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \
1170 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_long)
1171 #define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \
1172 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \
1173 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \
1174 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \
1175 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong)
1176 #define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \
1177 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \
1178 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \
1179 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \
1180 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong)
1181 #define SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(NAME, FUNC) \
1182 SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \
1183 SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC)
1184 #define SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(NAME, FUNC) \
1185 SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \
1186 SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC)
1187 #define SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(NAME, FUNC) \
1188 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \
1189 SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC,cl::sycl::cl_double)
1190 #define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(NAME, FUNC) \
1191 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \
1192 SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC,cl::sycl::cl_double)
1193 #define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(NAME, FUNC, RET_TYPE) \
1194 SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_float) \
1195 SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_double)
1197 #define SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \
1200 EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE& x) { \
1201 return cl::sycl::FUNC(x); \
1204 #define SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, TYPE) \
1205 SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, TYPE, TYPE)
1207 #define SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \
1210 EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE1& x, const ARG_TYPE2& y) { \
1211 return cl::sycl::FUNC(x, y); \
1214 #define SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \
1215 SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE, ARG_TYPE)
1217 #define SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, TYPE) \
1218 SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, TYPE, TYPE)
1220 SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(
mini,
min)
1221 SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(
mini,
fmin)
1222 SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(
maxi,
max)
1223 SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(
maxi,
fmax)
1228 template<
typename Scalar>
1235 template<
typename Scalar>
1242 template<
typename Scalar>
1249 template<
typename Scalar>
1256 template<
typename Scalar>
1263 template<
typename Scalar>
1270 template<
typename Scalar>
1277 template<
typename Scalar>
1284 template<
typename Scalar>
1292 inline bool abs2(
bool x) {
return x; }
1294 template<
typename T>
1313 #if !defined(EIGEN_GPUCC)
1318 return fabsl(
x -
y);
1322 template<
typename Scalar>
1329 template<
typename Scalar>
1336 #if defined(SYCL_DEVICE_ONLY)
1337 SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(hypot, hypot)
1340 template<
typename Scalar>
1347 #if defined(SYCL_DEVICE_ONLY)
1348 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
log1p,
log1p)
1351 #if defined(EIGEN_GPUCC)
1353 float log1p(
const float &
x) { return ::log1pf(
x); }
1359 template<
typename ScalarX,
typename ScalarY>
1366 #if defined(SYCL_DEVICE_ONLY)
1367 SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(
pow,
pow)
1374 #if defined(SYCL_DEVICE_ONLY)
1375 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(
isnan,
isnan,
bool)
1376 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(
isinf,
isinf,
bool)
1377 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(
isfinite,
isfinite,
bool)
1380 template<
typename Scalar>
1387 template<
typename Scalar>
1394 #if defined(SYCL_DEVICE_ONLY)
1395 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
round,
round)
1398 template<
typename T>
1406 #if defined(SYCL_DEVICE_ONLY)
1407 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
floor,
floor)
1410 #if defined(EIGEN_GPUCC)
1412 float floor(
const float &
x) { return ::floorf(
x); }
1418 template<
typename T>
1426 #if defined(SYCL_DEVICE_ONLY)
1427 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
ceil,
ceil)
1430 #if defined(EIGEN_GPUCC)
1432 float ceil(
const float &
x) { return ::ceilf(
x); }
1441 inline int log2(
int x)
1445 static const int table[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
1451 return table[(
v * 0x07C4ACDD
U) >> 27];
1463 template<
typename Scalar>
1475 #if defined(SYCL_DEVICE_ONLY)
1476 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
sqrt,
sqrt)
1480 template<
typename T>
1487 template<
typename T>
1493 #if defined(SYCL_DEVICE_ONLY)
1494 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
log,
log)
1498 #if defined(EIGEN_GPUCC)
1500 float log(
const float &
x) { return ::logf(
x); }
1506 template<
typename T>
1514 template<
typename T>
1521 #if defined(SYCL_DEVICE_ONLY)
1522 SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(
abs,
abs)
1523 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
abs,
fabs)
1526 #if defined(EIGEN_GPUCC)
1528 float abs(
const float &
x) { return ::fabsf(
x); }
1534 float abs(
const std::complex<float>&
x) {
1535 return ::hypotf(
x.real(),
x.imag());
1539 double abs(
const std::complex<double>&
x) {
1540 return ::hypot(
x.real(),
x.imag());
1544 template<
typename T>
1551 #if defined(SYCL_DEVICE_ONLY)
1552 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
exp,
exp)
1555 #if defined(EIGEN_GPUCC)
1557 float exp(
const float &
x) { return ::expf(
x); }
1563 std::complex<float>
exp(
const std::complex<float>&
x) {
1564 float com = ::expf(
x.real());
1565 float res_real = com * ::cosf(
x.imag());
1566 float res_imag = com * ::sinf(
x.imag());
1567 return std::complex<float>(res_real, res_imag);
1571 std::complex<double>
exp(
const std::complex<double>&
x) {
1572 double com =
::exp(
x.real());
1573 double res_real = com *
::cos(
x.imag());
1574 double res_imag = com *
::sin(
x.imag());
1575 return std::complex<double>(res_real, res_imag);
1579 template<
typename Scalar>
1586 #if defined(SYCL_DEVICE_ONLY)
1587 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
expm1,
expm1)
1590 #if defined(EIGEN_GPUCC)
1592 float expm1(
const float &
x) { return ::expm1f(
x); }
1598 template<
typename T>
1605 #if defined(SYCL_DEVICE_ONLY)
1606 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
cos,
cos)
1609 #if defined(EIGEN_GPUCC)
1611 float cos(
const float &
x) { return ::cosf(
x); }
1617 template<
typename T>
1624 #if defined(SYCL_DEVICE_ONLY)
1625 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
sin,
sin)
1628 #if defined(EIGEN_GPUCC)
1630 float sin(
const float &
x) { return ::sinf(
x); }
1636 template<
typename T>
1643 #if defined(SYCL_DEVICE_ONLY)
1644 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
tan,
tan)
1647 #if defined(EIGEN_GPUCC)
1649 float tan(
const float &
x) { return ::tanf(
x); }
1655 template<
typename T>
1662 #if EIGEN_HAS_CXX11_MATH
1663 template<
typename T>
1665 T acosh(
const T &
x) {
1667 return static_cast<T>(acosh(
x));
1671 #if defined(SYCL_DEVICE_ONLY)
1672 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
acos,
acos)
1673 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acosh, acosh)
1676 #if defined(EIGEN_GPUCC)
1678 float acos(
const float &
x) { return ::acosf(
x); }
1684 template<
typename T>
1691 #if EIGEN_HAS_CXX11_MATH
1692 template<
typename T>
1694 T asinh(
const T &
x) {
1696 return static_cast<T>(asinh(
x));
1700 #if defined(SYCL_DEVICE_ONLY)
1701 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
asin,
asin)
1702 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asinh, asinh)
1705 #if defined(EIGEN_GPUCC)
1707 float asin(
const float &
x) { return ::asinf(
x); }
1713 template<
typename T>
1720 #if EIGEN_HAS_CXX11_MATH
1721 template<
typename T>
1723 T atanh(
const T &
x) {
1725 return static_cast<T>(atanh(
x));
1729 #if defined(SYCL_DEVICE_ONLY)
1730 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
atan,
atan)
1731 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atanh, atanh)
1734 #if defined(EIGEN_GPUCC)
1736 float atan(
const float &
x) { return ::atanf(
x); }
1743 template<
typename T>
1750 #if defined(SYCL_DEVICE_ONLY)
1751 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
cosh,
cosh)
1754 #if defined(EIGEN_GPUCC)
1756 float cosh(
const float &
x) { return ::coshf(
x); }
1762 template<
typename T>
1769 #if defined(SYCL_DEVICE_ONLY)
1770 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
sinh,
sinh)
1773 #if defined(EIGEN_GPUCC)
1775 float sinh(
const float &
x) { return ::sinhf(
x); }
1781 template<
typename T>
1788 #if (!defined(EIGEN_GPUCC)) && EIGEN_FAST_MATH && !defined(SYCL_DEVICE_ONLY)
1793 #if defined(SYCL_DEVICE_ONLY)
1794 SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(
tanh,
tanh)
1797 #if defined(EIGEN_GPUCC)
1799 float tanh(
const float &
x) { return ::tanhf(
x); }
1805 template <
typename T>
1812 #if defined(SYCL_DEVICE_ONLY)
1813 SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(
fmod,
fmod)
1816 #if defined(EIGEN_GPUCC)
1819 float fmod(
const float&
a,
const float&
b) {
1820 return ::fmodf(
a,
b);
1825 double fmod(
const double&
a,
const double&
b) {
1830 #if defined(SYCL_DEVICE_ONLY)
1831 #undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY
1832 #undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY
1833 #undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY
1834 #undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY
1835 #undef SYCL_SPECIALIZE_INTEGER_TYPES_BINARY
1836 #undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY
1837 #undef SYCL_SPECIALIZE_FLOATING_TYPES_BINARY
1838 #undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY
1839 #undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE
1840 #undef SYCL_SPECIALIZE_GEN_UNARY_FUNC
1841 #undef SYCL_SPECIALIZE_UNARY_FUNC
1842 #undef SYCL_SPECIALIZE_GEN1_BINARY_FUNC
1843 #undef SYCL_SPECIALIZE_GEN2_BINARY_FUNC
1844 #undef SYCL_SPECIALIZE_BINARY_FUNC
1851 template<
typename T>
1857 template<
typename T>
1863 template<
typename T>
1873 template<
typename Scalar,
1878 template<
typename Scalar>
1899 template<
typename Scalar>
1920 template<
typename Scalar>
1936 template<
typename Scalar>
1966 static inline bool run()
1968 return random<int>(0,1)==0 ? false :
true;
1971 static inline bool run(
const bool&
a,
const bool&
b)
1973 return random<int>(
a,
b)==0 ? false :
true;
2007 template <
typename RealScalar>
2010 const std::complex<RealScalar>&
x) {
2023 RealScalar erm1 = numext::expm1<RealScalar>(xr);
2029 return std::complex<RealScalar>(real_part, er *
s);
2033 template<
typename T>
2041 #if defined(EIGEN_GPU_COMPILE_PHASE)
2042 template<
typename T>
2046 static inline std::complex<T>
run(
const std::complex<T>&
x)
2057 #endif // EIGEN_MATHFUNCTIONS_H
NumTraits< Scalar >::Real RealScalar
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
NumTraits< Scalar >::Real RealScalar
#define EIGEN_DEVICE_FUNC
Namespace containing all symbols from the Eigen library.
NumTraits< Scalar >::Real type
CleanedUpDerType< DerType >::type() max(const AutoDiffScalar< DerType > &x, const T &y)
static EIGEN_DEVICE_FUNC result_type run(const ScalarX &x, const ScalarY &y)
EIGEN_DEVICE_FUNC internal::enable_if< internal::is_integral< T >::value, bool >::type isfinite_impl(const T &)
NumTraits< Scalar >::Real RealScalar
static Scalar run(const Scalar &x, const Scalar &y)
#define EIGEN_USING_STD(FUNC)
const EIGEN_DEVICE_FUNC AtanReturnType atan() const
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar &x)
EIGEN_DEVICE_FUNC internal::enable_if< internal::is_integral< T >::value, bool >::type isinf_impl(const T &)
NumTraits< Scalar >::Real type
EIGEN_DEVICE_FUNC bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC NewType run(const OldType &x)
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const RealScalar &prec)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isfinite(const Eigen::bfloat16 &h)
static EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const RealScalar &prec)
NumTraits< Scalar >::Real RealScalar
static EIGEN_DEVICE_FUNC bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const RealScalar &prec)
static EIGEN_DEVICE_FUNC std::complex< Scalar > run(const std::complex< Scalar > &z)
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
static Scalar run(const Scalar &x, const Scalar &y)
NumTraits< Scalar >::Real RealScalar
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
static EIGEN_DEVICE_FUNC std::complex< RealScalar > run(const std::complex< RealScalar > &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isinf(const Eigen::bfloat16 &h)
static EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &)
NumTraits< Scalar >::Real RealScalar
@ meta_floor_log2_terminate
EIGEN_DEVICE_FUNC internal::enable_if< internal::is_integral< T >::value, bool >::type isnan_impl(const T &)
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Real type
Eigen::Triplet< double > T
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
const EIGEN_DEVICE_FUNC LogReturnType log() const
ScalarBinaryOpTraits< ScalarX, ScalarY, internal::scalar_pow_op< ScalarX, ScalarY > >::ReturnType result_type
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Abs2ReturnType abs2() const
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
const EIGEN_DEVICE_FUNC AsinReturnType asin() const
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC double run(const double &x)
EIGEN_DEVICE_FUNC std::complex< T > complex_rsqrt(const std::complex< T > &a_x)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE std::complex< T > run(const std::complex< T > &x)
static EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &prec)
EIGEN_DEVICE_FUNC std::complex< T > complex_sqrt(const std::complex< T > &a_x)
const EIGEN_DEVICE_FUNC CoshReturnType cosh() const
NumTraits< Scalar >::Real RealScalar
Double_ range(const Point2_ &p, const Point2_ &q)
NumTraits< Scalar >::Real type
#define EIGEN_PLAIN_ENUM_MIN(a, b)
static EIGEN_DEVICE_FUNC ScalarX run(ScalarX x, ScalarY y)
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
@ meta_floor_log2_move_up
@ meta_floor_log2_move_down
T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC std::complex< RealScalar > run(const std::complex< RealScalar > &x)
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if<!(NumTraits< T >::IsSigned||NumTraits< T >::IsComplex), typename NumTraits< T >::Real >::type abs(const T &x)
static EIGEN_DEVICE_FUNC bool isApprox(bool x, bool y, bool)
NumTraits< Scalar >::Real & type
NumTraits< Scalar >::Real type
static EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &prec)
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
T generic_fast_tanh_float(const T &a_x)
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &)
const EIGEN_DEVICE_FUNC RintReturnType rint() const
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
static EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const bool &x, const bool &, const bool &)
const EIGEN_DEVICE_FUNC ImagReturnType imag() const
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T fmod(const T &a, const T &b)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T acos(const T &x)
#define EIGEN_ALWAYS_INLINE
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE ArgReturnType arg() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE long double absdiff(const long double &x, const long double &y)
static EIGEN_DEVICE_FUNC bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const RealScalar &)
const EIGEN_DEVICE_FUNC TanReturnType tan() const
const EIGEN_DEVICE_FUNC RsqrtReturnType rsqrt() const
AnnoyingScalar conj(const AnnoyingScalar &x)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 fmin(const bfloat16 &a, const bfloat16 &b)
static EIGEN_DEVICE_FUNC RealScalar & run(Scalar &x)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
EIGEN_DEVICE_FUNC internal::pow_impl< ScalarX, ScalarY >::result_type pow(const ScalarX &x, const ScalarY &y)
EIGEN_DEVICE_FUNC Scalar log1p(const Scalar &x)
NumTraits< Scalar >::Real RealScalar
const AutoDiffScalar< DerType > & real(const AutoDiffScalar< DerType > &x)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T run(const T &x)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC bool abs2(bool x)
const EIGEN_DEVICE_FUNC TanhReturnType tanh() const
static Scalar run(const Scalar &x, const Scalar &y)
DerType::Scalar imag(const AutoDiffScalar< DerType > &)
EIGEN_DEVICE_FUNC Scalar expm1(const Scalar &x)
#define EIGEN_NOT_A_MACRO
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
static EIGEN_DEVICE_FUNC RealScalar & run(Scalar &x)
EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar &x
static EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const Scalar &, const RealScalar &)
NumTraits< Scalar >::Real RealScalar
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 fmax(const bfloat16 &a, const bfloat16 &b)
#define EIGEN_PLAIN_ENUM_MAX(a, b)
mp::number< mp::cpp_dec_float< 100 >, mp::et_on > Real
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Real RealScalar
Array< int, Dynamic, 1 > v
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sin(const T &x)
NumTraits< Scalar >::Real RealScalar
const EIGEN_DEVICE_FUNC CeilReturnType ceil() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
EIGEN_DEVICE_FUNC std::complex< T > complex_log(const std::complex< T > &z)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
CleanedUpDerType< DerType >::type() min(const AutoDiffScalar< DerType > &x, const T &y)
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Real RealScalar
const EIGEN_DEVICE_FUNC SinhReturnType sinh() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
static EIGEN_DEVICE_FUNC Scalar run(const Scalar &x)
NumTraits< Scalar >::Real type
static EIGEN_DEVICE_FUNC bool isApproxOrLessThan(const bool &x, const bool &y, const bool &)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE std::complex< T > run(const std::complex< T > &x)
static EIGEN_DEVICE_FUNC float run(const float &x)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC bool sqrt< bool >(const bool &x)
Jet< T, N > sqrt(const Jet< T, N > &f)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cos(const T &x)
EIGEN_DEVICE_FUNC static const EIGEN_CONSTEXPR Scalar run(const Scalar &)
EIGEN_DEVICE_FUNC NewType cast(const OldType &x)
NumTraits< Scalar >::Real & type
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x)
const EIGEN_DEVICE_FUNC FloorReturnType floor() const
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Scalar run(Scalar &)
static EIGEN_DEVICE_FUNC NewType run(const OldType &x)
#define EIGEN_MATHFUNC_IMPL(func, scalar)
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:33:33