[Rcpp-commits] r1922 - pkg/Rcpp/inst/include/Rcpp/stats
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 5 19:24:49 CEST 2010
Author: romain
Date: 2010-08-05 19:24:49 +0200 (Thu, 05 Aug 2010)
New Revision: 1922
Modified:
pkg/Rcpp/inst/include/Rcpp/stats/binom.h
pkg/Rcpp/inst/include/Rcpp/stats/norm.h
pkg/Rcpp/inst/include/Rcpp/stats/pois.h
Log:
no need for NA special casing here
Modified: pkg/Rcpp/inst/include/Rcpp/stats/binom.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/binom.h 2010-08-05 16:48:22 UTC (rev 1921)
+++ pkg/Rcpp/inst/include/Rcpp/stats/binom.h 2010-08-05 17:24:49 UTC (rev 1922)
@@ -35,29 +35,6 @@
vec(vec_), n(n_), prob(prob_), log(log_) {}
inline double operator[]( int i) const {
- int x = vec[i] ;
- return Rcpp::traits::is_na<INTSXP>( x ) ? NA_REAL : ::dbinom( x, n, prob, log ) ;
- }
-
- inline int size() const { return vec.size(); }
-
-private:
- const VEC_TYPE& vec ;
- int n ;
- double prob ;
- int log ;
-
-} ;
-
-template <typename T>
-class DBinom<false,T> : public Rcpp::VectorBase< REALSXP, false, DBinom<false,T> >{
-public:
- typedef typename Rcpp::VectorBase<INTSXP,false,T> VEC_TYPE ;
-
- DBinom( const VEC_TYPE& vec_, int n_, double prob_, bool log_ ) :
- vec(vec_), n(n_), prob(prob_), log(log_) {}
-
- inline double operator[]( int i) const {
return ::dbinom( vec[i], n, prob, log ) ;
}
@@ -71,7 +48,6 @@
} ;
-
} // impl
template <bool NA, typename T>
Modified: pkg/Rcpp/inst/include/Rcpp/stats/norm.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/norm.h 2010-08-05 16:48:22 UTC (rev 1921)
+++ pkg/Rcpp/inst/include/Rcpp/stats/norm.h 2010-08-05 17:24:49 UTC (rev 1922)
@@ -37,8 +37,7 @@
vec(vec_), mu(mu_), sigma(sigma_), log(log_) {}
inline double operator[]( int i) const {
- double x = vec[i] ;
- return Rcpp::traits::is_na<REALSXP>( x ) ? NA_REAL : ::dnorm( x, mu, sigma, log );
+ return ::dnorm( vec[i], mu, sigma, log );
}
inline int size() const { return vec.size(); }
@@ -48,30 +47,8 @@
double mu, sigma;
int log;
-};
-
-template <typename T>
-class DNorm<false,T> : public Rcpp::VectorBase< REALSXP, false, DNorm<false,T> >{
-public:
- typedef typename Rcpp::VectorBase<REALSXP,false,T> VEC_TYPE;
+ };
- DNorm( const VEC_TYPE& vec_, double mu_, double sigma_, bool log_ = false ) :
- vec(vec_), mu(mu_), sigma(sigma_), log(log_) {}
-
- inline double operator[]( int i) const {
- return ::dnorm( vec[i], mu, sigma, log );
- }
-
- inline int size() const { return vec.size(); }
-
-private:
- const VEC_TYPE& vec;
- double mu, sigma;
- int log;
-
-} ;
-
-
} // impl
template <bool NA, typename T>
Modified: pkg/Rcpp/inst/include/Rcpp/stats/pois.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/pois.h 2010-08-05 16:48:22 UTC (rev 1921)
+++ pkg/Rcpp/inst/include/Rcpp/stats/pois.h 2010-08-05 17:24:49 UTC (rev 1922)
@@ -35,28 +35,6 @@
vec(vec_), lambda(lambda_), log(log_) {}
inline double operator[]( int i) const {
- int x = vec[i] ;
- return Rcpp::traits::is_na<INTSXP>( x ) ? NA_REAL : ::dpois( x, lambda, log ) ;
- }
-
- inline int size() const { return vec.size(); }
-
-private:
- const VEC_TYPE& vec ;
- double lambda ;
- int log ;
-
-} ;
-
-template <typename T>
-class DPois<false,T> : public Rcpp::VectorBase< REALSXP, false, DPois<false,T> >{
-public:
- typedef typename Rcpp::VectorBase<INTSXP,false,T> VEC_TYPE ;
-
- DPois( const VEC_TYPE& vec_, double lambda_, bool log_ = false ) :
- vec(vec_), lambda(lambda_), log(log_) {}
-
- inline double operator[]( int i) const {
return ::dpois( vec[i], lambda, log ) ;
}
@@ -69,7 +47,6 @@
} ;
-
} // impl
template <bool NA, typename T>
More information about the Rcpp-commits
mailing list