[Soiltexture-commits] r55 - pkg/soiltexture/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 1 11:12:46 CET 2011
Author: jmoeys
Date: 2011-11-01 11:12:46 +0100 (Tue, 01 Nov 2011)
New Revision: 55
Modified:
pkg/soiltexture/R/text.transf.R
Log:
Fixed a potential infinite loop problem.
Modified: pkg/soiltexture/R/text.transf.R
===================================================================
--- pkg/soiltexture/R/text.transf.R 2011-10-28 09:38:18 UTC (rev 54)
+++ pkg/soiltexture/R/text.transf.R 2011-11-01 10:12:46 UTC (rev 55)
@@ -368,8 +368,11 @@
{
for( j in 1:5 )
{
+ countR <- 0 # Added by Julien Moeys on 2011/11/01
repeat
- {
+ {
+ countR <- countR + 1 # Added by Julien Moeys on 2011/11/01
+
spa[1:pn-1] <- runif(n = pn-1,max = maxspa1,min = minspa1)
spa[pn] <- runif(n = 1,max = maxspa2,min = minspa2)
tt<- try( drc:::drm(y ~ xin, fct = list( logi, NULL,pname ), # JM:2010/08/11 changed drc::drm to drm alone
@@ -395,14 +398,19 @@
ttbest <- tt
}
break
- }
+ } #
+
+ if( countR >= 100 ){ break } # Added by Julien Moeys on 2011/11/01
}
}
}
else
{
+ countR <- 0 # Added by Julien Moeys on 2011/11/01
repeat
{
+ countR <- countR + 1 # Added by Julien Moeys on 2011/11/01
+
spa[1:pn-1] <- runif(n=pn-1,max = maxspa1,min = minspa1)
spa[pn] <- runif(n=1,max = maxspa2,min = minspa2)
tt <- try( drc:::drm(y ~ xin, fct = list(logi, NULL, pname), # JM:2010/08/11 changed drc::drm to drm alone
@@ -429,6 +437,8 @@
}
break
}
+
+ if( countR >= 100 ){ break } # Added by Julien Moeys on 2011/11/01
}
}
#when the residual sum of error (deviance) is very small, the iteration is stopped to save time
More information about the Soiltexture-commits
mailing list