[Dplr-commits] r711 - in pkg/dplR: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 29 15:36:18 CET 2013
Author: mvkorpel
Date: 2013-10-29 15:36:18 +0100 (Tue, 29 Oct 2013)
New Revision: 711
Modified:
pkg/dplR/ChangeLog
pkg/dplR/R/redfit.R
Log:
redfit.R: Precomputed squared numbers in getdof()
Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog 2013-10-29 14:19:46 UTC (rev 710)
+++ pkg/dplR/ChangeLog 2013-10-29 14:36:18 UTC (rev 711)
@@ -5,6 +5,7 @@
- Use slightly faster .rowSums() instead of rowSums()
- Simplified arithmetic expressions in getdof(): no multiplying by 2
+- Precomputed squared numbers in getdof()
* CHANGES IN dplR VERSION 1.5.7
Modified: pkg/dplR/R/redfit.R
===================================================================
--- pkg/dplR/R/redfit.R 2013-10-29 14:19:46 UTC (rev 710)
+++ pkg/dplR/R/redfit.R 2013-10-29 14:36:18 UTC (rev 711)
@@ -550,8 +550,11 @@
## dplR: Computed more precise values for c50.
getdof <- function(iwin, n50) {
## dplR: Rectangular, Welch, Hanning, Triangular, Blackman-Harris
- c50 <- c(0.5, 0.34375, 1 / 6, 0.25, 0.0955489871755)
- c2 <- c50[iwin + 1]^2
+ ## c50 <- c(0.5, 0.34375, 1 / 6, 0.25, 0.0955489871755)
+ ## c2 <- c50[iwin + 1]^2
+ ## dplR: Precomputed squared c50. Note: (1/6)^2 == 1/36
+ c2 <- c(0.25, 0.1181640625, 0.0277777777777778,
+ 0.0625, 0.00912960895026386)[iwin + 1]
n50 / (0.5 + c2 - c2 / n50)
}
## dplR: Automatically adds prefix (for example "# " from REDFIT) and
More information about the Dplr-commits
mailing list