Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectorise prob_discrete_erlang #171

Merged
merged 2 commits into from
Feb 9, 2024
Merged

vectorise prob_discrete_erlang #171

merged 2 commits into from
Feb 9, 2024

Conversation

TimTaylor
Copy link
Contributor

Not sure how much this improves performance but there were some opportunities to vectorise this (at expense of more memory usage). Have also preallocated one of the outputs - not sure if that will help or not.

@TimTaylor TimTaylor mentioned this pull request Feb 7, 2024
TimTaylor

This comment was marked as duplicate.

R/model_ebola.R Outdated
@@ -27,7 +27,7 @@ prob_discrete_erlang <- function(shape, rate) {
one_sub_cumulative_probs[n_bin] <- sum(total)
cumulative_prob <- 1 - one_sub_cumulative_probs[n_bin]
}
one_sub_cumulative_probs <- c(1, one_sub_cumulative_probs[1:n_bin])
one_sub_cumulative_probs <- c(1, one_sub_cumulative_probs[seq(n_bin)])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cough seq_len cough 😉

Use seq_len() for sequence
@pratikunterwegs pratikunterwegs merged commit 1c37760 into main Feb 9, 2024
9 checks passed
@pratikunterwegs pratikunterwegs deleted the erlang-tweaks branch February 9, 2024 07:59
@pratikunterwegs
Copy link
Collaborator

Leaving the comment re: sufficient length in as a reminder to revisit the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants