22 #ifndef RCPP_SUGAR_VECTORIZEDMATH_H
23 #define RCPP_SUGAR_VECTORIZEDMATH_H
28 extern "C" typedef double (*
DDFun)(double);
30 template <DDFun Func,
bool NA,
typename VEC>
38 return Func(
object[i] ) ;
40 inline R_xlen_t
size()
const {
return object.size(); }
46 template <DDFun Func,
bool NA,
typename VEC>
55 if( x == NA_INTEGER )
return NA_REAL ;
58 inline R_xlen_t
size()
const {
return object.size(); }
63 template <DDFun Func,
typename VEC>
65 public VectorBase<REALSXP,false, Vectorized_INTSXP<Func,false,VEC> >{
72 return Func(
object[i] ) ;
74 inline R_xlen_t
size()
const {
return object.size(); }
83 #define VECTORIZED_MATH_1(__NAME__,__SYMBOL__) \
85 template <bool NA, typename T> \
86 inline sugar::Vectorized<__SYMBOL__,NA,T> \
87 __NAME__( const VectorBase<REALSXP,NA,T>& t ){ \
88 return sugar::Vectorized<__SYMBOL__,NA,T>( t ) ; \
90 inline sugar::Vectorized<__SYMBOL__,true,NumericVector> \
91 __NAME__( SEXP x){ return __NAME__( NumericVector( x ) ) ; } \
92 template <bool NA, typename T> \
93 inline sugar::Vectorized_INTSXP<__SYMBOL__,NA,T> \
94 __NAME__( const VectorBase<INTSXP,NA,T>& t ){ \
95 return sugar::Vectorized_INTSXP<__SYMBOL__,NA,T>( t ) ; \
Vectorized< Func, NA, VEC > & get_ref()
Vectorized_INTSXP(const VEC_TYPE &object_)
Rcpp::VectorBase< INTSXP, false, VEC > VEC_TYPE
Rcpp::traits::Extractor< INTSXP, false, VEC >::type VEC_EXT
double operator[](R_xlen_t i) const
Vectorized_INTSXP(const VEC_TYPE &object_)
Rcpp::traits::Extractor< INTSXP, NA, VEC >::type VEC_EXT
double operator[](R_xlen_t i) const
Rcpp::VectorBase< INTSXP, NA, VEC > VEC_TYPE
Rcpp::traits::Extractor< REALSXP, NA, VEC >::type VEC_EXT
Vectorized(const VEC_TYPE &object_)
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, NA, VEC > VEC_TYPE