22 #ifndef RCPP_SUGAR_SUGARMATH_H
23 #define RCPP_SUGAR_SUGARMATH_H
28 template <
bool NA,
typename RESULT_TYPE,
typename U1,
typename T1,
typename FunPtr>
30 Rcpp::traits::r_sexptype_traits<RESULT_TYPE>::rtype ,
32 SugarMath_1<NA,RESULT_TYPE,U1,T1,FunPtr>
42 if( ISNAN(x) )
return x;
52 template <
bool NA,
typename RESULT_TYPE,
typename T1,
typename FunPtr>
54 Rcpp::traits::r_sexptype_traits<RESULT_TYPE>::rtype ,
56 SugarMath_1<NA,RESULT_TYPE,int,T1,FunPtr>
75 template <
typename RESULT_TYPE,
typename T1,
typename FunPtr>
78 Rcpp::traits::r_sexptype_traits<RESULT_TYPE>::rtype ,
80 SugarMath_1<false,RESULT_TYPE,int,T1,FunPtr>
100 #define SUGAR_MATH_1(__NAME__,__SYMBOL__) \
102 template <bool NA, typename T> \
103 inline sugar::SugarMath_1<NA,double,double,T, double (*)(double) > \
105 const VectorBase<REALSXP,NA,T>& t \
107 return sugar::SugarMath_1<NA,double,double,T, double (*)(double)>( \
111 inline sugar::SugarMath_1<true,double,double,NumericVector,double(*)(double)> \
112 __NAME__( SEXP x){ return __NAME__( NumericVector( x ) ) ; } \
113 template <bool NA, typename T> \
114 inline sugar::SugarMath_1<NA,double,int,T, double (*)(double) > \
116 const VectorBase<INTSXP,NA,T>& t \
118 return sugar::SugarMath_1<NA,double,int,T, double (*)(double)>( \
SugarMath_1(FunPtr ptr_, const VEC_TYPE &vec_)
Rcpp::VectorBase< INTSXP,NA, T1 > VEC_TYPE
RESULT_TYPE operator[](R_xlen_t i) const
SugarMath_1(FunPtr ptr_, const VEC_TYPE &vec_)
Rcpp::VectorBase< INTSXP,false, T1 > VEC_TYPE
RESULT_TYPE operator[](R_xlen_t i) const
SugarMath_1(FunPtr ptr_, const VEC_TYPE &vec_)
RESULT_TYPE operator[](R_xlen_t i) const
Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits< RESULT_TYPE >::rtype,NA, T1 > VEC_TYPE
double get_na< REALSXP >()
bool is_na< INTSXP >(int x)