[Rcpp-commits] r2346 - in pkg/RcppDE: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 20 05:28:28 CEST 2010


Author: edd
Date: 2010-10-20 05:28:27 +0200 (Wed, 20 Oct 2010)
New Revision: 2346

Modified:
   pkg/RcppDE/ChangeLog
   pkg/RcppDE/R/DEoptim.R
Log:
match DEoptim for storepop list by shrinking by one element and setting dimnames


Modified: pkg/RcppDE/ChangeLog
===================================================================
--- pkg/RcppDE/ChangeLog	2010-10-19 18:02:34 UTC (rev 2345)
+++ pkg/RcppDE/ChangeLog	2010-10-20 03:28:27 UTC (rev 2346)
@@ -1,5 +1,9 @@
 2010-10-19  Dirk Eddelbuettel  <edd at debian.org>
 
+	* R/DEoptim.R:
+	  - reduce storepop list by one to match DEoptim behaviour
+	  - set row and column names
+
 	* src/de4_0.cpp:
 	  - Removed a few more unused variables
 	  - moved some variable declaration down to where they are use

Modified: pkg/RcppDE/R/DEoptim.R
===================================================================
--- pkg/RcppDE/R/DEoptim.R	2010-10-19 18:02:34 UTC (rev 2345)
+++ pkg/RcppDE/R/DEoptim.R	2010-10-20 03:28:27 UTC (rev 2346)
@@ -96,7 +96,7 @@
   outC <- .Call("DEoptimC", lower, upper, fn1, ctrl, new.env(), PACKAGE = "RcppDE")
   ##
   if (length(outC$storepop) > 0) {
-    ## nstorepop <- floor((outC$iter - ctrl$storepopfrom) / ctrl$storepopfreq)
+    nstorepop <- floor((outC$iter - ctrl$storepopfrom) / ctrl$storepopfreq)
     ## storepop <- list()
     ## cnt <- 1
     ## for(i in 1:nstorepop) {
@@ -106,7 +106,8 @@
     ##   cnt <- cnt + (ctrl$NP * ctrl$npar)
     ##   dimnames(storepop[[i]]) <- list(1:ctrl$NP, nam)
     ## }
-    storepop <- outC$storepop
+    storepop <- outC$storepop[1:nstorepop]
+    for (i in 1:length(storepop)) dimnames(storepop[[i]]) <- list(1:ctrl$NP, nam)
   }
   else {
     storepop = NULL



More information about the Rcpp-commits mailing list