Lines 964-974
struct functor_traits<std::binary_compos
Link Here
|
964 |
#endif // EIGEN_STDEXT_SUPPORT |
964 |
#endif // EIGEN_STDEXT_SUPPORT |
965 |
|
965 |
|
966 |
// allow to add new functors and specializations of functor_traits from outside Eigen. |
966 |
// allow to add new functors and specializations of functor_traits from outside Eigen. |
967 |
// this macro is really needed because functor_traits must be specialized after it is declared but before it is used... |
967 |
// this macro is really needed because functor_traits must be specialized after it is declared but before it is used... |
968 |
#ifdef EIGEN_FUNCTORS_PLUGIN |
968 |
#ifdef EIGEN_FUNCTORS_PLUGIN |
969 |
#include EIGEN_FUNCTORS_PLUGIN |
969 |
#include EIGEN_FUNCTORS_PLUGIN |
970 |
#endif |
970 |
#endif |
971 |
|
971 |
|
|
|
972 |
#define EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(OP,NAME) \ |
973 |
template<typename Scalar> \ |
974 |
struct NAME { \ |
975 |
typedef typename packet_traits<Scalar>::type Packet; \ |
976 |
inline NAME(const NAME& other) : m_other(other.m_other) { } \ |
977 |
inline NAME(const Scalar& other) : m_other(other) { } \ |
978 |
inline Scalar operator() (const Scalar& a) const { return a OP m_other; } \ |
979 |
const Scalar m_other; \ |
980 |
}; \ |
981 |
template<typename Scalar> \ |
982 |
struct functor_traits<NAME<Scalar> > \ |
983 |
{ enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = false }; }; |
984 |
|
985 |
EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(^ , scalar_bitxor_op) |
986 |
EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(& , scalar_bitand_op) |
987 |
EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(| , scalar_bitor_op) |
988 |
|
989 |
#ifdef EIGEN_INCLUDE_ARRAY_BIT_SHIFT |
990 |
EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(>>, scalar_bitshr_op) |
991 |
EIGEN_MAKE_SCALAR_CWISE_UNARY_FUNCTOR(<<, scalar_bitshl_op) |
992 |
#endif |
993 |
|
994 |
#define EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(OP, NAME) \ |
995 |
template<typename Scalar> \ |
996 |
struct NAME { \ |
997 |
EIGEN_EMPTY_STRUCT_CTOR(NAME) \ |
998 |
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a, const Scalar& b) const { return a OP b; } \ |
999 |
}; \ |
1000 |
template<typename Scalar> \ |
1001 |
struct functor_traits<NAME<Scalar> > { enum { Cost = NumTraits<NAME<Scalar> >::AddCost, PacketAccess = false }; }; |
1002 |
|
1003 |
EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(|, scalar_bitor_binary_op) |
1004 |
EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(&, scalar_bitand_binary_op) |
1005 |
EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(^, scalar_bitxor_binary_op) |
1006 |
|
1007 |
#ifdef EIGEN_INCLUDE_ARRAY_BIT_SHIFT |
1008 |
EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(>>, scalar_bitshr_binary_op) |
1009 |
EIGEN_MAKE_SCALAR_CWISE_BINARY_FUNCTOR(<<, scalar_bitshl_binary_op) |
1010 |
#endif |
1011 |
|
972 |
} // end namespace internal |
1012 |
} // end namespace internal |
973 |
|
1013 |
|
974 |
#endif // EIGEN_FUNCTORS_H |
1014 |
#endif // EIGEN_FUNCTORS_H |