[Rcpp-commits] r3038 - in pkg/Rcpp: . inst/include/Rcpp/stats/random

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 30 01:22:36 CEST 2011


Author: edd
Date: 2011-05-30 01:22:36 +0200 (Mon, 30 May 2011)
New Revision: 3038

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/stats/random/rlnorm.h
Log:
repaired sugar function rlnorm which had been left unused by accidentally declaring the wrong header guard
also fixed exp() calls to ::exp() and corrected a cut-and-paste typo


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2011-05-27 15:18:30 UTC (rev 3037)
+++ pkg/Rcpp/ChangeLog	2011-05-29 23:22:36 UTC (rev 3038)
@@ -1,3 +1,10 @@
+2011-05-29  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/Rcpp/stats/random/rlnorm.h: Repaired accidental header
+	guard from 'norm' to 'lnorm' so that the file really gets included,
+	make several calls to standard library'exp()' explicit as '::exp()'
+	and fixed a cut-and-paste typo
+
 2011-05-24  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/Rcpp/internal/wrap.h: For arguments of type const char *,

Modified: pkg/Rcpp/inst/include/Rcpp/stats/random/rlnorm.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/random/rlnorm.h	2011-05-27 15:18:30 UTC (rev 3037)
+++ pkg/Rcpp/inst/include/Rcpp/stats/random/rlnorm.h	2011-05-29 23:22:36 UTC (rev 3038)
@@ -19,8 +19,8 @@
 // You should have received a copy of the GNU General Public License
 // along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-#ifndef Rcpp__stats__random_norm_h
-#define Rcpp__stats__random_norm_h
+#ifndef Rcpp__stats__random_lnorm_h
+#define Rcpp__stats__random_lnorm_h
 
 namespace Rcpp {
 	namespace stats {
@@ -32,7 +32,7 @@
 				meanlog(meanlog_), sdlog(sdlog_) {}
 	
 			inline double operator()() const {
-				return exp( meanlog + sdlog * ::norm_rand() ) ;
+				return ::exp( meanlog + sdlog * ::norm_rand() ) ;
 			}
 	
 		private:
@@ -47,7 +47,7 @@
 				meanlog(meanlog_) {}
 	
 			inline double operator()() const {
-				return exp( meanlog + ::norm_rand() ) ;
+				return ::exp( meanlog + ::norm_rand() ) ;
 			}
 	
 		private:
@@ -57,10 +57,10 @@
 		class LNormGenerator_0 : public Generator<false,double> {
 		public:
 	
-			LNormGenerator_1( ) {}
+			LNormGenerator_0( ) {}
 	
 			inline double operator()() const {
-				return exp(::norm_rand() ) ;
+				return ::exp(::norm_rand() ) ;
 			}
 	
 		} ;
@@ -75,7 +75,7 @@
 			// TODO: R also throws a warning in that case, should we ?
 			return NumericVector( n, R_NaN ) ;
 		}  else if (sdlog == 0. || !R_FINITE(meanlog)){
-			return NumericVector( n, exp( meanlog ) ) ;
+			return NumericVector( n, ::exp( meanlog ) ) ;
 		} else {
 			return NumericVector( n, stats::LNormGenerator( meanlog, sdlog ) ); 
 		}



More information about the Rcpp-commits mailing list