22 #ifndef Rcpp__sugar__times_h
23 #define Rcpp__sugar__times_h
28 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
44 if( traits::is_na<RTYPE>(lhs_) )
return lhs_ ;
46 return traits::is_na<RTYPE>(rhs_) ? rhs_ : (lhs_ * rhs_) ;
49 inline R_xlen_t
size()
const {
return lhs.size() ; }
56 template <
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
58 public Rcpp::VectorBase<REALSXP, true , Times_Vector_Vector<REALSXP,LHS_NA,LHS_T,RHS_NA,RHS_T> > {
74 inline R_xlen_t
size()
const {
return lhs.size() ; }
83 template <
int RTYPE,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
84 class Times_Vector_Vector<RTYPE,false,LHS_T,RHS_NA,RHS_T> :
public Rcpp::VectorBase<RTYPE,true, Times_Vector_Vector<RTYPE,false,LHS_T,RHS_NA,RHS_T> > {
98 if( traits::is_na<RTYPE>(rhs_) )
return rhs_ ;
99 return lhs[i] * rhs_ ;
102 inline R_xlen_t
size()
const {
return lhs.size() ; }
109 template <
typename LHS_T,
bool RHS_NA,
typename RHS_T >
111 public Rcpp::VectorBase<REALSXP,true, Times_Vector_Vector<REALSXP,false,LHS_T,RHS_NA,RHS_T> > {
126 inline R_xlen_t
size()
const {
return lhs.size() ; }
135 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
typename RHS_T >
136 class Times_Vector_Vector<RTYPE,LHS_NA,LHS_T,false,RHS_T> :
public Rcpp::VectorBase<RTYPE, true , Times_Vector_Vector<RTYPE,LHS_NA,LHS_T,false,RHS_T> > {
150 if( traits::is_na<RTYPE>(lhs_) )
return lhs_ ;
151 return lhs_ *
rhs[i] ;
154 inline R_xlen_t
size()
const {
return lhs.size() ; }
161 template <
bool LHS_NA,
typename LHS_T,
typename RHS_T >
163 public Rcpp::VectorBase<REALSXP, true , Times_Vector_Vector<REALSXP,LHS_NA,LHS_T,false,RHS_T> > {
178 inline R_xlen_t
size()
const {
return lhs.size() ; }
186 template <
int RTYPE,
typename LHS_T,
typename RHS_T >
187 class Times_Vector_Vector<RTYPE,false,LHS_T,false,RHS_T> :
public Rcpp::VectorBase<RTYPE, false , Times_Vector_Vector<RTYPE,false,LHS_T,false,RHS_T> > {
203 inline R_xlen_t
size()
const {
return lhs.size() ; }
210 template <
typename LHS_T,
typename RHS_T >
212 public Rcpp::VectorBase<REALSXP, false , Times_Vector_Vector<REALSXP,false,LHS_T,false,RHS_T> > {
227 inline R_xlen_t
size()
const {
return lhs.size() ; }
235 template <
int RTYPE,
bool NA,
typename T>
250 return Rcpp::traits::is_na<RTYPE>(x) ? x : (x *
rhs) ;
253 inline R_xlen_t
size()
const {
return lhs.size() ; }
261 template <
bool NA,
typename T>
263 public Rcpp::VectorBase<REALSXP,true, Times_Vector_Primitive<REALSXP,NA,T> > {
276 inline R_xlen_t
size()
const {
return lhs.size() ; }
284 template <
int RTYPE,
typename T>
299 inline R_xlen_t
size()
const {
return lhs.size() ; }
308 template <
typename T>
310 public Rcpp::VectorBase<REALSXP,false, Times_Vector_Primitive<REALSXP,false,T> > {
322 inline R_xlen_t
size()
const {
return lhs.size() ; }
335 template <
int RTYPE,
bool NA,
typename T>
348 return Rcpp::traits::is_na<RTYPE>(x) ? x : (x *
rhs) ;
351 inline R_xlen_t
size()
const {
return lhs.size() ; }
359 template <
bool NA,
typename T>
361 public Rcpp::VectorBase<REALSXP,true, Times_Vector_Primitive_nona<REALSXP,NA,T> > {
374 inline R_xlen_t
size()
const {
return lhs.size() ; }
382 template <
int RTYPE,
typename T>
397 inline R_xlen_t
size()
const {
return lhs.size() ; }
404 template <
typename T>
406 public Rcpp::VectorBase<REALSXP,false, Times_Vector_Primitive_nona<REALSXP,false,T> > {
418 inline R_xlen_t
size()
const {
return lhs.size() ; }
427 template <
int RTYPE,
bool NA,
typename T,
typename U>
437 template <
int RTYPE,
bool NA,
typename T,
typename U>
438 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value, sugar::Times_Vector_Primitive< RTYPE , NA , T > >::type
448 template <
int RTYPE,
bool NA,
typename T,
typename U>
449 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value, sugar::Times_Vector_Primitive_nona<RTYPE,NA,T> >::type
457 template <
int RTYPE,
bool NA,
typename T,
typename U>
458 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value, sugar::Times_Vector_Primitive_nona< RTYPE , NA , T > >::type
467 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
468 inline sugar::Times_Vector_Vector<
Times_Vector_Vector< RTYPE, LHS_NA, LHS_T, RHS_NA, RHS_T > & get_ref()
Rcpp::traits::Extractor< REALSXP, NA, T >::type EXT
Rcpp::VectorBase< REALSXP, NA, T > VEC_TYPE
Times_Vector_Primitive(const VEC_TYPE &lhs_, double rhs_)
double operator[](R_xlen_t i) const
Rcpp::traits::Extractor< REALSXP, false, T >::type EXT
Times_Vector_Primitive(const VEC_TYPE &lhs_, double rhs_)
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, false, T > VEC_TYPE
traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, false, T > VEC_TYPE
Rcpp::traits::Extractor< RTYPE, false, T >::type EXT
STORAGE operator[](R_xlen_t i) const
Times_Vector_Primitive(const VEC_TYPE &lhs_, STORAGE rhs_)
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, NA, T > VEC_TYPE
Rcpp::traits::Extractor< REALSXP, NA, T >::type EXT
Times_Vector_Primitive_nona(const VEC_TYPE &lhs_, double rhs_)
double operator[](R_xlen_t i) const
Times_Vector_Primitive_nona(const VEC_TYPE &lhs_, double rhs_)
Rcpp::traits::Extractor< REALSXP, false, T >::type EXT
Rcpp::VectorBase< REALSXP, false, T > VEC_TYPE
STORAGE operator[](R_xlen_t i) const
Rcpp::traits::Extractor< RTYPE, false, T >::type EXT
traits::storage_type< RTYPE >::type STORAGE
Times_Vector_Primitive_nona(const VEC_TYPE &lhs_, STORAGE rhs_)
Rcpp::VectorBase< RTYPE, false, T > VEC_TYPE
Rcpp::traits::Extractor< RTYPE, NA, T >::type EXT
STORAGE operator[](R_xlen_t i) const
traits::storage_type< RTYPE >::type STORAGE
Times_Vector_Primitive_nona(const VEC_TYPE &lhs_, STORAGE rhs_)
Rcpp::VectorBase< RTYPE, NA, T > VEC_TYPE
Rcpp::VectorBase< RTYPE, NA, T > VEC_TYPE
traits::storage_type< RTYPE >::type STORAGE
Times_Vector_Primitive(const VEC_TYPE &lhs_, STORAGE rhs_)
Rcpp::traits::Extractor< RTYPE, NA, T >::type EXT
STORAGE operator[](R_xlen_t i) const
Rcpp::traits::Extractor< REALSXP, RHS_NA, RHS_T >::type RHS_EXT
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::traits::Extractor< REALSXP, LHS_NA, LHS_T >::type LHS_EXT
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, RHS_NA, RHS_T > RHS_TYPE
Rcpp::VectorBase< REALSXP, LHS_NA, LHS_T > LHS_TYPE
Rcpp::traits::Extractor< REALSXP, LHS_NA, LHS_T >::type LHS_EXT
Rcpp::VectorBase< REALSXP, false, RHS_T > RHS_TYPE
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::traits::Extractor< REALSXP, false, RHS_T >::type RHS_EXT
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, LHS_NA, LHS_T > LHS_TYPE
Rcpp::traits::Extractor< REALSXP, false, LHS_T >::type LHS_EXT
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< REALSXP, false, LHS_T > LHS_TYPE
double operator[](R_xlen_t i) const
Rcpp::traits::Extractor< REALSXP, RHS_NA, RHS_T >::type RHS_EXT
Rcpp::VectorBase< REALSXP, RHS_NA, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< REALSXP, false, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< REALSXP, false, RHS_T >::type RHS_EXT
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, false, RHS_T > RHS_TYPE
Rcpp::VectorBase< REALSXP, false, LHS_T > LHS_TYPE
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< RTYPE, LHS_NA, LHS_T > LHS_TYPE
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< RTYPE, false, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< RTYPE, false, RHS_T >::type RHS_EXT
Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T >::type LHS_EXT
traits::storage_type< RTYPE >::type STORAGE
Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T >::type RHS_EXT
Rcpp::traits::Extractor< RTYPE, false, LHS_T >::type LHS_EXT
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
traits::storage_type< RTYPE >::type STORAGE
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< RTYPE, RHS_NA, RHS_T > RHS_TYPE
Rcpp::VectorBase< RTYPE, false, LHS_T > LHS_TYPE
traits::storage_type< RTYPE >::type STORAGE
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< RTYPE, false, LHS_T > LHS_TYPE
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::traits::Extractor< RTYPE, false, RHS_T >::type RHS_EXT
Rcpp::VectorBase< RTYPE, false, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< RTYPE, false, LHS_T >::type LHS_EXT
traits::storage_type< RTYPE >::type STORAGE
Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T >::type RHS_EXT
Rcpp::VectorBase< RTYPE, RHS_NA, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T >::type LHS_EXT
Times_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< RTYPE, LHS_NA, LHS_T > LHS_TYPE
sugar::IsNa< RTYPE, NA, T > is_na(const Rcpp::VectorBase< RTYPE, NA, T > &t)
traits::enable_if< traits::is_convertible< typename traits::remove_const_and_reference< U >::type, typename traits::storage_type< RTYPE >::type >::value, sugar::Times_Vector_Primitive< RTYPE, NA, T > >::type operator*(const VectorBase< RTYPE, NA, T > &lhs, const U &rhs)