TR-mbed 1.0
Loading...
Searching...
No Matches
TypeCasting.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) 2016 Benoit Steiner <benoit.steiner.goog@gmail.com>
5// Copyright (C) 2019 Rasmus Munk Larsen <rmlarsen@google.com>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
11#ifndef EIGEN_GENERIC_TYPE_CASTING_H
12#define EIGEN_GENERIC_TYPE_CASTING_H
13
14namespace Eigen {
15
16namespace internal {
17
18template<>
23 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
24 (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
25 return __float2half(a);
26 #else
27 return Eigen::half(a);
28 #endif
29 }
30};
31
32template<>
35
36
37template<>
42 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
43 (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
44 return __float2half(static_cast<float>(a));
45 #else
46 return Eigen::half(static_cast<float>(a));
47 #endif
48 }
49};
50
51template<>
54
55
56template<>
61 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
62 (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
63 return __half2float(a);
64 #else
65 return static_cast<float>(a);
66 #endif
67 }
68};
69
70template<>
73
74
75template<>
83
84template<>
87
88
89template<>
97
98template<>
101
102
103template<>
111
112template<>
115
116
117}
118}
119
120#endif // EIGEN_GENERIC_TYPE_CASTING_H
ArrayXXi a
Definition Array_initializer_list_23_cxx11.cpp:1
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition XprHelper.h:22
return int(ret)+1
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition BandTriangularSolver.h:13
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition BFloat16.h:58
Definition Half.h:142
Definition XprHelper.h:176
@ PacketAccess
Definition XprHelper.h:180
@ Cost
Definition XprHelper.h:179
Definition UnaryFunctors.h:160
Definition ForwardDeclarations.h:17