14#if defined(EIGEN_GPU_COMPILE_PHASE)
18 #if defined(EIGEN_CUDA_ARCH)
19 #include <math_constants.h>
22 #if defined(EIGEN_HIP_DEVICE_COMPILE)
23 #include "Eigen/src/Core/arch/HIP/hcc/math_constants.h"
29#define EIGEN_ICC_NEEDS_CSTDINT (EIGEN_COMP_ICC>=1600 && EIGEN_COMP_CXXVER >= 11)
32#if EIGEN_HAS_CXX11 || EIGEN_ICC_NEEDS_CSTDINT
36typedef std::uint8_t uint8_t;
37typedef std::int8_t int8_t;
38typedef std::uint16_t uint16_t;
39typedef std::int16_t int16_t;
40typedef std::uint32_t uint32_t;
41typedef std::int32_t int32_t;
42typedef std::uint64_t uint64_t;
43typedef std::int64_t int64_t;
52typedef ::uint8_t uint8_t;
53typedef ::int8_t int8_t;
54typedef ::uint16_t uint16_t;
55typedef ::int16_t int16_t;
56typedef ::uint32_t uint32_t;
57typedef ::int32_t int32_t;
58typedef ::uint64_t uint64_t;
59typedef ::int64_t int64_t;
66typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
74typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE
Index;
87#if EIGEN_ICC_NEEDS_CSTDINT
88typedef std::intptr_t IntPtr;
89typedef std::uintptr_t UIntPtr;
91typedef std::ptrdiff_t IntPtr;
92typedef std::size_t UIntPtr;
94#undef EIGEN_ICC_NEEDS_CSTDINT
99template<
bool Condition>
108template<
bool Condition,
typename Then,
typename Else>
111template<
typename Then,
typename Else>
124template <
class T,
unsigned int Size>
struct remove_const<
const T[Size]> {
typedef T type[Size]; };
127template<
typename T>
struct remove_all<
const T> {
typedef typename remove_all<T>::type type; };
128template<
typename T>
struct remove_all<T
const&> {
typedef typename remove_all<T>::type type; };
129template<
typename T>
struct remove_all<T&> {
typedef typename remove_all<T>::type type; };
130template<
typename T>
struct remove_all<T
const*> {
typedef typename remove_all<T>::type type; };
131template<
typename T>
struct remove_all<T*> {
typedef typename remove_all<T>::type type; };
137#ifndef EIGEN_GPU_COMPILE_PHASE
151template<
typename T,
typename U>
struct is_same {
enum { value = 0 }; };
152template<
typename T>
struct is_same<T,T> {
enum { value = 1 }; };
159template<>
struct is_arithmetic<unsigned long long> {
enum { value =
true }; };
160using std::is_integral;
162template<
typename T>
struct is_integral {
enum { value =
false }; };
178using std::make_unsigned;
197template <
typename T>
struct add_const {
typedef const T type; };
198template <
typename T>
struct add_const<T&> {
typedef T& type; };
200template <
typename T>
struct is_const {
enum { value = 0 }; };
211using std::is_convertible;
215template<
typename From,
typename To>
219 struct any_conversion
221 template <
typename T> any_conversion(
const volatile T&);
222 template <
typename T> any_conversion(T&);
224 struct yes {
int a[1];};
225 struct no {
int a[2];};
228 static yes test(T,
int);
231 static no test(any_conversion, ...);
235#ifdef __INTEL_COMPILER
237 #pragma warning ( disable : 2259 )
239 enum { value =
sizeof(
test<To>(*ms_from, 0))==
sizeof(yes) };
240#ifdef __INTEL_COMPILER
245template<
typename From,
typename To>
262template<
bool Condition,
typename T=
void>
struct enable_if;
267#if defined(EIGEN_GPU_COMPILE_PHASE) && !EIGEN_HAS_CXX11
268#if !defined(__FLT_EPSILON__)
269#define __FLT_EPSILON__ FLT_EPSILON
270#define __DBL_EPSILON__ DBL_EPSILON
275template<
typename T>
struct numeric_limits
278 static EIGEN_CONSTEXPR T epsilon() {
return 0; }
279 static T (max)() {
assert(
false &&
"Highest not supported for this type"); }
280 static T (min)() { assert(
false &&
"Lowest not supported for this type"); }
281 static T infinity() { assert(
false &&
"Infinity not supported for this type"); }
282 static T quiet_NaN() { assert(
false &&
"quiet_NaN not supported for this type"); }
284template<>
struct numeric_limits<float>
286 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
287 static float epsilon() {
return __FLT_EPSILON__; }
289 static float (max)() {
290 #if defined(EIGEN_CUDA_ARCH)
291 return CUDART_MAX_NORMAL_F;
293 return HIPRT_MAX_NORMAL_F;
296 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
297 static float (min)() {
return FLT_MIN; }
299 static float infinity() {
300 #if defined(EIGEN_CUDA_ARCH)
307 static float quiet_NaN() {
308 #if defined(EIGEN_CUDA_ARCH)
315template<>
struct numeric_limits<double>
317 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
318 static double epsilon() {
return __DBL_EPSILON__; }
319 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
320 static double (max)() {
return DBL_MAX; }
321 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
322 static double (min)() {
return DBL_MIN; }
324 static double infinity() {
325 #if defined(EIGEN_CUDA_ARCH)
332 static double quiet_NaN() {
333 #if defined(EIGEN_CUDA_ARCH)
340template<>
struct numeric_limits<int>
342 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
343 static int epsilon() {
return 0; }
344 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
345 static int (max)() {
return INT_MAX; }
346 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
347 static int (min)() {
return INT_MIN; }
349template<>
struct numeric_limits<unsigned int>
351 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
352 static unsigned int epsilon() {
return 0; }
353 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
354 static unsigned int (max)() {
return UINT_MAX; }
355 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
356 static unsigned int (min)() {
return 0; }
358template<>
struct numeric_limits<long>
360 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
361 static long epsilon() {
return 0; }
362 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
363 static long (max)() {
return LONG_MAX; }
364 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
365 static long (min)() {
return LONG_MIN; }
367template<>
struct numeric_limits<unsigned long>
369 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
370 static unsigned long epsilon() {
return 0; }
371 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
372 static unsigned long (max)() {
return ULONG_MAX; }
373 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
374 static unsigned long (min)() {
return 0; }
376template<>
struct numeric_limits<long long>
378 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
379 static long long epsilon() {
return 0; }
380 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
381 static long long (max)() {
return LLONG_MAX; }
382 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
383 static long long (min)() {
return LLONG_MIN; }
385template<>
struct numeric_limits<unsigned long long>
387 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
388 static unsigned long long epsilon() {
return 0; }
389 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
390 static unsigned long long (max)() {
return ULLONG_MAX; }
391 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
392 static unsigned long long (min)() {
return 0; }
394template<>
struct numeric_limits<bool>
396 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
397 static bool epsilon() {
return false; }
398 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
399 static bool (max)() {
return true; }
400 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
401 static bool (min)() {
return false; }
434template<
typename T,
typename EnableIf =
void>
struct array_size {
439 enum { value = T::SizeAtCompileTime };
453template<
typename T, std::
size_t N>
struct array_size<
std::array<T,N> > {
469#if EIGEN_COMP_CXXVER < 20
471EIGEN_CONSTEXPR std::ptrdiff_t index_list_size(
const T& x) {
472 return static_cast<std::ptrdiff_t
>(x.size());
475template<
typename T, std::ptrdiff_t N>
476EIGEN_CONSTEXPR std::ptrdiff_t index_list_size(
const T (&)[N]) {
return N; }
479EIGEN_CONSTEXPR
auto index_list_size(T&& x) {
481 return ssize(std::forward<T>(x));
500#if EIGEN_HAS_STD_INVOKE_RESULT
501template<
typename T>
struct result_of;
503template<
typename F,
typename... ArgTypes>
504struct result_of<F(ArgTypes...)> {
505 typedef typename std::invoke_result<F, ArgTypes...>::type type1;
506 typedef typename remove_all<type1>::type type;
508#elif EIGEN_HAS_STD_RESULT_OF
509template<
typename T>
struct result_of {
510 typedef typename std::result_of<T>::type type1;
511 typedef typename remove_all<type1>::type type;
520template<
typename Func,
int SizeOf>
523template<
typename Func>
526template<
typename Func>
529template<
typename Func>
534 static has_tr1_result testFunctor(T
const *,
typename T::template result<T()>::type
const * = 0);
538 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
542template<
typename Func,
typename ArgType,
int SizeOf=sizeof(has_none)>
545template<
typename Func,
typename ArgType>
548template<
typename Func,
typename ArgType>
551template<
typename Func,
typename ArgType>
556 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType)>::type
const * = 0);
560 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
561 typedef typename unary_result_of_select<Func, ArgType, FunctorType>::type type;
564template<
typename Func,
typename ArgType0,
typename ArgType1,
int SizeOf=sizeof(has_none)>
567template<
typename Func,
typename ArgType0,
typename ArgType1>
569{
typedef typename Func::result_type type;};
571template<
typename Func,
typename ArgType0,
typename ArgType1>
573{
typedef typename Func::template result<Func(
ArgType0,
ArgType1)>::type type;};
575template<
typename Func,
typename ArgType0,
typename ArgType1>
584 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
585 typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
588template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2,
int SizeOf=sizeof(has_none)>
591template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
593{
typedef typename Func::result_type type;};
595template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
599template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
608 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
609 typedef typename ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, FunctorType>::type type;
614#if EIGEN_HAS_STD_INVOKE_RESULT
615template<
typename F,
typename...
ArgTypes>
617 typedef typename std::invoke_result<
F,
ArgTypes...>::type type1;
618 typedef typename remove_all<type1>::type type;
621template<
typename F,
typename...
ArgTypes>
622struct invoke_result {
623 typedef typename result_of<
F(
ArgTypes...)>::type type1;
624 typedef typename remove_all<type1>::type type;
627template<
typename F,
typename ArgType0 =
void,
typename ArgType1 =
void,
typename ArgType2 =
void>
630 typedef typename remove_all<type1>::type type;
636 typedef typename remove_all<type1>::type type;
639template<
typename F,
typename ArgType0>
642 typedef typename remove_all<type1>::type type;
645template<
typename F,
typename ArgType0,
typename ArgType1>
648 typedef typename remove_all<type1>::type type;
659 template <
typename C>
static meta_yes testFunctor(C
const *,
typename C::ReturnType
const * = 0);
660 template <
typename C>
static meta_no testFunctor(...);
665template<
typename T>
const T* return_ptr();
667template <
typename T,
typename IndexType=Index>
671 static meta_no testFunctor(...);
673 enum { value =
sizeof(testFunctor(
static_cast<T*
>(0))) ==
sizeof(
meta_yes) };
676template <
typename T,
typename IndexType=Index>
679 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(
return_ptr<C>()->
operator()(IndexType(0)))>0)>::type * = 0);
680 static meta_no testFunctor(...);
682 enum { value =
sizeof(testFunctor(
static_cast<T*
>(0))) ==
sizeof(
meta_yes) };
685template <
typename T,
typename IndexType=Index>
688 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(
return_ptr<C>()->
operator()(IndexType(0),IndexType(0)))>0)>::type * = 0);
689 static meta_no testFunctor(...);
691 enum { value =
sizeof(testFunctor(
static_cast<T*
>(0))) ==
sizeof(
meta_yes) };
699 int SupX = ((Y==1) ? 1 : Y/2),
705 TakeInf = MidX*MidX > Y ? 1 : 0,
713template<
int Y,
int InfX,
int SupX>
720template<
int A,
int B,
int K=1,
bool Done = ((A*K)%B)==0,
bool Big=(A>=B)>
725template<
int A,
int B,
int K,
bool Done>
730template<
int A,
int B,
int K>
740 enum { Defined = 0 };
752template<
unsigned Len,
unsigned Align>
755 EIGEN_ALIGN_TO_BOUNDARY(
Align)
unsigned char data[
Len];
763#if defined(EIGEN_GPU_COMPILE_PHASE)
764template<
typename T> EIGEN_DEVICE_FUNC
void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
766template<
typename T> EIGEN_STRONG_INLINE
void swap(T &a, T &b) {
std::swap(a,b); }
769#if defined(EIGEN_GPU_COMPILE_PHASE) && !EIGEN_HAS_CXX11
770using internal::device::numeric_limits;
772using std::numeric_limits;
779T div_ceil(
const T &a,
const T &b)
786template<
typename X,
typename Y> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
787bool equal_strict(
const X& x,
const Y& y) {
return x == y; }
789#if !defined(EIGEN_GPU_COMPILE_PHASE) || (!defined(EIGEN_CUDA_ARCH) && defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
790template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
791bool equal_strict(
const float& x,
const float& y) {
return std::equal_to<float>()(x,y); }
793template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
794bool equal_strict(
const double& x,
const double& y) {
return std::equal_to<double>()(x,y); }
797template<
typename X,
typename Y> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
798bool not_equal_strict(
const X& x,
const Y& y) {
return x != y; }
800#if !defined(EIGEN_GPU_COMPILE_PHASE) || (!defined(EIGEN_CUDA_ARCH) && defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
801template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
802bool not_equal_strict(
const float& x,
const float& y) {
return std::not_equal_to<float>()(x,y); }
804template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
805bool not_equal_strict(
const double& x,
const double& y) {
return std::not_equal_to<double>()(x,y); }
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
int N
Simulate some binary data with a single categorical and single continuous predictor.
Definition logistic_regression.py:26
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition json.hpp:24418