[Rcpp-commits] r1921 - in pkg/Rcpp/inst: include/Rcpp/stats unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 5 18:48:23 CEST 2010


Author: romain
Date: 2010-08-05 18:48:22 +0200 (Thu, 05 Aug 2010)
New Revision: 1921

Modified:
   pkg/Rcpp/inst/include/Rcpp/stats/norm.h
   pkg/Rcpp/inst/unitTests/runit.stats.R
Log:
... almost ...

Modified: pkg/Rcpp/inst/include/Rcpp/stats/norm.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/norm.h	2010-08-05 15:47:29 UTC (rev 1920)
+++ pkg/Rcpp/inst/include/Rcpp/stats/norm.h	2010-08-05 16:48:22 UTC (rev 1921)
@@ -37,7 +37,7 @@
 			vec(vec_), mu(mu_), sigma(sigma_), log(log_) {}
 		
 		inline double operator[]( int i) const {
-			int x = vec[i] ;
+			double x = vec[i] ;
 			return Rcpp::traits::is_na<REALSXP>( x ) ? NA_REAL : ::dnorm( x, mu, sigma, log );
 		}
 		

Modified: pkg/Rcpp/inst/unitTests/runit.stats.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.stats.R	2010-08-05 15:47:29 UTC (rev 1920)
+++ pkg/Rcpp/inst/unitTests/runit.stats.R	2010-08-05 16:48:22 UTC (rev 1921)
@@ -59,7 +59,7 @@
 		bodies <- lapply( f, "[[", 2L )
 		fx <- cxxfunction( signatures, bodies, plugin = "Rcpp")
 		getDynLib( fx ) # just forcing loading the dll now
-		assign( ".rcpp.stats", fx, globalenv() )
+		assign( ".rcpp.stats", fx, globalenv() ) 
 	}
 }
 
@@ -80,7 +80,7 @@
 test.stats.dnorm <- function( ) {
 	fx <- .rcpp.stats$runit_dnorm
     v <- seq(0.0, 1.0, by=0.1)
-	checkEquals(fx(v),
+    checkEquals(fx(v),
                 list( false = dnorm(v, 0.0, 1.0), true = dnorm(v, 0.0, 1.0, TRUE ) ),
                 msg = "stats.dnorm" )
 }



More information about the Rcpp-commits mailing list