Go to the documentation of this file.
14 #if defined __GNUC__ && __GNUC__>=6
15 #pragma GCC diagnostic ignored "-Wignored-attributes"
27 Map<
const Array<
unsigned char,
sizeof(
T),1> >
29 return Map<
const Array<
unsigned char,
sizeof(
T),1> >(
reinterpret_cast<const unsigned char *
>(&
x));
33 template<
typename T,
typename Bits,
typename Func>
40 std::memcpy(
reinterpret_cast<unsigned char*
>(&
res),
data.data(),
sizeof(
T));
44 #define EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,T) \
45 template<> T EIGEN_CAT(p,OP)(const T& a,const T& b) { \
46 return apply_bit_op<T>(bits(a),bits(b),FUNC); \
49 #define EIGEN_TEST_MAKE_BITWISE(OP,FUNC) \
50 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,float) \
51 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,double) \
52 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,half) \
53 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,bfloat16) \
54 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,std::complex<float>) \
55 EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,std::complex<double>)
61 template<
typename T>
T
81 template<
typename Scalar>
126 #define CHECK_CWISE1(REFOP, POP) { \
127 for (int i=0; i<PacketSize; ++i) \
128 ref[i] = REFOP(data1[i]); \
129 internal::pstore(data2, POP(internal::pload<Packet>(data1))); \
130 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
136 #define CHECK_CWISE1_N(REFOP, POP, N) { \
137 for (int i=0; i<N; ++i) \
138 ref[i] = REFOP(data1[i]); \
139 for (int j=0; j<N; j+=PacketSize) \
140 internal::pstore(data2 + j, POP(internal::pload<Packet>(data1 + j))); \
141 VERIFY(test::areApprox(ref, data2, N) && #POP); \
144 template<
bool Cond,
typename Packet>
148 inline Packet load(
const T* from)
const {
return internal::pload<Packet>(from); }
151 inline Packet loadu(
const T* from)
const {
return internal::ploadu<Packet>(from); }
154 inline Packet load(
const T* from,
unsigned long long umask)
const {
return internal::ploadu<Packet>(from, umask); }
166 template<
typename Packet>
170 inline T load(
const T* from)
const {
return *from; }
173 inline T loadu(
const T* from)
const {
return *from; }
176 inline T load(
const T* from,
unsigned long long)
const {
return *from; }
182 inline void store(
T* to,
const T&
x,
unsigned long long)
const { *to =
x; }
188 #define CHECK_CWISE1_IF(COND, REFOP, POP) if(COND) { \
189 test::packet_helper<COND,Packet> h; \
190 for (int i=0; i<PacketSize; ++i) \
191 ref[i] = Scalar(REFOP(data1[i])); \
192 h.store(data2, POP(h.load(data1))); \
193 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
196 #define CHECK_CWISE1_EXACT_IF(COND, REFOP, POP) if(COND) { \
197 test::packet_helper<COND,Packet> h; \
198 for (int i=0; i<PacketSize; ++i) \
199 ref[i] = Scalar(REFOP(data1[i])); \
200 h.store(data2, POP(h.load(data1))); \
201 VERIFY(test::areEqual(ref, data2, PacketSize) && #POP); \
204 #define CHECK_CWISE2_IF(COND, REFOP, POP) if(COND) { \
205 test::packet_helper<COND,Packet> h; \
206 for (int i=0; i<PacketSize; ++i) \
207 ref[i] = Scalar(REFOP(data1[i], data1[i+PacketSize])); \
208 h.store(data2, POP(h.load(data1),h.load(data1+PacketSize))); \
209 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
213 #define CHECK_CWISE1_BYREF1_IF(COND, REFOP, POP) if(COND) { \
214 test::packet_helper<COND,Packet> h; \
215 for (int i=0; i<PacketSize; ++i) \
216 ref[i] = Scalar(REFOP(data1[i], ref[i+PacketSize])); \
219 h.store(data2, POP(h.load(data1), h.forward_reference(pout, sout))); \
220 h.store(data2+PacketSize, h.forward_reference(pout, sout)); \
221 VERIFY(test::areApprox(ref, data2, 2 * PacketSize) && #POP); \
224 #define CHECK_CWISE3_IF(COND, REFOP, POP) if (COND) { \
225 test::packet_helper<COND, Packet> h; \
226 for (int i = 0; i < PacketSize; ++i) \
227 ref[i] = Scalar(REFOP(data1[i], data1[i + PacketSize], \
228 data1[i + 2 * PacketSize])); \
229 h.store(data2, POP(h.load(data1), h.load(data1 + PacketSize), \
230 h.load(data1 + 2 * PacketSize))); \
231 VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \
249 template<
typename Scalar,
typename PacketType>
258 template<
typename Scalar,
typename PacketType>
266 template<
typename Scalar,
typename PacketType>
Namespace containing all symbols from the Eigen library.
bool areApproxAbs(const Scalar *a, const Scalar *b, int size, const typename NumTraits< Scalar >::Real &refvalue)
void store(T *to, const Packet &x, unsigned long long umask) const
T operator()(T a, T b) const
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
Map< const Array< unsigned char, sizeof(T), 1 > > bits(const T &x)
Packet load(const T *from) const
bool areEqual(const Scalar *a, const Scalar *b, int size)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
General-purpose arrays with easy API for coefficient-wise operations.
Eigen::Triplet< double > T
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
T loadu(const T *from) const
Packet & forward_reference(Packet &packet, T &) const
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
void store(T *to, const T &x, unsigned long long) const
T apply_bit_op(Bits a, Bits b, Func f)
mxArray * scalar(mxClassID classid)
Packet load(const T *from, unsigned long long umask) const
void store(T *to, const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
Packet loadu(const T *from) const
A matrix or vector expression mapping an existing array of data.
bool areApprox(const Scalar *a, const Scalar *b, int size)
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
#define EIGEN_TEST_MAKE_BITWISE(OP, FUNC)
void store(T *to, const T &x) const
Reference counting helper.
void print_mismatch(const Scalar *ref, const Scalar *vec, int size)
The matrix class, also used for vectors and row-vectors.
EIGEN_DONT_INLINE bool isApproxAbs(const Scalar &a, const Scalar &b, const typename NumTraits< Scalar >::Real &refvalue)
T load(const T *from, unsigned long long) const
T & forward_reference(Packet &, T &scalar) const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
T load(const T *from) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define EIGEN_DONT_INLINE
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:12:26