[Rcpp-commits] r2007 - in pkg/Rcpp: . inst inst/include inst/include/Rcpp/stats inst/include/Rcpp/stats/random inst/include/Rcpp/sugar inst/include/Rcpp/sugar/functions

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 15 11:29:16 CEST 2010


Author: romain
Date: 2010-08-15 11:29:16 +0200 (Sun, 15 Aug 2010)
New Revision: 2007

Added:
   pkg/Rcpp/inst/include/Rcpp/sugar/undoRmath.h
Modified:
   pkg/Rcpp/TODO
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp.h
   pkg/Rcpp/inst/include/Rcpp/stats/binom.h
   pkg/Rcpp/inst/include/Rcpp/stats/cauchy.h
   pkg/Rcpp/inst/include/Rcpp/stats/logis.h
   pkg/Rcpp/inst/include/Rcpp/stats/nbeta.h
   pkg/Rcpp/inst/include/Rcpp/stats/nbinom.h
   pkg/Rcpp/inst/include/Rcpp/stats/nchisq.h
   pkg/Rcpp/inst/include/Rcpp/stats/nf.h
   pkg/Rcpp/inst/include/Rcpp/stats/norm.h
   pkg/Rcpp/inst/include/Rcpp/stats/nt.h
   pkg/Rcpp/inst/include/Rcpp/stats/pois.h
   pkg/Rcpp/inst/include/Rcpp/stats/random/rchisq.h
   pkg/Rcpp/inst/include/Rcpp/stats/random/rf.h
   pkg/Rcpp/inst/include/Rcpp/stats/t.h
   pkg/Rcpp/inst/include/Rcpp/stats/unif.h
   pkg/Rcpp/inst/include/Rcpp/stats/weibull.h
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/SugarBlock.h
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/math.h
Log:
undo the macros defined by Rmath.h and deal with the consequences

Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/TODO	2010-08-15 09:29:16 UTC (rev 2007)
@@ -46,9 +46,9 @@
         
 Syntactic sugar
 
-	o	recycling : binary operators and math functions of 2 or more arguments
-		need to recycle their arguments. 
-
+    o	recycling : binary operators and math functions of 2 or more arguments
+    need to recycle their arguments. 
+    
     o	not sure rep should be lazy, i.e. rep( x, 4 ) fetches x[i] 4 times, 
 	maybe we should use LazyVector like in outer to somehow cache the 
 	result when it is judged expensive to calculate

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/ChangeLog	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,3 +1,12 @@
+2010-08-15  Romain Francois <romain at r-enthusiasts.com>
+
+	* inst/include/Rcpp/sugar/SugarBlock.h: more control of the NA behavior 
+	in SUGAR_BLOCK_2. SUGAR_BLOCK_2 will now propagate the NA, and the new
+	SUGAR_BLOCK_2_NA will use a fixed NA (can be true or false). This can be
+	useful if the function that is sugar'ed never generates NA.
+	
+	* inst/include/Rcpp/sugar/undoRmath.h : undo the macros done by Rmath.h
+
 2010-08-13  Douglas Bates  <bates at stat.wisc.edu>
 
 	* include/Rcpp.h: undo more defines from Rmath.h

Modified: pkg/Rcpp/inst/include/Rcpp/stats/binom.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/binom.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/binom.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -22,6 +22,6 @@
 #ifndef Rcpp__stats__binom_h
 #define Rcpp__stats__binom_h
 
