[Dplr-commits] r713 - in pkg/dplR: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 29 21:09:03 CET 2013


Author: mvkorpel
Date: 2013-10-29 21:09:02 +0100 (Tue, 29 Oct 2013)
New Revision: 713

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/R/redfit.R
Log:
redfit.R: Small optimizations in redfitWinwgt()

Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2013-10-29 15:33:25 UTC (rev 712)
+++ pkg/dplR/ChangeLog	2013-10-29 20:09:02 UTC (rev 713)
@@ -6,6 +6,7 @@
 - Use slightly faster .rowSums() instead of rowSums()
 - Simplified arithmetic expressions in getdof(): no multiplying by 2
 - Precomputed squared numbers in getdof()
+- Small optimizations in redfitWinwgt()
 
 * CHANGES IN dplR VERSION 1.5.7
 

Modified: pkg/dplR/R/redfit.R
===================================================================
--- pkg/dplR/R/redfit.R	2013-10-29 15:33:25 UTC (rev 712)
+++ pkg/dplR/R/redfit.R	2013-10-29 20:09:02 UTC (rev 713)
@@ -1374,8 +1374,8 @@
 redfitWinwgt <- function(t, iwin) {
     nseg <- length(t)
     ## useful factor for various windows
-    fac1 <- (nseg / 2) - 0.5
-    fac2 <- 1 / ((nseg / 2) + 0.5)
+    fac1 <- nseg / 2 - 0.5
+    fac2 <- 1 / (fac1 + 1)
     tlen <- t[nseg] - t[1]
     if (iwin == 0) {        # rectangle
         ww <- rep.int(1, nseg)



More information about the Dplr-commits mailing list