Skip to content

Commit

Permalink
Turn off AD warnings for is.na.
Browse files Browse the repository at this point in the history
  • Loading branch information
paciorek committed Oct 13, 2024
1 parent 5b6c41d commit 3cbec00
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/dBetaBinom.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ nimBetaFun <- nimbleFunction(
returnType(double(0))
}, buildDerivs=list(run=list()))

nimbleOptions(doADerrorTraps = FALSE)

#' @rdname dBetaBinom
#' @export
dBetaBinom_v <- nimbleFunction(
Expand Down Expand Up @@ -124,6 +126,8 @@ dBetaBinom_s <- nimbleFunction(
buildDerivs = list(run=list(ignore = c('i','xi')))
)

nimbleOptions(doADerrorTraps = TRUE)

#' @rdname dBetaBinom
#' @export
#' @importFrom stats rbeta
Expand Down
6 changes: 6 additions & 0 deletions R/dCJS.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@

NULL

## Turn off warnings about use of `is.na` in deriv-enabled nimbleFunction.

nimbleOptions(doADerrorTraps = FALSE)

#' @rdname dCJS
#' @export
dCJS_ss <- nimbleFunction(
Expand Down Expand Up @@ -342,6 +346,8 @@ dCJS_vv <- nimbleFunction(
}, buildDerivs = list(run = list(ignore = c('i', "xt", "t")))
)

nimbleOptions(doADerrorTraps = TRUE)

#' @rdname dCJS
#' @export
rCJS_ss <- nimbleFunction(
Expand Down
6 changes: 6 additions & 0 deletions R/dNmixtureAD.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@

##### Regular N-mixture #####
NULL

nimbleOptions(doADerrorTraps = FALSE)

#' @rdname dNmixtureAD
#' @export
dNmixtureAD_v <- nimbleFunction(
Expand Down Expand Up @@ -553,6 +556,9 @@ dNmixtureAD_BBNB_oneObs <- nimbleFunction(
}, buildDerivs=list(run=list())
)

nimbleOptions(doADerrorTraps = TRUE)


##### rNmixtureAD extensions #####
NULL
#' @rdname dNmixtureAD
Expand Down
4 changes: 4 additions & 0 deletions R/dOcc.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
#' Occ_model$calculate()
#' # Use the model for a variety of other purposes...

nimbleOptions(doADerrorTraps = FALSE)

#' @export
#' @rdname dOcc
dOcc_s <- nimbleFunction(
Expand Down Expand Up @@ -178,6 +180,8 @@ dOcc_v <- nimbleFunction(
}, buildDerivs = list(run = list(ignore = c("i", "xi")))
)

nimbleOptions(doADerrorTraps = TRUE)

#' @export
#' @rdname dOcc

Expand Down
4 changes: 4 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ nimNmixPois_logFac <- nimbleFunction(
returnType(double())
}, buildDerivs = list(run = list()))

nimbleOptions(doADerrorTraps = FALSE)

#' @rdname dNmixture_steps
#' @importFrom stats dpois
#' @export
Expand Down Expand Up @@ -322,3 +324,5 @@ dNmixture_BBNB_steps <- nimbleFunction(
},
buildDerivs = list(run = list(ignore = c("i","j","xj")))
)

nimbleOptions(doADerrorTraps = TRUE)

0 comments on commit 3cbec00

Please sign in to comment.