Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
aadler committed Apr 4, 2024
1 parent b512943 commit c275b63
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions R/Delaporte.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ qdelap <- function(p, alpha, beta, lambda, lower.tail = TRUE, log.p = FALSE,
}
}
}

if (any(is.nan(QDLAP))) warning("NaNs produced")
return(QDLAP)
}
Expand All @@ -87,15 +86,15 @@ rdelap <- function(n, alpha, beta, lambda, exact = TRUE) {
alpha <- as.double(alpha)
beta <- as.double(beta)
lambda <- as.double(lambda)
if (!exact) {
if (exact) {
RDLAP <- .Call(rdelap_C, n, alpha, beta, lambda, getDelapThreads())
} else {
if (any(alpha <= 0) || any(beta <= 0) || any(lambda <= 0)) {
RDLAP <- (rep.int(NaN, n))
} else {
shiftedGammas <- rgamma(n, shape = alpha, scale = beta)
RDLAP <- rpois(n, lambda = (shiftedGammas + lambda))
}
} else {
RDLAP <- .Call(rdelap_C, n, alpha, beta, lambda, getDelapThreads())
}
if (any(is.nan(RDLAP))) warning("NaNs produced")
return(RDLAP)
Expand Down

0 comments on commit c275b63

Please sign in to comment.