[Rcpp-commits] r1668 - pkg/Rcpp/inst/examples/SugarPerformance
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 23 14:13:35 CEST 2010
Author: romain
Date: 2010-06-23 14:13:35 +0200 (Wed, 23 Jun 2010)
New Revision: 1668
Modified:
pkg/Rcpp/inst/examples/SugarPerformance/vectorOps.R
Log:
spaces
Modified: pkg/Rcpp/inst/examples/SugarPerformance/vectorOps.R
===================================================================
--- pkg/Rcpp/inst/examples/SugarPerformance/vectorOps.R 2010-06-23 12:12:17 UTC (rev 1667)
+++ pkg/Rcpp/inst/examples/SugarPerformance/vectorOps.R 2010-06-23 12:13:35 UTC (rev 1668)
@@ -64,23 +64,23 @@
}
benchmark( '
- NumericVector res1( n ) ;
- double x_ = 0.0 ;
- double y_ = 0.0 ;
- for( int i=0; i<n; i++){
- x_ = x[i] ;
- y_ = y[i] ;
- if( R_IsNA(x_) || R_IsNA(y_) ){
- res1[i] = NA_REAL;
- } else if( x_ < y_ ){
- res1[i] = x_ * x_ ;
- } else {
- res1[i] = -( y_ * y_) ;
- }
+ NumericVector res1( n ) ;
+ double x_ = 0.0 ;
+ double y_ = 0.0 ;
+ for( int i=0; i<n; i++){
+ x_ = x[i] ;
+ y_ = y[i] ;
+ if( R_IsNA(x_) || R_IsNA(y_) ){
+ res1[i] = NA_REAL;
+ } else if( x_ < y_ ){
+ res1[i] = x_ * x_ ;
+ } else {
+ res1[i] = -( y_ * y_) ;
}
+ }
', '
- NumericVector res2 = ifelse( x < y, x*x, -(y*y) ) ;
+ NumericVector res2 = ifelse( x < y, x*x, -(y*y) ) ;
', quote(ifelse(x<y, x*x, -(y*y) ))
)
More information about the Rcpp-commits
mailing list