[Dplr-commits] r956 - in pkg/dplR: . inst/doc
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 4 12:45:54 CET 2015
Author: mvkorpel
Date: 2015-02-04 12:45:54 +0100 (Wed, 04 Feb 2015)
New Revision: 956
Modified:
pkg/dplR/DESCRIPTION
pkg/dplR/inst/doc/math-dplR.R
pkg/dplR/inst/doc/math-dplR.Rnw.txt
pkg/dplR/inst/doc/math-dplR.bib
pkg/dplR/inst/doc/math-dplR.pdf
Log:
Updated math-dplR.pdf to match new (optimized) ffcsaps()
Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION 2015-01-28 16:10:07 UTC (rev 955)
+++ pkg/dplR/DESCRIPTION 2015-02-04 11:45:54 UTC (rev 956)
@@ -3,7 +3,7 @@
Type: Package
Title: Dendrochronology Program Library in R
Version: 1.6.3
-Date: 2015-01-28
+Date: 2015-02-04
Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
"cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
"Korpela", role = c("aut", "trl")), person("Franco", "Biondi",
Modified: pkg/dplR/inst/doc/math-dplR.R
===================================================================
--- pkg/dplR/inst/doc/math-dplR.R 2015-01-28 16:10:07 UTC (rev 955)
+++ pkg/dplR/inst/doc/math-dplR.R 2015-02-04 11:45:54 UTC (rev 956)
@@ -1,4 +1,3 @@
-
## ----"try-matlab", echo=FALSE, results="hide"----------------------------
TRY_MATLAB <- TRUE
@@ -11,17 +10,14 @@
library(dichromat)
library(graphics)
library(stats)
+library(Matrix) # ffcsaps uses sparse matrices
-
-
-
## ----"knitr-init-fig", echo=FALSE, cache=FALSE---------------------------
PAGE_WIDTH <- 4.74
PAGE_HEIGHT <- 8.22
opts_template$set(myfigures=list(fig.path = "figure/", fig.pos = "tbp",
fig.align = "center", fig.lp = "fig:", dev = "tikz"))
-
## ----"response-comp-init"------------------------------------------------
## Helper function used in ffcsaps2
inc <- function(from, to) {
@@ -153,10 +149,10 @@
c(0, 0, odx[-1])),
arg2, n)
R2[, 1] <- R2[, 1] - 1
- forR <- matrix(0, zz2, zz2)
- forR2 <- matrix(0, zz2, n)
- forR[R[, 1] + (R[, 2] - 1) * zz2] <- R[, 3]
- forR2[R2[, 1] + (R2[, 2] - 1) * zz2] <- R2[, 3]
+ forR <- Matrix(0, zz2, zz2, sparse = TRUE)
+ forR2 <- Matrix(0, zz2, n, sparse = TRUE)
+ forR[R[, 1:2, drop=FALSE]] <- R[, 3]
+ forR2[R2[, 1:2, drop=FALSE]] <- R2[, 3]
if (!missing(p)) {
## NEW: give value of p directly as an argument
p.inv <- 1 / p
@@ -177,8 +173,8 @@
mplier <- 6 - 6 / p.inv # slightly more accurate than 6*(1-1/p.inv)
## forR*p is faster than forR/p.inv, and a quick test didn't
## show any difference in the final spline
- u <- solve(mplier * tcrossprod(forR2) + forR * p,
- diff(diff(yi) / diff.xi))
+ u <- as.numeric(solve(mplier * tcrossprod(forR2) + forR * p,
+ diff(diff(yi) / diff.xi)))
yi <- yi - mplier * diff(c(0, diff(c(0, u, 0)) / diff.xi, 0))
test0 <- xi[-c(1, n)]
c3 <- c(0, u / p.inv, 0)
@@ -204,7 +200,6 @@
res
}
-
## ----"response-init"-----------------------------------------------------
## Cook, E. R. and Kairiukstis, L. A. (1990) Methods of
## Dendrochronology: Applications in the Environmental Sciences.
@@ -225,7 +220,6 @@
1 - 1 / (1 + (p * (cos(pif2) + 2)) / (6 * (cos(pif2) - 1)^2))
}
-
## ----"response-comp", message=FALSE, dependson="response-comp-init", cache.vars=c("response1", "response2", "NYRS", "nFreq")----
N <- 1536
K <- 500
@@ -292,7 +286,6 @@
response2[, j] <- rowMeans(ratio2[, , j])
}
-
## ----"ffcsaps-caption", cache=FALSE--------------------------------------
FFCSAPS_CAPTION <-
paste("Theoretical frequency response of spline filter vs response",
@@ -337,7 +330,6 @@
lwd = c(1, 1, LWD))
par(op)
-
## ----"smoothed-R", dependson="response-comp-init", cache.vars=c("smoothed.R", "y")----
if (!exists(".Random.seed", globalenv(), mode="numeric")) {
foo <- sample(TRUE)
@@ -405,7 +397,7 @@
} else {
matlabValue <- NULL
smoothed.matlab <- NULL
- matlabVersion <- "8.3.0.532 (R2014a)" # tested ok on 2014-05-12
+ matlabVersion <- "8.4.0.150421 (R2014b)" # tested ok on 2015-02-04
}
## ----"R-matlab-compare", cache=FALSE, error=FALSE------------------------
@@ -425,7 +417,6 @@
stopifnot(all(allEqual))
}
-
## ----"smoothed-caption", cache=FALSE-------------------------------------
SMOOTHED_CAPTION <-
paste("Spline with different values of smoothing parameter",
@@ -455,13 +446,11 @@
bty = "n")
par(op)
-
## ----"matlab-version", cache=FALSE---------------------------------------
if (isTRUE(TRY_MATLAB) && matlabValue == 0) {
matlabVersionText <- paste0("(version ", latexify2(matlabVersion), ")")
}
-
## ----"matlab-note", cache=FALSE, message=FALSE---------------------------
matlabNoteText <- if (!isTRUE(TRY_MATLAB)) {
message(paste("Set TRY_MATLAB=TRUE and re-knit the document to repeat the comparison.",
@@ -487,7 +476,6 @@
"The result was reproduced when this document was compiled."
}
-
## ----gini-rmd, echo=TRUE, tidy=FALSE, cache=FALSE------------------------
## Gini index is one half of relative mean difference.
## x should not have NA values.
@@ -495,4 +483,3 @@
mean(abs(outer(x, x, "-"))) / mean(x) * 0.5
}
-
Modified: pkg/dplR/inst/doc/math-dplR.Rnw.txt
===================================================================
--- pkg/dplR/inst/doc/math-dplR.Rnw.txt 2015-01-28 16:10:07 UTC (rev 955)
+++ pkg/dplR/inst/doc/math-dplR.Rnw.txt 2015-02-04 11:45:54 UTC (rev 956)
@@ -62,6 +62,7 @@
library(dichromat)
library(graphics)
library(stats)
+library(Matrix) # ffcsaps uses sparse matrices
@
\usepackage[T1]{fontenc}
@@ -255,10 +256,10 @@
c(0, 0, odx[-1])),
arg2, n)
R2[, 1] <- R2[, 1] - 1
- forR <- matrix(0, zz2, zz2)
- forR2 <- matrix(0, zz2, n)
- forR[R[, 1] + (R[, 2] - 1) * zz2] <- R[, 3]
- forR2[R2[, 1] + (R2[, 2] - 1) * zz2] <- R2[, 3]
+ forR <- Matrix(0, zz2, zz2, sparse = TRUE)
+ forR2 <- Matrix(0, zz2, n, sparse = TRUE)
+ forR[R[, 1:2, drop=FALSE]] <- R[, 3]
+ forR2[R2[, 1:2, drop=FALSE]] <- R2[, 3]
if (!missing(p)) {
## NEW: give value of p directly as an argument
p.inv <- 1 / p
@@ -279,8 +280,8 @@
mplier <- 6 - 6 / p.inv # slightly more accurate than 6*(1-1/p.inv)
## forR*p is faster than forR/p.inv, and a quick test didn't
## show any difference in the final spline
- u <- solve(mplier * tcrossprod(forR2) + forR * p,
- diff(diff(yi) / diff.xi))
+ u <- as.numeric(solve(mplier * tcrossprod(forR2) + forR * p,
+ diff(diff(yi) / diff.xi)))
yi <- yi - mplier * diff(c(0, diff(c(0, u, 0)) / diff.xi, 0))
test0 <- xi[-c(1, n)]
c3 <- c(0, u / p.inv, 0)
@@ -339,8 +340,11 @@
The original implementations of the functions covered here were not
written by the author of this document. Therefore the functions were
-analyzed with a reverse engineering approach. At the time of writing,
-dplR was at version 1.6.0. Although any changes affecting the
+analyzed with a reverse engineering approach. At the time when this
+document was updated, the latest release of dplR was version 1.6.2,
+but the performance improvements of (future) version 1.6.3 had already
+been applied to \texttt{ffcsaps} in the development version and in the
+source code of the document. Although any changes affecting the
mathematical details of the functions are unlikely, the reader is
advised to check that the document file originated from a current
version of dplR.
@@ -603,7 +607,7 @@
} else {
matlabValue <- NULL
smoothed.matlab <- NULL
- matlabVersion <- "8.3.0.532 (R2014a)" # tested ok on 2014-05-12
+ matlabVersion <- "8.4.0.150421 (R2014b)" # tested ok on 2015-02-04
}
@
<<"R-matlab-compare", cache=FALSE, error=FALSE>>=
Modified: pkg/dplR/inst/doc/math-dplR.bib
===================================================================
--- pkg/dplR/inst/doc/math-dplR.bib 2015-01-28 16:10:07 UTC (rev 955)
+++ pkg/dplR/inst/doc/math-dplR.bib 2015-02-04 11:45:54 UTC (rev 956)
@@ -105,10 +105,10 @@
@Manual{dplRman,
title = {dplR: Dendrochronology Program Library in R},
author = {Andy Bunn and Mikko Korpela and Franco Biondi and Filipe
- Campelo and Pierre Mérian and Manfred Mudelsee and
- Fares Qeadan and Michael Schulz and Christian Zang},
- year = {2014},
- note = {R package version 1.6.0},
+ Campelo and Pierre Mérian and Fares Qeadan and
+ Christian Zang},
+ year = {2015},
+ note = {R package version 1.6.3},
url = {http://huxley.wwu.edu/trl/htrl-dplr,
http://R-Forge.R-project.org/projects/dplr/},
}
@@ -118,6 +118,6 @@
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
- year = {2014},
+ year = {2015},
url = {http://www.R-project.org/},
}
Modified: pkg/dplR/inst/doc/math-dplR.pdf
===================================================================
(Binary files differ)
More information about the Dplr-commits
mailing list