22 #ifndef Rcpp__sugar__pow_h
23 #define Rcpp__sugar__pow_h
28 template <
int RTYPE,
bool NA,
typename T,
typename EXPONENT_TYPE>
33 Pow(
const T& object_, EXPONENT_TYPE exponent ) :
object(object_),
op(exponent) {}
38 inline R_xlen_t
size()
const {
return object.size() ; }
45 template <
bool NA,
typename T,
typename EXPONENT_TYPE>
48 Pow(
const T& object_, EXPONENT_TYPE exponent ) :
object(object_),
op(exponent) {}
52 return x == NA_INTEGER ? NA_INTEGER :
::pow( x,
op );
54 inline R_xlen_t
size()
const {
return object.size() ; }
60 template <
typename T,
typename EXPONENT_TYPE>
61 class Pow<INTSXP,false,T,EXPONENT_TYPE> :
public Rcpp::VectorBase< REALSXP ,false, Pow<INTSXP,false,T,EXPONENT_TYPE> > {
63 Pow(
const T& object_, EXPONENT_TYPE exponent ) :
object(object_),
op(exponent) {}
68 inline R_xlen_t
size()
const {
return object.size() ; }
78 template <
int RTYPE,
bool NA,
typename T,
typename EXPONENT_TYPE>
81 EXPONENT_TYPE exponent
double operator[](R_xlen_t i) const
Pow(const T &object_, EXPONENT_TYPE exponent)
double operator[](R_xlen_t i) const
Pow(const T &object_, EXPONENT_TYPE exponent)
Pow(const T &object_, EXPONENT_TYPE exponent)
Rcpp::traits::storage_type< RTYPE >::type STORAGE
double operator[](R_xlen_t i) const
sugar::Pow< RTYPE, NA, T, EXPONENT_TYPE > pow(const VectorBase< RTYPE, NA, T > &t, EXPONENT_TYPE exponent)