-RCPP_DPQ_2(binom,::dbinom,::pbinom,::qbinom)
+RCPP_DPQ_2(binom,::Rf_dbinom,::Rf_pbinom,::Rf_qbinom)
 
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/stats/cauchy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/cauchy.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/cauchy.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // cauchy.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -29,24 +26,24 @@
 namespace stats{
 
 inline double dcauchy_0(double x, int give_log){
-	return ::dcauchy(x,0.0,1.0, give_log) ;
+	return ::Rf_dcauchy(x,0.0,1.0, give_log) ;
 }
 inline double dcauchy_1(double x, double location, int give_log){
-	return ::dcauchy(x,location,1.0, give_log) ;
+	return ::Rf_dcauchy(x,location,1.0, give_log) ;
 }
 
 inline double pcauchy_0(double x, int lower_tail, int log_p){
-	return ::pcauchy(x,0.0,1.0,lower_tail, log_p) ;
+	return ::Rf_pcauchy(x,0.0,1.0,lower_tail, log_p) ;
 }
 inline double pcauchy_1(double x, double location, int lower_tail, int log_p){
-	return ::pcauchy(x,location,1.0,lower_tail, log_p) ;
+	return ::Rf_pcauchy(x,location,1.0,lower_tail, log_p) ;
 }
 
 inline double qcauchy_0(double p, int lower_tail, int log_p){
-	return ::qcauchy(p, 0.0, 1.0, lower_tail, log_p ) ;
+	return ::Rf_qcauchy(p, 0.0, 1.0, lower_tail, log_p ) ;
 }
 inline double qcauchy_1(double p, double location, int lower_tail, int log_p){
-	return ::qcauchy(p, location, 1.0, lower_tail, log_p ) ;
+	return ::Rf_qcauchy(p, location, 1.0, lower_tail, log_p ) ;
 }
 
 } // stats
@@ -55,7 +52,7 @@
 
 RCPP_DPQ_0(cauchy,Rcpp::stats::dcauchy_0,Rcpp::stats::pcauchy_0,Rcpp::stats::qcauchy_0)
 RCPP_DPQ_1(cauchy,Rcpp::stats::dcauchy_1,Rcpp::stats::pcauchy_1,Rcpp::stats::qcauchy_1)
-RCPP_DPQ_2(cauchy,::dcauchy,::pcauchy,::qcauchy)
+RCPP_DPQ_2(cauchy,::Rf_dcauchy,::Rf_pcauchy,::Rf_qcauchy)
 
 
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/stats/logis.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/logis.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/logis.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -38,7 +38,7 @@
 			vec(vec_), location(location_), scale(scale_) , log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::dlogis( vec[i], location, scale , log );
