Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
0005 //
0006 // This Source Code Form is subject to the terms of the Mozilla
0007 // Public License v. 2.0. If a copy of the MPL was not distributed
0008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0009 
0010 #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
0011 #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
0012 
0013 
0014 /** use this macro in sfinae selection in templated functions
0015  *
0016  *   template<typename T,
0017  *            typename std::enable_if< isBanana<T>::value , int >::type = 0
0018  *   >
0019  *   void foo(){}
0020  *
0021  *   becomes =>
0022  *
0023  *   template<typename TopoType,
0024  *           SFINAE_ENABLE_IF( isBanana<T>::value )
0025  *   >
0026  *   void foo(){}
0027  */
0028 
0029 // SFINAE requires variadic templates
0030 #if !defined(EIGEN_GPUCC)
0031 #if EIGEN_HAS_VARIADIC_TEMPLATES
0032   // SFINAE doesn't work for gcc <= 4.7
0033   #ifdef EIGEN_COMP_GNUC
0034     #if EIGEN_GNUC_AT_LEAST(4,8)
0035       #define EIGEN_HAS_SFINAE
0036     #endif
0037   #else
0038     #define EIGEN_HAS_SFINAE
0039   #endif
0040 #endif
0041 #endif
0042 
0043 #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \
0044     typename internal::enable_if< ( __condition__ ) , int >::type = 0
0045 
0046 // Define a macro to use a reference on the host but a value on the device
0047 #if defined(SYCL_DEVICE_ONLY)
0048   #define EIGEN_DEVICE_REF
0049 #else
0050   #define EIGEN_DEVICE_REF &
0051 #endif
0052 
0053 // Define a macro for catching SYCL exceptions if exceptions are enabled
0054 #define EIGEN_SYCL_TRY_CATCH(X) \
0055   do { \
0056     EIGEN_TRY {X;} \
0057     EIGEN_CATCH(const cl::sycl::exception& e) { \
0058       EIGEN_THROW_X(std::runtime_error("SYCL exception at " + \
0059                                        std::string(__FILE__) + ":" + \
0060                                        std::to_string(__LINE__) + "\n" + \
0061                                        e.what())); \
0062     } \
0063   } while (false)
0064 
0065 // Define a macro if local memory flags are unset or one of them is set
0066 // Setting both flags is the same as unsetting them
0067 #if (!defined(EIGEN_SYCL_LOCAL_MEM) && !defined(EIGEN_SYCL_NO_LOCAL_MEM)) || \
0068      (defined(EIGEN_SYCL_LOCAL_MEM) &&  defined(EIGEN_SYCL_NO_LOCAL_MEM))
0069   #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_ON 1
0070   #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_OFF 1
0071 #elif defined(EIGEN_SYCL_LOCAL_MEM) && !defined(EIGEN_SYCL_NO_LOCAL_MEM)
0072   #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_ON 1
0073 #elif !defined(EIGEN_SYCL_LOCAL_MEM) && defined(EIGEN_SYCL_NO_LOCAL_MEM)
0074   #define EIGEN_SYCL_LOCAL_MEM_UNSET_OR_OFF 1
0075 #endif
0076 
0077 #if EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
0078   #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
0079     using Base::operator =; \
0080     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
0081     template <typename OtherDerived> \
0082     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const OtherDerived& other) { Base::operator=(other); return *this; }
0083 #else
0084   #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
0085     EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
0086 #endif
0087 
0088 /** \internal
0089  * \brief Macro to manually inherit assignment operators.
0090  * This is necessary, because the implicitly defined assignment operator gets deleted when a custom operator= is defined.
0091  * This also inherits template<OtherDerived> operator=(const OtherDerived&) assignments.
0092  * With C++11 or later this also default-implements the copy-constructor
0093  */
0094 #define EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived)  \
0095     EIGEN_TENSOR_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
0096     EIGEN_DEFAULT_COPY_CONSTRUCTOR(Derived)
0097 
0098 #endif