14 #if defined __GNUC__ && __GNUC__ >= 6
15 #pragma GCC diagnostic ignored "-Wignored-attributes"
25 template <typename T, std::enable_if_t<NumTraits<T>::IsSigned,
bool> =
true>
30 template <typename T, std::enable_if_t<!NumTraits<T>::IsSigned,
bool> =
true>
37 return Map<
const Array<
unsigned char,
sizeof(
T), 1> >(
reinterpret_cast<const unsigned char*
>(&
x));
46 template <
typename Scalar>
51 template <
typename Scalar>
57 template <
typename Scalar>
59 for (
int i = 0;
i <
size; ++
i) {
62 std::cout << std::setprecision(16) <<
"Values differ in position " <<
i <<
": " <<
a[
i] <<
" vs " <<
b[
i]
70 template <
typename Scalar>
72 for (
int i = 0;
i <
size; ++
i) {
76 std::cout << std::setprecision(16) <<
"Values differ in position " <<
i <<
": " <<
a[
i] <<
" vs " <<
b[
i]
84 template <
typename Scalar>
86 for (
int i = 0;
i <
size; ++
i) {
89 std::cout << std::setprecision(16) <<
"Values differ in position " <<
i <<
": " <<
a[
i] <<
" vs " <<
b[
i]
97 template <
typename Scalar>
99 for (
int i = 0;
i <
size; ++
i) {
103 std::cout << std::setprecision(16) <<
"Values differ in position " <<
i <<
": " <<
a[
i] <<
" vs " <<
b[
i]
111 #define CHECK_CWISE1(REFOP, POP) \
113 for (int i = 0; i < PacketSize; ++i) ref[i] = REFOP(data1[i]); \
114 internal::pstore(data2, POP(internal::pload<Packet>(data1))); \
115 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
121 #define CHECK_CWISE1_N(REFOP, POP, N) \
123 for (int i = 0; i < N; ++i) ref[i] = REFOP(data1[i]); \
124 for (int j = 0; j < N; j += PacketSize) internal::pstore(data2 + j, POP(internal::pload<Packet>(data1 + j))); \
125 VERIFY(test::areApprox(ref, data2, N) && #POP); \
133 #define CHECK_CWISE1_IM1ULP_N(REFOP, POP, N) \
135 RealScalar eps_1ulp = RealScalar(1e1) * std::numeric_limits<RealScalar>::epsilon(); \
136 for (int j = 0; j < N; j += PacketSize) \
137 internal::pstore(data2 + j, internal::plog(internal::pload<Packet>(data1 + j))); \
138 for (int i = 0; i < N; ++i) { \
139 ref[i] = REFOP(data1[i]); \
140 realref[i] = ref[i].imag(); \
141 realdata[i] = data2[i].imag(); \
143 VERIFY(test::areApprox(realdata, realref, N, eps_1ulp)); \
144 for (int i = 0; i < N; ++i) { \
145 realdata[i] = data2[i].real(); \
146 realref[i] = ref[i].real(); \
148 VERIFY(test::areApprox(realdata, realref, N)); \
151 template <
bool Cond,
typename Packet>
153 template <
typename T>
155 return internal::pload<Packet>(from);
158 template <
typename T>
160 return internal::ploadu<Packet>(from);
163 template <
typename T>
164 inline Packet load(
const T* from,
unsigned long long umask)
const {
165 return internal::ploadu<Packet>(from, umask);
168 template <
typename T>
173 template <
typename T>
178 template <
typename T>
184 template <
typename Packet>
186 template <
typename T>
191 template <
typename T>
196 template <
typename T>
197 inline T load(
const T* from,
unsigned long long)
const {
201 template <
typename T>
206 template <
typename T>
207 inline void store(
T* to,
const T&
x,
unsigned long long)
const {
211 template <
typename T>
217 #define CHECK_CWISE1_IF(COND, REFOP, POP) \
219 test::packet_helper<COND, Packet> h; \
220 for (int i = 0; i < PacketSize; ++i) ref[i] = Scalar(REFOP(data1[i])); \
221 h.store(data2, POP(h.load(data1))); \
222 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
225 #define CHECK_CWISE1_EXACT_IF(COND, REFOP, POP) \
227 test::packet_helper<COND, Packet> h; \
228 for (int i = 0; i < PacketSize; ++i) ref[i] = Scalar(REFOP(data1[i])); \
229 h.store(data2, POP(h.load(data1))); \
230 VERIFY(test::areEqual(ref, data2, PacketSize) && #POP); \
233 #define CHECK_CWISE2_IF(COND, REFOP, POP) \
235 test::packet_helper<COND, Packet> h; \
236 for (int i = 0; i < PacketSize; ++i) ref[i] = Scalar(REFOP(data1[i], data1[i + PacketSize])); \
237 h.store(data2, POP(h.load(data1), h.load(data1 + PacketSize))); \
238 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
242 #define CHECK_CWISE1_BYREF1_IF(COND, REFOP, POP) \
244 test::packet_helper<COND, Packet> h; \
245 for (int i = 0; i < PacketSize; ++i) ref[i] = Scalar(REFOP(data1[i], ref[i + PacketSize])); \
248 h.store(data2, POP(h.load(data1), h.forward_reference(pout, sout))); \
249 h.store(data2 + PacketSize, h.forward_reference(pout, sout)); \
250 VERIFY(test::areApprox(ref, data2, 2 * PacketSize) && #POP); \
253 #define CHECK_CWISE3_IF(COND, REFOP, POP) \
255 test::packet_helper<COND, Packet> h; \
256 for (int i = 0; i < PacketSize; ++i) \
257 ref[i] = Scalar(REFOP(data1[i], data1[i + PacketSize], data1[i + 2 * PacketSize])); \
258 h.store(data2, POP(h.load(data1), h.load(data1 + PacketSize), h.load(data1 + 2 * PacketSize))); \
259 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
269 bool HasHalf = !internal::is_same<typename internal::unpacket_traits<PacketType>::half,
PacketType>
::value>
272 template <
typename Scalar,
typename PacketType>
280 template <
typename Scalar,
typename PacketType>
285 template <
typename Scalar,
typename PacketType>
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Eigen::Triplet< double > T
Definition: EigenUnitTest.cpp:11
#define EIGEN_DONT_INLINE
Definition: Macros.h:853
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:48
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
@ IsComplex
Definition: common.h:73
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1923
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:891
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:911
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
Definition: BFloat16.h:742
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool not_equal_strict(const X &x, const Y &y)
Definition: Meta.h:606
void print_mismatch(const Scalar *ref, const Scalar *vec, int size)
Definition: packetmath_test_shared.h:52
bool areEqual(const Scalar *a, const Scalar *b, int size)
Definition: packetmath_test_shared.h:85
Map< const Array< unsigned char, sizeof(T), 1 > > bits(const T &x)
Definition: packetmath_test_shared.h:36
bool areApproxAbs(const Scalar *a, const Scalar *b, int size, const typename NumTraits< Scalar >::Real &refvalue)
Definition: packetmath_test_shared.h:58
bool biteq(T a, T b)
Definition: packetmath_test_shared.h:41
bool areApprox(const Scalar *a, const Scalar *b, int size)
Definition: packetmath_test_shared.h:71
T negate(const T &x)
Definition: packetmath_test_shared.h:26
EIGEN_DONT_INLINE bool isApproxAbs(const Scalar &a, const Scalar &b, const typename NumTraits< Scalar >::Real &refvalue)
Definition: packetmath_test_shared.h:47
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
squared absolute value
Definition: GlobalFunctions.h:87
type
Definition: compute_granudrum_aor.py:141
list x
Definition: plotDoE.py:28
Definition: indexed_view.cpp:20
bool g_first_pass
Definition: packetmath_test_shared.h:19
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: TensorMeta.h:47
@ Vectorizable
Definition: GenericPacketMath.h:112
void store(T *to, const T &x, unsigned long long) const
Definition: packetmath_test_shared.h:207
T loadu(const T *from) const
Definition: packetmath_test_shared.h:192
T load(const T *from) const
Definition: packetmath_test_shared.h:187
void store(T *to, const T &x) const
Definition: packetmath_test_shared.h:202
T load(const T *from, unsigned long long) const
Definition: packetmath_test_shared.h:197
T & forward_reference(Packet &, T &scalar) const
Definition: packetmath_test_shared.h:212
Definition: packetmath_test_shared.h:152
Packet load(const T *from) const
Definition: packetmath_test_shared.h:154
Packet load(const T *from, unsigned long long umask) const
Definition: packetmath_test_shared.h:164
Packet loadu(const T *from) const
Definition: packetmath_test_shared.h:159
void store(T *to, const Packet &x) const
Definition: packetmath_test_shared.h:169
Packet & forward_reference(Packet &packet, T &) const
Definition: packetmath_test_shared.h:179
void store(T *to, const Packet &x, unsigned long long umask) const
Definition: packetmath_test_shared.h:174
static void run()
Definition: special_packetmath.cpp:145
static void run()
Definition: packetmath_test_shared.h:287
static void run()
Definition: packetmath_test_shared.h:282
static void run()
Definition: packetmath_test_shared.h:274
Definition: packetmath_test_shared.h:270