Skip to content

Commit

Permalink
fix for apple m1
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelS1 committed Feb 18, 2022
1 parent 4ffad3a commit b4be3ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: distr6
Title: The Complete R6 Probability Distributions Interface
Version: 1.6.6
Version: 1.6.7
Authors@R:
c(person(given = "Raphael",
family = "Sonabend",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# distr6 1.6.7

* Fix for Apple M1

# distr6 1.6.6

* WeightedDiscrete now correctly handles improper distributions by returning Inf and NA where appropriate
Expand Down
15 changes: 11 additions & 4 deletions R/getParameterSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,20 @@ getParameterSet.WeightedDiscrete <- function(object, ...) { # nolint
cdfs <- list_element(x, "cdf")

if (length(pdfs)) {
cdfs <- setNames(lapply(pdfs, cumsum),
gsub("pdf", "cdf", names(pdfs)))
cdfs <- setNames(
lapply(pdfs, cumsum),
gsub("pdf", "cdf", names(pdfs))
)
} else {
pdfs <- setNames(lapply(cdfs, function(.x) c(.x[1], diff(.x))),
gsub("cdf", "pdf", names(cdfs)))
pdfs <- setNames(
lapply(cdfs, function(.x) c(.x[1], diff(.x))),
gsub("cdf", "pdf", names(cdfs))
)
}

## FIX FOR M1
cdfs <- lapply(cdfs, round, digits = 15L)

unique_nlist(c(pdfs, cdfs, x))
}
)
Expand Down

0 comments on commit b4be3ec

Please sign in to comment.