10 #ifndef EIGEN_UNARY_FUNCTORS_H 11 #define EIGEN_UNARY_FUNCTORS_H 25 template<
typename Packet>
29 template<
typename Scalar>
45 template<
typename Packet>
49 template<
typename Scalar>
67 template<
typename Scalar>
75 template<typename Score>
82 template<typename Scal>
83 EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const result_type operator() (const Scal&, const result_type& a)
const {
return a; }
96 template<
typename Packet>
100 template<
typename Scalar>
113 template<
typename Packet>
116 template<
typename Scalar>
134 template<
typename Packet>
138 template<
typename Scalar>
151 template<
typename Scalar,
typename NewType>
155 EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a)
const {
return cast<Scalar, NewType>(a); }
157 template<
typename Scalar,
typename NewType>
166 template<
typename Scalar>
173 template<
typename Scalar>
175 {
enum { Cost = 0, PacketAccess =
false }; };
182 template<
typename Scalar>
189 template<
typename Scalar>
191 {
enum { Cost = 0, PacketAccess =
false }; };
198 template<
typename Scalar>
203 EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a)
const {
return numext::real_ref(*const_cast<Scalar*>(&a)); }
205 template<
typename Scalar>
207 {
enum { Cost = 0, PacketAccess =
false }; };
214 template<
typename Scalar>
219 EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a)
const {
return numext::imag_ref(*const_cast<Scalar*>(&a)); }
221 template<
typename Scalar>
223 {
enum { Cost = 0, PacketAccess =
false }; };
233 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::exp(a); }
234 template <
typename Packet>
237 template <
typename Scalar>
242 #ifdef EIGEN_VECTORIZE_FMA 273 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::log(a); }
274 template <
typename Packet>
277 template <
typename Scalar>
284 #ifdef EIGEN_VECTORIZE_FMA 292 :
sizeof(Scalar)==4 ? 40 : 85)
304 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::log1p(a); }
305 template <
typename Packet>
308 template <
typename Scalar>
324 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const { EIGEN_USING_STD_MATH(
log10)
return log10(a); }
325 template <
typename Packet>
328 template<
typename Scalar>
338 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::sqrt(a); }
339 template <
typename Packet>
342 template <
typename Scalar>
347 Cost = (
sizeof(Scalar) == 8 ? 28
353 Cost = (
sizeof(Scalar) == 8 ? 28 : 14),
365 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return Scalar(1)/
numext::sqrt(a); }
366 template <
typename Packet>
370 template<
typename Scalar>
384 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a)
const {
return numext::cos(a); }
385 template <
typename Packet>
388 template<
typename Scalar>
403 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::sin(a); }
404 template <
typename Packet>
407 template<
typename Scalar>
423 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::tan(a); }
424 template <
typename Packet>
427 template<
typename Scalar>
442 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::acos(a); }
443 template <
typename Packet>
446 template<
typename Scalar>
461 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::asin(a); }
462 template <
typename Packet>
465 template<
typename Scalar>
481 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::atan(a); }
482 template <
typename Packet>
485 template<
typename Scalar>
498 template <
typename Scalar>
501 EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a)
const {
return numext::tanh(a); }
502 template <
typename Packet>
506 template <
typename Scalar>
512 #ifdef EIGEN_VECTORIZE_FMA
537 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::sinh(a); }
538 template <
typename Packet>
541 template<
typename Scalar>
556 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const {
return numext::cosh(a); }
557 template <
typename Packet>
560 template<
typename Scalar>
573 template<
typename Scalar>
576 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a)
const {
return Scalar(1)/a; }
577 template<
typename Packet>
581 template<
typename Scalar>
589 template<
typename Scalar>
592 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a)
const {
return a*a; }
593 template<
typename Packet>
597 template<
typename Scalar>
605 template<
typename Scalar>
608 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a)
const {
return a*a*a; }
609 template<
typename Packet>
613 template<
typename Scalar>
624 template <
typename Packet>
627 template<
typename Scalar>
643 template <
typename Packet>
646 template<
typename Scalar>
662 template <
typename Packet>
665 template<
typename Scalar>
683 template<
typename Scalar>
701 template<
typename Scalar>
719 template<
typename Scalar>
737 template<
typename Scalar>
749 template<typename Scalar,bool iscpx=(NumTraits<Scalar>::IsComplex!=0) >
struct scalar_sign_op;
750 template<
typename Scalar>
753 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const 755 return Scalar( (a>Scalar(0)) - (a<Scalar(0)) );
761 template<
typename Scalar>
764 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a)
const 768 if (aa==real_type(0))
770 aa = real_type(1)/aa;
771 return Scalar(
real(a)*aa,
imag(a)*aa );
777 template<
typename Scalar>
792 #endif // EIGEN_FUNCTORS_H EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isfinite(const half &a)
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
#define EIGEN_EMPTY_STRUCT_CTOR(X)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin(const Packet &a)
EIGEN_DEVICE_FUNC RealReturnType real() const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC const ExpReturnType exp() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patan(const Packet &a)
NumTraits< Scalar >::Real result_type
NumTraits< Scalar >::Real result_type
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC const TanhReturnType tanh() const
EIGEN_DEVICE_FUNC const LogReturnType log() const
NumTraits< Scalar >::Real result_type
EIGEN_DEVICE_FUNC const CoshReturnType cosh() const
DerType::Scalar imag(const AutoDiffScalar< DerType > &)
NumTraits< Scalar >::Real result_type
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psqrt(const Packet &a)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh(const Packet &a)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isinf(const half &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psinh(const Packet &a)
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp(const Packet &a)
EIGEN_DEVICE_FUNC const RoundReturnType round() const
EIGEN_DEVICE_FUNC const CosReturnType cos() const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pceil(const Packet &a)
EIGEN_DEVICE_FUNC const CeilReturnType ceil() const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptan(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog1p(const Packet &a)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
NumTraits< Scalar >::Real result_type
EIGEN_DEVICE_FUNC const Log1pReturnType log1p() const
EIGEN_DEVICE_FUNC const SinhReturnType sinh() const
EIGEN_DEVICE_FUNC Packet parg(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos(const Packet &a)
EIGEN_DEVICE_FUNC const AtanReturnType atan() const
EIGEN_DEVICE_FUNC const TanReturnType tan() const
EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf &a)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar &a) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
NumTraits< Scalar >::Real result_type
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet prsqrt(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC const AcosReturnType acos() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf &a)
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog10(const Packet &a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pfloor(const Packet &a)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &x) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog(const Packet &a)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pround(const Packet &a)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
EIGEN_DEVICE_FUNC const Log10ReturnType log10() const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
NumTraits< Scalar >::Real result_type
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos(const Packet &a)
EIGEN_DEVICE_FUNC const SinReturnType sin() const
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin(const Packet &a)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isnan(const half &a)
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
const AutoDiffScalar< DerType > & real(const AutoDiffScalar< DerType > &x)
NumTraits< Scalar >::Real result_type
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcosh(const Packet &a)
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC const AsinReturnType asin() const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f &a)
NumTraits< Scalar >::Real result_type