[Deoptim-commits] r108 - pkg/DEoptim/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 5 03:19:55 CEST 2012


Author: bodanker
Date: 2012-07-05 03:19:54 +0200 (Thu, 05 Jul 2012)
New Revision: 108

Modified:
   pkg/DEoptim/R/DEoptim.R
Log:
- Fix two DEoptim.control() issues raised by Alain Guillet


Modified: pkg/DEoptim/R/DEoptim.R
===================================================================
--- pkg/DEoptim/R/DEoptim.R	2012-07-01 16:21:33 UTC (rev 107)
+++ pkg/DEoptim/R/DEoptim.R	2012-07-05 01:19:54 UTC (rev 108)
@@ -61,13 +61,13 @@
   # handle parallel options
     
   #check for a single parallelType
-  if(missing(parallelType) | length(parallelType)>1){
+  if(missing(parallelType) || length(parallelType)>1){
       parallelType<-parallelType[1]
   }  
   # handle 'auto' auto-detect
   if(parallelType=='auto'){
      pkgs<-.packages()
-     rv<-R.version()
+     rv<-R.Version()
      if('foreach' %in% pkgs){
          parallelType='foreach'
      } else if (('parallel' %in% pkgs) ||
@@ -79,17 +79,10 @@
      }
   }
   #support old deprecated parallelType arguments
-  switch(parallelType,
-          '0'= {
-              parallelType='none' 
-          },
-          '1'= {
-              parallelType='parallel' 
-          },
-          '2'= {
-              parallelType='foreach' 
-          }
-  )
+  if(is.numeric(parallelType)) {
+    parallelType <- switch(parallelType+1, 'none', 'parallel', 'foreach')
+  }
+
   #handle deptrecated parallel arguments, set sensible defaults, etc.
   switch(parallelType,
           foreach = {



More information about the Deoptim-commits mailing list