FunctorsPlugin.hpp
Go to the documentation of this file.
00001 #include <math.h>
00002 
00003 template<typename Scalar> struct scalar_sum_of_finites_op {
00004   EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_of_finites_op)
00005   EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const {
00006     using std::isfinite;
00007     if (isfinite(a) && isfinite(b)) return a + b;
00008     if (isfinite(a)) return a;
00009     if (isfinite(b)) return b;
00010     return a + b;
00011   }
00012 };
00013 template<typename Scalar>
00014 struct functor_traits<scalar_sum_of_finites_op<Scalar> > {
00015   enum {
00016     Cost = 2 * NumTraits<Scalar>::ReadCost + NumTraits<Scalar>::AddCost,
00017     PacketAccess = false
00018   };
00019 };
00020 
00021 template<typename Scalar>
00022 struct scalar_min_of_finites_op {
00023   EIGEN_EMPTY_STRUCT_CTOR(scalar_min_of_finites_op)
00024   EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const {
00025     using std::min;
00026     using std::isfinite;
00027     if (isfinite(a) && isfinite(b)) return (min)(a, b);
00028     if (isfinite(a)) return a;
00029     if (isfinite(b)) return b;
00030     return (min)(a, b);
00031   }
00032 };
00033 template<typename Scalar>
00034 struct functor_traits<scalar_min_of_finites_op<Scalar> > {
00035   enum {
00036     Cost = NumTraits<Scalar>::AddCost,
00037     PacketAccess = false
00038   };
00039 };
00040 
00041 template<typename Scalar>
00042 struct scalar_max_of_finites_op {
00043   EIGEN_EMPTY_STRUCT_CTOR(scalar_max_of_finites_op)
00044   EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const {
00045     using std::max;
00046     using std::isfinite;
00047     if (isfinite(a) && isfinite(b)) return (max)(a, b);
00048     if (isfinite(a)) return a;
00049     if (isfinite(b)) return b;
00050     return (max)(a, b);
00051   }
00052 };
00053 template<typename Scalar>
00054 struct functor_traits<scalar_max_of_finites_op<Scalar> > {
00055   enum {
00056     Cost = NumTraits<Scalar>::AddCost,
00057     PacketAccess = false
00058   };
00059 };


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jul 9 2019 05:06:13