+			return ::Rf_dlogis( vec[i], location, scale , log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -60,7 +60,7 @@
 			vec(vec_), location(location_), scale(scale_) , lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::plogis( vec[i], location, scale, lower, log );
+			return ::Rf_plogis( vec[i], location, scale, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -82,7 +82,7 @@
 			vec(vec_), location(location_), scale(scale_), lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::qlogis( vec[i], location, scale, lower, log );
+			return ::Rf_qlogis( vec[i], location, scale, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }

Modified: pkg/Rcpp/inst/include/Rcpp/stats/nbeta.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/nbeta.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/nbeta.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // nbeta.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -25,93 +22,7 @@
 #ifndef Rcpp__stats__nbeta_h
 #define Rcpp__stats__nbeta_h
 
-namespace Rcpp {
-namespace stats {
+RCPP_DPQ_3(nbeta,::Rf_dnbeta,::Rf_pbeta,::Rf_qbeta)
 
-
-	template <bool NA, typename T>
-	class DNbeta : public Rcpp::VectorBase< REALSXP, NA, DNbeta<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		DNbeta( const VEC_TYPE& vec_, double shape1_, double shape2_, double ncp_ , bool log_ = false ) : 
-			vec(vec_), shape1(shape1_), shape2(shape2_), ncp(ncp_) , log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::dnbeta( vec[i], shape1, shape2, ncp , log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double shape1; double shape2; double ncp; 
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PNbeta : public Rcpp::VectorBase< REALSXP, NA, PNbeta<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		PNbeta( const VEC_TYPE& vec_, double shape1_, double shape2_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), shape1(shape1_), shape2(shape2_), ncp(ncp_) , lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::pnbeta( vec[i], shape1, shape2, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double shape1; double shape2; double ncp; 
-		int lower, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QNbeta : public Rcpp::VectorBase< REALSXP, NA, QNbeta<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		QNbeta( const VEC_TYPE& vec_, double shape1_, double shape2_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), shape1(shape1_), shape2(shape2_), ncp(ncp_), lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::qnbeta( vec[i], shape1, shape2, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double shape1; double shape2; double ncp; 
-		int lower, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DNbeta<NA,T> dnbeta( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape1_, double shape2_, double ncp_, bool log = false ) {
-	return stats::DNbeta<NA,T>( x, shape1_, shape2_, ncp_, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PNbeta<NA,T> pnbeta( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape1_, double shape2_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::PNbeta<NA,T>( x, shape1_, shape2_, ncp_, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QNbeta<NA,T> qnbeta( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape1_, double shape2_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::QNbeta<NA,T>( x, shape1_, shape2_, ncp_, lower, log ); 
-}
-	
-}
-
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/stats/nbinom.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/nbinom.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/nbinom.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // nbinom.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -25,93 +22,7 @@
 #ifndef Rcpp__stats__nbinom_h
 #define Rcpp__stats__nbinom_h
 
-namespace Rcpp {
-namespace stats {
-
-
-	template <bool NA, typename T>
-	class DNbinom : public Rcpp::VectorBase< REALSXP, NA, DNbinom<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
+RCPP_DPQ_2(nbinom, ::Rf_dnbinom, ::Rf_pnbinom, ::Rf_qnbinom )
 	
-		DNbinom( const VEC_TYPE& vec_, int size_, double prob_ , bool log_ = false ) : 
-			vec(vec_), siz(size_), prob(prob_) , log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::dnbinom( vec[i], siz, prob , log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		int siz; double prob; 
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PNbinom : public Rcpp::VectorBase< REALSXP, NA, PNbinom<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		PNbinom( const VEC_TYPE& vec_, int size_, double prob_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), siz(size_), prob(prob_) , lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::pnbinom( vec[i], siz, prob, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		int siz; double prob; 
-		int lower, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QNbinom : public Rcpp::VectorBase< REALSXP, NA, QNbinom<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		QNbinom( const VEC_TYPE& vec_, int size_, double prob_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), siz(size_), prob(prob_), lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::qnbinom( vec[i], siz, prob, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		int siz; double prob; 
-		int lower, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DNbinom<NA,T> dnbinom( const Rcpp::VectorBase<REALSXP,NA,T>& x, int size_, double prob_, bool log = false ) {
-	return stats::DNbinom<NA,T>( x, size_, prob_, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PNbinom<NA,T> pnbinom( const Rcpp::VectorBase<REALSXP,NA,T>& x, int size_, double prob_, bool lower = true, bool log = false ) {
-	return stats::PNbinom<NA,T>( x, size_, prob_, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QNbinom<NA,T> qnbinom( const Rcpp::VectorBase<REALSXP,NA,T>& x, int size_, double prob_, bool lower = true, bool log = false ) {
-	return stats::QNbinom<NA,T>( x, size_, prob_, lower, log ); 
-}
-	
-}
-
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/stats/nchisq.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/nchisq.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/nchisq.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // nchisq.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -25,93 +22,7 @@
 #ifndef Rcpp__stats__nchisq_h
 #define Rcpp__stats__nchisq_h
 
-namespace Rcpp {
-namespace stats {
+RCPP_DPQ_2( nchisq, ::Rf_dnchisq, ::Rf_pnchisq, ::Rf_qnchisq )
 
-
-	template <bool NA, typename T>
-	class DNchisq : public Rcpp::VectorBase< REALSXP, NA, DNchisq<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		DNchisq( const VEC_TYPE& vec_, double df_, double ncp_ , bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_) , log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::dnchisq( vec[i], df, ncp , log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PNchisq : public Rcpp::VectorBase< REALSXP, NA, PNchisq<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		PNchisq( const VEC_TYPE& vec_, double df_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_) , lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::pnchisq( vec[i], df, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int lower, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QNchisq : public Rcpp::VectorBase< REALSXP, NA, QNchisq<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		QNchisq( const VEC_TYPE& vec_, double df_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_), lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::qnchisq( vec[i], df, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int lower, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DNchisq<NA,T> dnchisq( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool log = false ) {
-	return stats::DNchisq<NA,T>( x, df_, ncp_, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PNchisq<NA,T> pnchisq( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::PNchisq<NA,T>( x, df_, ncp_, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QNchisq<NA,T> qnchisq( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::QNchisq<NA,T>( x, df_, ncp_, lower, log ); 
-}
-	
-}
-
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/stats/nf.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/nf.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/nf.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // nf.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -25,93 +22,7 @@
 #ifndef Rcpp__stats__nf_h
 #define Rcpp__stats__nf_h
 
-namespace Rcpp {
-namespace stats {
+RCPP_DPQ_3(nf,::Rf_dnf,::Rf_pnf,::Rf_qnf)
 
-
-	template <bool NA, typename T>
-	class DNf : public Rcpp::VectorBase< REALSXP, NA, DNf<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		DNf( const VEC_TYPE& vec_, double df1_, double df2_, double ncp_ , bool log_ = false ) : 
-			vec(vec_), df1(df1_), df2(df2_), ncp(ncp_) , log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::dnf( vec[i], df1, df2, ncp , log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df1; double df2; double ncp; 
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PNf : public Rcpp::VectorBase< REALSXP, NA, PNf<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		PNf( const VEC_TYPE& vec_, double df1_, double df2_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df1(df1_), df2(df2_), ncp(ncp_) , lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::pnf( vec[i], df1, df2, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df1; double df2; double ncp; 
-		int lower, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QNf : public Rcpp::VectorBase< REALSXP, NA, QNf<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		QNf( const VEC_TYPE& vec_, double df1_, double df2_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df1(df1_), df2(df2_), ncp(ncp_), lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::qnf( vec[i], df1, df2, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df1; double df2; double ncp; 
-		int lower, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DNf<NA,T> dnf( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df1_, double df2_, double ncp_, bool log = false ) {
-	return stats::DNf<NA,T>( x, df1_, df2_, ncp_, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PNf<NA,T> pnf( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df1_, double df2_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::PNf<NA,T>( x, df1_, df2_, ncp_, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QNf<NA,T> qnf( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df1_, double df2_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::QNf<NA,T>( x, df1_, df2_, ncp_, lower, log ); 
-}
-	
-}
-
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/stats/norm.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/norm.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/norm.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -37,7 +37,7 @@
 			vec(vec_), mu(mu_), sigma(sigma_), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::dnorm4( vec[i], mu, sigma, log );
+			return ::Rf_dnorm4( vec[i], mu, sigma, log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -59,7 +59,7 @@
 			vec(vec_), mu(mu_), sigma(sigma_), lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::pnorm5( vec[i], mu, sigma, lower, log );
+			return ::Rf_pnorm5( vec[i], mu, sigma, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -81,7 +81,7 @@
 			vec(vec_), mu(mu_), sigma(sigma_), lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::qnorm5( vec[i], mu, sigma, lower, log );
+			return ::Rf_qnorm5( vec[i], mu, sigma, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }

Modified: pkg/Rcpp/inst/include/Rcpp/stats/nt.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/nt.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/nt.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -1,8 +1,5 @@
-
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
-// auto generated file (from script/stats.R) 
-//
 // nt.h: Rcpp R/C++ interface class library -- 
 //
 // Copyright (C) 2010 Douglas Bates, Dirk Eddelbuettel and Romain Francois
@@ -25,93 +22,7 @@
 #ifndef Rcpp__stats__nt_h
 #define Rcpp__stats__nt_h
 
-namespace Rcpp {
-namespace stats {
+RCPP_DPQ_2(t,::Rf_dt,::Rf_pt,::Rf_qt)
 
-
-	template <bool NA, typename T>
-	class DNt : public Rcpp::VectorBase< REALSXP, NA, DNt<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		DNt( const VEC_TYPE& vec_, double df_, double ncp_ , bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_) , log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::dnt( vec[i], df, ncp , log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PNt : public Rcpp::VectorBase< REALSXP, NA, PNt<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		PNt( const VEC_TYPE& vec_, double df_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_) , lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::pnt( vec[i], df, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int lower, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QNt : public Rcpp::VectorBase< REALSXP, NA, QNt<NA,T> >{
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-	
-		QNt( const VEC_TYPE& vec_, double df_, double ncp_ ,
-			   bool lower_tail = true, bool log_ = false ) : 
-			vec(vec_), df(df_), ncp(ncp_), lower(lower_tail), log(log_) {}
-		
-		inline double operator[]( int i) const {
-			return ::qnt( vec[i], df, ncp, lower, log );
-		}
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df; double ncp; 
-		int lower, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DNt<NA,T> dnt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool log = false ) {
-	return stats::DNt<NA,T>( x, df_, ncp_, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PNt<NA,T> pnt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::PNt<NA,T>( x, df_, ncp_, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QNt<NA,T> qnt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df_, double ncp_, bool lower = true, bool log = false ) {
-	return stats::QNt<NA,T>( x, df_, ncp_, lower, log ); 
-}
-	
-}
-
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/stats/pois.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/pois.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/pois.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -22,92 +22,6 @@
 #ifndef Rcpp__stats__pois_h
 #define Rcpp__stats__pois_h
 
-namespace Rcpp{
-namespace stats{
+RCPP_DPQ_1(pois,::Rf_dpois,::Rf_ppois,::Rf_qpois)
 
-
-template <bool NA, typename T>
-class DPois : public Rcpp::VectorBase< REALSXP, NA, DPois<NA,T> >{
-public:
-	typedef typename Rcpp::VectorBase<INTSXP,NA,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 ) ;
-	}
-	
-	inline int size() const { return vec.size(); }
-	
-private:
-	const VEC_TYPE& vec ;
-	double lambda ;
-	int log ;
-	
-} ;
-
-template <bool NA, typename T>
-class PPois : public Rcpp::VectorBase< REALSXP, NA, PPois<NA,T> >{
-public:
-    typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE ;
-	
-    PPois( const VEC_TYPE& vec_, double lambda_, bool lower_tail = true, bool log_ = false ) : 
-	vec(vec_), lambda(lambda_), lower(lower_tail), log(log_) {}
-	
-    inline double operator[]( int i) const {
-	return ::ppois( vec[i], lambda, lower, log ) ;
-    }
-	
-    inline int size() const { return vec.size(); }
-	
-private:
-    const VEC_TYPE& vec ;
-    double lambda ;
-    int lower, log ;
-	
-} ;
-
-template <bool NA, typename T>
-class QPois : public Rcpp::VectorBase< REALSXP, NA, QPois<NA,T> >{
-public:
-    typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE ;
-	
-    QPois( const VEC_TYPE& vec_, double lambda_, bool lower_tail = true, bool log_ = false ) : 
-	vec(vec_), lambda(lambda_), lower(lower_tail), log(log_) {}
-	
-    inline double operator[]( int i) const {
-	return ::qpois( vec[i], lambda, lower, log ) ;
-    }
-	
-    inline int size() const { return vec.size(); }
-	
-private:
-    const VEC_TYPE& vec ;
-    double lambda ;
-    int lower, log ;
-	
-} ;
-
-} // stats
-
-template <bool NA, typename T>
-inline stats::DPois<NA,T> dpois( const Rcpp::VectorBase<INTSXP,NA,T>& x, double lambda, bool log = false ){
-	return stats::DPois<NA,T>( x, lambda, log ); 
-}
-	
-template <bool NA, typename T>
-inline stats::PPois<NA,T> ppois( const Rcpp::VectorBase<REALSXP,NA,T>& x,
-				double lambda, bool lower = true, bool log = false ){
-    return stats::PPois<NA,T>( x, lambda, lower, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QPois<NA,T> qpois( const Rcpp::VectorBase<REALSXP,NA,T>& x,
-				double lambda, bool lower = true, bool log = false ){
-    return stats::QPois<NA,T>( x, lambda, lower, log ); 
-}
-	
-}
-
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/stats/random/rchisq.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/random/rchisq.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/random/rchisq.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -31,7 +31,7 @@
 	ChisqGenerator( double df_ ) : df_2(df_ / 2.0) {}
 	
 	inline double operator()() const {
-		return ::rgamma( df_2, 2.0 ) ; 
+		return ::Rf_rgamma( df_2, 2.0 ) ; 
 	}
 	
 private:

Modified: pkg/Rcpp/inst/include/Rcpp/stats/random/rf.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/random/rf.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/random/rf.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -35,7 +35,7 @@
 	inline double operator()() const {
 		// here we know that both n1 and n2 are finite
 		// return ( ::rchisq( n1 ) / n1 ) / ( ::rchisq( n2 ) / n2 );
-		return ratio * ::rgamma( n1__2, 2.0 ) / ::rgamma( n2__2, 2.0 ) ;
+		return ratio * ::Rf_rgamma( n1__2, 2.0 ) / ::Rf_rgamma( n2__2, 2.0 ) ;
 	}
 	
 private:
@@ -50,7 +50,7 @@
 	
 	inline double operator()() const {
 		// return n2  / ::rchisq( n2 ) ;
-		return n2 / ::rgamma( n2__2, 2.0 ) ;
+		return n2 / ::Rf_rgamma( n2__2, 2.0 ) ;
 	}
 	
 private:
@@ -65,7 +65,7 @@
 	
 	inline double operator()() const {
 		// return ::rchisq( n1 ) / n1 ;
-		return ::rgamma( n1__2, 2.0 ) / n1 ;
+		return ::Rf_rgamma( n1__2, 2.0 ) / n1 ;
 	}
 	
 private:

Modified: pkg/Rcpp/inst/include/Rcpp/stats/t.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/t.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/t.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -22,86 +22,6 @@
 #ifndef Rcpp__stats__t_h
 #define Rcpp__stats__t_h
 
-namespace Rcpp {
+RCPP_DPQ_1(t, ::Rf_dt, ::Rf_pt, ::Rf_qt)
 
-namespace stats {
-
-
-
-	template <bool NA, typename T>
-	class DT : public Rcpp::VectorBase< REALSXP, NA, DT<NA,T> > {
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-
-		DT( const VEC_TYPE& vec_, double df_, bool log_ = false ) : 
-			vec(vec_), df(df_), log(log_) {}
-		
-		inline double operator[]( int i) const { return ::dt( vec[i], df, log ); }
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df;
-		int log;
-	
-	};
-
-	template <bool NA, typename T>
-	class PT : public Rcpp::VectorBase< REALSXP, NA, PT<NA,T> > {
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-
-		PT( const VEC_TYPE& vec_, double df_, bool lowertail_ = true, bool log_ = false ) : 
-			vec(vec_), df(df_), lowertail(lowertail_), log(log_) {}
-		
-		inline double operator[]( int i) const { return ::pt( vec[i], df, lowertail, log ); }
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df;
-		int lowertail, log;
-	
-	};
-
-	template <bool NA, typename T>
-	class QT : public Rcpp::VectorBase< REALSXP, NA, QT<NA,T> > {
-	public:
-		typedef typename Rcpp::VectorBase<REALSXP,NA,T> VEC_TYPE;
-
-		QT( const VEC_TYPE& vec_, double df_, bool lowertail_ = true, bool log_ = false ) : 
-			vec(vec_), df(df_), lowertail(lowertail_), log(log_) {}
-		
-		inline double operator[]( int i) const { return ::qt( vec[i], df, lowertail, log ); }
-		
-		inline int size() const { return vec.size(); }
-		
-	private:
-		const VEC_TYPE& vec;
-		double df;
-		int lowertail, log;
-	
-	};
-	
-} // stats
-
-template <bool NA, typename T>
-inline stats::DT<NA,T> dt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df, bool log = false ) {
-	return stats::DT<NA,T>( x, df, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::PT<NA,T> pt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df, bool lowertail = true, bool log = false ) {
-	return stats::PT<NA,T>( x, df, lowertail, log ); 
-}
-
-template <bool NA, typename T>
-inline stats::QT<NA,T> qt( const Rcpp::VectorBase<REALSXP,NA,T>& x, double df, bool lowertail = true, bool log = false ) {
-	return stats::QT<NA,T>( x, df, lowertail, log ); 
-}
-	
-}
-
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/stats/unif.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/unif.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/unif.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -38,7 +38,7 @@
 			vec(vec_), min(min_), max(max_) , log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::dunif( vec[i], min, max , log );
+			return ::Rf_dunif( vec[i], min, max , log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -60,7 +60,7 @@
 			vec(vec_), min(min_), max(max_) , lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::punif( vec[i], min, max, lower, log );
+			return ::Rf_punif( vec[i], min, max, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -82,7 +82,7 @@
 			vec(vec_), min(min_), max(max_), lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::qunif( vec[i], min, max, lower, log );
+			return ::Rf_qunif( vec[i], min, max, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }

Modified: pkg/Rcpp/inst/include/Rcpp/stats/weibull.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/weibull.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/stats/weibull.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -38,7 +38,7 @@
 			vec(vec_), shape(shape_), scale(scale_) , log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::dweibull( vec[i], shape, scale , log );
+			return ::Rf_dweibull( vec[i], shape, scale , log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -60,7 +60,7 @@
 			vec(vec_), shape(shape_), scale(scale_) , lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::pweibull( vec[i], shape, scale, lower, log );
+			return ::Rf_pweibull( vec[i], shape, scale, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }
@@ -82,7 +82,7 @@
 			vec(vec_), shape(shape_), scale(scale_), lower(lower_tail), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			return ::qweibull( vec[i], shape, scale, lower, log );
+			return ::Rf_qweibull( vec[i], shape, scale, lower, log );
 		}
 		
 		inline int size() const { return vec.size(); }

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/SugarBlock.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/SugarBlock.h	2010-08-15 08:40:01 UTC (rev 2006)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/SugarBlock.h	2010-08-15 09:29:16 UTC (rev 2007)
@@ -101,53 +101,88 @@
 
 } // sugar
 } // Rcpp
+                                                            
+#define SUGAR_BLOCK_1(__NAME__,__SYMBOL__)                                                \
+	namespace Rcpp{                                                                       \
+	template <bool NA, typename T>                                                        \
+	inline sugar::SugarBlock_1<NA,double,double,T>                                        \
+	__NAME__(                                                                             \
+		const VectorBase<REALSXP,NA,T>& t                                                 \
+	){                                                                                    \
+		return sugar::SugarBlock_1<NA,double,double,T>(                                   \
+			__SYMBOL__ , t                                                                \
+		) ;                                                                               \
+	}                                                                                     \
+	}
 
-#define SUGAR_BLOCK_1(__NAME__,__SYMBOL__) \
-	namespace Rcpp{                                                 \
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 2007


More information about the Rcpp-commits mailing list