Go to the documentation of this file.
11 #ifndef EIGEN_GENERIC_PACKET_MATH_H
12 #define EIGEN_GENERIC_PACKET_MATH_H
26 #ifndef EIGEN_DEBUG_ALIGNED_LOAD
27 #define EIGEN_DEBUG_ALIGNED_LOAD
30 #ifndef EIGEN_DEBUG_UNALIGNED_LOAD
31 #define EIGEN_DEBUG_UNALIGNED_LOAD
34 #ifndef EIGEN_DEBUG_ALIGNED_STORE
35 #define EIGEN_DEBUG_ALIGNED_STORE
38 #ifndef EIGEN_DEBUG_UNALIGNED_STORE
39 #define EIGEN_DEBUG_UNALIGNED_STORE
158 template<
typename T,
int unique_
id = 0>
177 template<
typename Packet>
186 template <
typename SrcPacket,
typename TgtPacket>
189 return static_cast<TgtPacket
>(
a);
191 template <
typename SrcPacket,
typename TgtPacket>
193 pcast(
const SrcPacket&
a,
const SrcPacket& ) {
194 return static_cast<TgtPacket
>(
a);
196 template <
typename SrcPacket,
typename TgtPacket>
198 pcast(
const SrcPacket&
a,
const SrcPacket& ,
const SrcPacket& ,
const SrcPacket& ) {
199 return static_cast<TgtPacket
>(
a);
201 template <
typename SrcPacket,
typename TgtPacket>
203 pcast(
const SrcPacket&
a,
const SrcPacket& ,
const SrcPacket& ,
const SrcPacket& ,
204 const SrcPacket& ,
const SrcPacket& ,
const SrcPacket& ,
const SrcPacket& ) {
205 return static_cast<TgtPacket
>(
a);
209 template <
typename Target,
typename Packet>
218 padd(
const bool&
a,
const bool&
b) {
return a ||
b; }
240 pmul(
const bool&
a,
const bool&
b) {
return a &&
b; }
247 template<
typename Packet,
typename EnableIf =
void>
251 memset(
static_cast<void*
>(&
b), 0xff,
sizeof(
Packet));
275 template<
typename Packet,
typename EnableIf =
void>
279 memset(
static_cast<void*
>(&
b), 0x00,
sizeof(
Packet));
370 template<
typename Op>
372 const unsigned char* a_ptr =
reinterpret_cast<const unsigned char*
>(&
a);
374 unsigned char* c_ptr =
reinterpret_cast<unsigned char*
>(&
c);
375 for (
size_t i = 0;
i <
sizeof(
T); ++
i) {
376 *c_ptr++ = op(*a_ptr++);
381 template<
typename Op>
383 const unsigned char* a_ptr =
reinterpret_cast<const unsigned char*
>(&
a);
384 const unsigned char* b_ptr =
reinterpret_cast<const unsigned char*
>(&
b);
386 unsigned char* c_ptr =
reinterpret_cast<unsigned char*
>(&
c);
387 for (
size_t i = 0;
i <
sizeof(
T); ++
i) {
388 *c_ptr++ = op(*a_ptr++, *b_ptr++);
395 template<
typename T,
typename EnableIf =
void>
402 is_scalar<T>::value && (NumTraits<T>::IsInteger || NumTraits<T>::RequireInitialization)>
::type
434 template<
typename Packet,
typename EnableIf =
void>
442 template<
typename Packet>
457 const bool& cond,
const bool&
a,
const bool&
b) {
463 template<
int NaNPropagation>
465 template <
typename Packet,
typename Op>
475 template <
typename Packet,
typename Op>
490 template <
typename Packet,
typename Op>
501 #ifndef SYCL_DEVICE_ONLY
502 #define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) Func
504 #define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) \
505 [](const Type& a, const Type& b) { \
516 template <
int NaNPropagation,
typename Packet>
528 template <
int NaNPropagation,
typename Packet>
537 pabs(
const unsigned int&
a) {
return a; }
539 pabs(
const unsigned long&
a) {
return a; }
541 pabs(
const unsigned long long&
a) {
return a; }
575 template <
typename Packet>
590 return static_cast<Packet>(ldexp(
a,
static_cast<int>(exponent)));
610 typename enable_if<unpacket_traits<Packet>::masked_load_available,
Packet>
::type
641 {
return pload1<Packet>(from); }
656 a0 = pload1<Packet>(
a+0);
657 a1 = pload1<Packet>(
a+1);
658 a2 = pload1<Packet>(
a+2);
659 a3 = pload1<Packet>(
a+3);
673 a0 = pload1<Packet>(
a+0);
674 a1 = pload1<Packet>(
a+1);
688 for(
size_t i = 0;
i <
n; ++
i) {
689 memset(elements+
i, ((
i & 1) == 0 ? 0xff : 0),
sizeof(
Scalar));
691 return ploadu<Packet>(elements);
707 template<
typename Scalar,
typename Packet>
709 typename enable_if<unpacket_traits<Packet>::masked_store_available,
void>
::type
713 {
return ploadu<Packet>(from); }
721 #if defined(EIGEN_HIP_DEVICE_COMPILE)
723 #elif defined(EIGEN_CUDA_ARCH)
724 #if defined(__LP64__) || EIGEN_OS_WIN64
726 asm(
" prefetch.L1 [ %1 ];" :
"=l"(addr) :
"l"(addr));
729 asm(
" prefetch.L1 [ %1 ];" :
"=r"(addr) :
"r"(addr));
731 #elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC)
732 __builtin_prefetch(addr);
842 template<
typename Packet>
851 template<
typename Packet>
857 template <
typename Packet,
typename Op>
863 pstoreu<Scalar>(elements,
a);
864 for(
size_t k =
n / 2; k > 0; k /= 2) {
865 for(
size_t i = 0;
i < k; ++
i) {
866 elements[
i] = op(elements[
i], elements[
i + k]);
873 template<
typename Packet>
881 template <
typename Packet>
889 template <
typename Packet>
896 template <
int NaNPropagation,
typename Packet>
904 template <
typename Packet>
911 template <
int NaNPropagation,
typename Packet>
918 #undef EIGEN_BINARY_OP_NAN_PROPAGATION
948 template<
typename Packet>
963 template<
typename Packet,
int Alignment>
967 return pload<Packet>(from);
969 return ploadu<Packet>(from);
974 template<
typename Scalar,
typename Packet,
int Alignment>
988 template<
typename Packet,
int LoadMode>
991 return ploadt<Packet, LoadMode>(from);
999 #if !defined(EIGEN_GPUCC)
1001 template<>
inline std::complex<float>
pmul(
const std::complex<float>&
a,
const std::complex<float>&
b)
1002 {
return std::complex<float>(
a.real()*
b.real() -
a.imag()*
b.imag(),
a.imag()*
b.real() +
a.real()*
b.imag()); }
1004 template<>
inline std::complex<double>
pmul(
const std::complex<double>&
a,
const std::complex<double>&
b)
1005 {
return std::complex<double>(
a.real()*
b.real() -
a.imag()*
b.imag(),
a.imag()*
b.real() +
a.real()*
b.imag()); }
1033 return ifPacket.select[0] ? thenPacket : elsePacket;
1040 #endif // EIGEN_GENERIC_PACKET_MATH_H
EIGEN_STRONG_INLINE Packet8h pldexp(const Packet8h &a, const Packet8h &exponent)
EIGEN_STRONG_INLINE Packet2cf pcmp_eq(const Packet2cf &a, const Packet2cf &b)
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
unpacket_traits< Packet >::type Scalar
#define EIGEN_DEVICE_FUNC
Namespace containing all symbols from the Eigen library.
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
EIGEN_STRONG_INLINE Packet4f psqrt(const Packet4f &a)
static EIGEN_DEVICE_FUNC T bitwise_not(const T &a)
EIGEN_ALWAYS_INLINE eigen_packet_wrapper(const T &v)
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
EIGEN_DEVICE_FUNC Packet paddsub(const Packet &a, const Packet &b)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin(const Packet &a)
#define EIGEN_USING_STD(FUNC)
const EIGEN_DEVICE_FUNC AtanReturnType atan() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4c predux_half_dowto4(const Packet8c &a)
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
Jet< T, N > sin(const Jet< T, N > &f)
EIGEN_STRONG_INLINE Packet8f peven_mask(const Packet8f &)
internal::packet_traits< Scalar >::type Packet
EIGEN_STRONG_INLINE Packet4f pcmp_lt(const Packet4f &a, const Packet4f &b)
EIGEN_ALWAYS_INLINE eigen_packet_wrapper()
EIGEN_STRONG_INLINE bfloat16 pfirst(const Packet8bf &a)
EIGEN_DEVICE_FUNC T() ceil(const T &x)
static EIGEN_DEVICE_FUNC T unary(const T &a, Op op)
static EIGEN_DEVICE_FUNC Packet run(const Packet &)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pceil(const Packet &a)
EIGEN_STRONG_INLINE Packet4i parithmetic_shift_right(const Packet4i &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pround(const Packet &a)
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
Eigen::Triplet< double > T
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
const EIGEN_DEVICE_FUNC LogReturnType log() const
EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf &a)
EIGEN_STRONG_INLINE Packet16h ploadquad(const Eigen::half *from)
const EIGEN_DEVICE_FUNC AsinReturnType asin() const
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
EIGEN_DEVICE_FUNC Packet pset1frombits(BitsType a)
EIGEN_DEVICE_FUNC TgtPacket pcast(const SrcPacket &a)
Jet< T, N > acos(const Jet< T, N > &f)
static EIGEN_DEVICE_FUNC T bitwise_and(const T &a, const T &b)
Jet< T, N > cos(const Jet< T, N > &f)
EIGEN_STRONG_INLINE Packet8h pxor(const Packet8h &a, const Packet8h &b)
const EIGEN_DEVICE_FUNC CoshReturnType cosh() const
static EIGEN_DEVICE_FUNC T run(const T &)
EIGEN_DEVICE_FUNC Packet pgather(const Scalar *from, Index)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Eigen::TensorSycl::internal::RangeAccess< cl::sycl::access::mode::read_write, typename unpacket_traits< packet_type >::type > to, const packet_type &from)
EIGEN_STRONG_INLINE Packet4i plogical_shift_left(const Packet4i &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos(const Packet &a)
EIGEN_STRONG_INLINE Packet8h pfrexp(const Packet8h &a, Packet8h &exponent)
EIGEN_DEVICE_FUNC Packet pabsdiff(const Packet &a, const Packet &b)
void pstore1(typename unpacket_traits< Packet >::type *to, const typename unpacket_traits< Packet >::type &a)
EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf &a)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
EIGEN_STRONG_INLINE void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
EIGEN_STRONG_INLINE Packet4f pselect(const Packet4f &mask, const Packet4f &a, const Packet4f &b)
static EIGEN_DEVICE_FUNC T binary(const T &a, const T &b, Op op)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psinh(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexpm1(const Packet &a)
const EIGEN_DEVICE_FUNC RintReturnType rint() const
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)
#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func)
EIGEN_STRONG_INLINE Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
EIGEN_DEVICE_FUNC void pscatter(Scalar *to, const Packet &from, Index)
EIGEN_STRONG_INLINE Packet4f pcmp_lt_or_nan(const Packet4f &a, const Packet4f &b)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2(const Packet &a)
EIGEN_STRONG_INLINE Packet8h pand(const Packet8h &a, const Packet8h &b)
const EIGEN_DEVICE_FUNC ImagReturnType imag() const
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
#define EIGEN_ALWAYS_INLINE
static EIGEN_DEVICE_FUNC T bitwise_and(const T &a, const T &b)
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE ArgReturnType arg() const
const EIGEN_DEVICE_FUNC TanReturnType tan() const
EIGEN_DEVICE_FUNC void pbroadcast4(const typename unpacket_traits< Packet >::type *a, Packet &a0, Packet &a1, Packet &a2, Packet &a3)
AnnoyingScalar conj(const AnnoyingScalar &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet ploaddup(const typename unpacket_traits< Packet >::type *from)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp(const Packet &a)
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
EIGEN_DEVICE_FUNC Packet pnot(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type ploadt_ro(const Eigen::TensorSycl::internal::RangeAccess< cl::sycl::access::mode::read_write, T > &from)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_helper(const Packet &a, Op op)
EIGEN_STRONG_INLINE bool predux_any(const Packet4f &x)
EIGEN_STRONG_INLINE Packet8f pzero(const Packet8f &)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin(const Packet &a)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool not_equal_strict(const X &x, const Y &y)
EIGEN_DEVICE_FUNC Packet parg(const Packet &a)
EIGEN_DEVICE_FUNC void prefetch(const Scalar *addr)
EIGEN_DEVICE_FUNC void pbroadcast2(const typename unpacket_traits< Packet >::type *a, Packet &a0, Packet &a1)
const EIGEN_DEVICE_FUNC TanhReturnType tanh() const
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
static EIGEN_DEVICE_FUNC T bitwise_not(const T &a)
EIGEN_DEVICE_FUNC T() floor(const T &x)
EIGEN_STRONG_INLINE Packet4i plogical_shift_right(const Packet4i &a)
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
static EIGEN_DEVICE_FUNC Packet run(const Packet &)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog(const Packet &a)
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
static EIGEN_DEVICE_FUNC Packet run(const Packet &mask, const Packet &a, const Packet &b)
static EIGEN_DEVICE_FUNC T run(const T &)
EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f &a)
Array< int, Dynamic, 1 > v
static EIGEN_DEVICE_FUNC Packet run(const Packet &mask, const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE Packet1cd pcplxflip(const Packet1cd &x)
EIGEN_DEVICE_FUNC Packet pload1(const typename unpacket_traits< Packet >::type *a)
static EIGEN_DEVICE_FUNC T bitwise_xor(const T &a, const T &b)
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet plset(const typename unpacket_traits< Packet >::type &a)
const EIGEN_DEVICE_FUNC CeilReturnType ceil() const
static EIGEN_DEVICE_FUNC T bitwise_or(const T &a, const T &b)
EIGEN_STRONG_INLINE Packet8h por(const Packet8h &a, const Packet8h &b)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog1p(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
EIGEN_ALWAYS_INLINE eigen_packet_wrapper & operator=(const T &v)
EIGEN_STRONG_INLINE Packet4f prsqrt(const Packet4f &a)
EIGEN_DEVICE_FUNC Packet pset1(const typename unpacket_traits< Packet >::type &a)
EIGEN_DEVICE_FUNC bool pselect< bool >(const bool &cond, const bool &a, const bool &b)
const EIGEN_DEVICE_FUNC SinhReturnType sinh() const
EIGEN_STRONG_INLINE Packet8h pandnot(const Packet8h &a, const Packet8h &b)
static EIGEN_DEVICE_FUNC T bitwise_xor(const T &a, const T &b)
EIGEN_DEVICE_FUNC Target preinterpret(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_min(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcosh(const Packet &a)
EIGEN_STRONG_INLINE Packet4f pcmp_le(const Packet4f &a, const Packet4f &b)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patan(const Packet &a)
EIGEN_DEVICE_FUNC Packet ploadu(const typename unpacket_traits< Packet >::type *from)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos(const Packet &a)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
EIGEN_DEVICE_FUNC Packet pload(const typename unpacket_traits< Packet >::type *from)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pfloor(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptan(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog10(const Packet &a)
EIGEN_STRONG_INLINE Packet8h ptrue(const Packet8h &a)
const EIGEN_DEVICE_FUNC Log10ReturnType log10() const
const EIGEN_DEVICE_FUNC FloorReturnType floor() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type ploadt(const Eigen::TensorSycl::internal::RangeAccess< cl::sycl::access::mode::read_write, typename unpacket_traits< packet_type >::type > &from)
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_max(const Packet &a)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
static EIGEN_DEVICE_FUNC T bitwise_or(const T &a, const T &b)
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:37