TensorMacros.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
12 
13 
29 // SFINAE requires variadic templates
30 #if !defined(EIGEN_GPUCC)
31 #if EIGEN_HAS_VARIADIC_TEMPLATES
32  // SFINAE doesn't work for gcc <= 4.7
33  #ifdef EIGEN_COMP_GNUC
34  #if EIGEN_GNUC_AT_LEAST(4,8)
35  #define EIGEN_HAS_SFINAE
36  #endif
37  #else
38  #define EIGEN_HAS_SFINAE
39  #endif
40 #endif
41 #endif
42 
43 #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \
44  typename internal::enable_if< ( __condition__ ) , int >::type = 0
45 
46 // Define a macro to use a reference on the host but a value on the device
47 #if defined(SYCL_DEVICE_ONLY)
48  #define EIGEN_DEVICE_REF
49 #else
50  #define EIGEN_DEVICE_REF &
51 #endif
52 
53 // Define a macro for catching SYCL exceptions if exceptions are enabled
54 #define EIGEN_SYCL_TRY_CATCH(X) \
55  do { \
56  EIGEN_TRY {X;} \
57  EIGEN_CATCH(const cl::sycl::exception& e) { \
58  EIGEN_THROW_X(std::runtime_error("SYCL exception at " + \
59  std::string(__FILE__) + ":" + \
60  std::to_string(__LINE__) + "\n" + \
61  e.what())); \
62  } \
63  } while (false)
64 
65 // Define a macro if local memory flags are unset or one of them is set
66 // Setting both flags is the same as unsetting them
67 #if (!defined(EIGEN_SYCL_LOCAL_MEM) && !defined(EIGEN_SYCL_NO_LOCAL_MEM)) || \
68  (defined(EIGEN_SYCL_LOCAL_MEM) && defined(EIGEN_SYCL_NO_LOCAL_MEM))
69  #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_ON 1
70  #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_OFF 1
71 #elif defined(EIGEN_SYCL_LOCAL_MEM) && !defined(EIGEN_SYCL_NO_LOCAL_MEM)
72  #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_ON 1
73 #elif !defined(EIGEN_SYCL_LOCAL_MEM) && defined(EIGEN_SYCL_NO_LOCAL_MEM)
74  #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_OFF 1
75 #endif
76 
77 #if EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
78  #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
79  using Base::operator =; \
80  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
81  template <typename OtherDerived> \
82  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const OtherDerived& other) { Base::operator=(other); return *this; }
83 #else
84  #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
85  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
86 #endif
87 
94 #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
95  EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
96  EIGEN_DEFAULT_COPY_CONSTRUCTOR(Derived)
97 
98 #endif


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:06:11