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

Fix naming conventions to match C++ library #58

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: epiworldR
Type: Package
Title: Fast Agent-Based Epi Models
Version: 0.5-0
Version: 0.6-0
apulsipher marked this conversation as resolved.
Show resolved Hide resolved
Authors@R: c(
person(given="George", family="Vega Yon", role=c("aut","cre"),
email="[email protected]", comment = c(ORCID = "0000-0002-3171-0844")),
Expand Down
12 changes: 6 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ export(get_hist_tool)
export(get_hist_total)
export(get_hist_transition_matrix)
export(get_hist_virus)
export(get_n_parameters)
export(get_mean_params)
export(get_mean_stats)
export(get_n_params)
export(get_n_replicates)
export(get_n_samples)
export(get_n_statistics)
export(get_n_stats)
export(get_n_tools)
export(get_n_viruses)
export(get_name)
Expand All @@ -147,12 +149,10 @@ export(get_name_virus)
export(get_ndays)
export(get_network)
export(get_param)
export(get_params_mean)
export(get_reproductive_number)
export(get_sample_stats)
export(get_state)
export(get_states)
export(get_statistics_hist)
export(get_stats_mean)
export(get_today_total)
export(get_tool)
export(get_transition_probability)
Expand Down Expand Up @@ -199,8 +199,8 @@ export(set_name)
export(set_name_tool)
export(set_name_virus)
export(set_observed_data)
export(set_par_names)
export(set_param)
export(set_params_names)
export(set_prob_death)
export(set_prob_death_fun)
export(set_prob_death_ptr)
Expand Down
40 changes: 20 additions & 20 deletions R/LFMCMC.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
#'
#' # Print the results
#' set_stats_names(lfmcmc_model, get_states(model_sir))
#' set_par_names(lfmcmc_model, c("Immune recovery", "Infectiousness"))
#' set_params_names(lfmcmc_model, c("Immune recovery", "Infectiousness"))
#'
#' print(lfmcmc_model)
#'
#' get_stats_mean(lfmcmc_model)
#' get_params_mean(lfmcmc_model)
#' get_mean_stats(lfmcmc_model)
#' get_mean_params(lfmcmc_model)
#'
#' @export
LFMCMC <- function(model = NULL) {
Expand Down Expand Up @@ -228,10 +228,10 @@
#' @param names The model parameter names
#' @returns The lfmcmc model with the parameter names added
#' @export
set_par_names <- function(lfmcmc, names) {
set_params_names <- function(lfmcmc, names) {

stopifnot_lfmcmc(lfmcmc)
set_par_names_cpp(lfmcmc, names)
set_params_names_cpp(lfmcmc, names)
invisible(lfmcmc)

}
Expand All @@ -253,21 +253,21 @@
#' @param lfmcmc LFMCMC model
#' @returns The param means for the given lfmcmc model
#' @export
get_params_mean <- function(lfmcmc) {
get_mean_params <- function(lfmcmc) {

stopifnot_lfmcmc(lfmcmc)
get_params_mean_cpp(lfmcmc)
get_mean_params_cpp(lfmcmc)

}

#' @rdname LFMCMC
#' @param lfmcmc LFMCMC model
#' @returns The stats means for the given lfmcmc model
#' @export
get_stats_mean <- function(lfmcmc) {
get_mean_stats <- function(lfmcmc) {

stopifnot_lfmcmc(lfmcmc)
get_stats_mean_cpp(lfmcmc)
get_mean_stats_cpp(lfmcmc)

}

Expand Down Expand Up @@ -301,7 +301,7 @@

stopifnot_lfmcmc(lfmcmc)
a_params <- get_accepted_params_cpp(lfmcmc)
n_params <- get_n_parameters(lfmcmc)
n_params <- get_n_params(lfmcmc)

matrix(
a_params,
Expand All @@ -322,7 +322,7 @@

stopifnot_lfmcmc(lfmcmc)
a_stats <- get_accepted_stats_cpp(lfmcmc)
n_stats <- get_n_statistics(lfmcmc)
n_stats <- get_n_stats(lfmcmc)

Check warning on line 325 in R/LFMCMC.R

View check run for this annotation

Codecov / codecov/patch

R/LFMCMC.R#L325

Added line #L325 was not covered by tests

matrix(
a_stats,
Expand All @@ -335,14 +335,14 @@
#' @export
#' @rdname LFMCMC
#' @returns
#' - The function `get_statistics_hist` returns a matrix of statistics
#' - The function `get_sample_stats` returns a matrix of statistics
#' for the given LFMCMC model. with the number of rows equal to the number of
#' samples and the number of columns equal to the number of statistics.
get_statistics_hist <- function(lfmcmc) {
get_sample_stats <- function(lfmcmc) {

stopifnot_lfmcmc(lfmcmc)
stats <- get_statistics_hist_cpp(lfmcmc)
n_stats <- get_n_statistics(lfmcmc)
stats <- get_sample_stats_cpp(lfmcmc)
n_stats <- get_n_stats(lfmcmc)

matrix(
stats,
Expand All @@ -355,22 +355,22 @@
#' @export
#' @rdname LFMCMC
#' @returns
#' - The functions `get_n_parameters`, `get_n_statistics`, and `get_n_samples`
#' - The functions `get_n_params`, `get_n_stats`, and `get_n_samples`
#' return the number of parameters, statistics, and samples for the given
#' LFMCMC model, respectively.
get_n_parameters <- function(lfmcmc) {
get_n_params <- function(lfmcmc) {

stopifnot_lfmcmc(lfmcmc)
get_n_parameters_cpp(lfmcmc)
get_n_params_cpp(lfmcmc)

}

#' @export
#' @rdname LFMCMC
get_n_statistics <- function(lfmcmc) {
get_n_stats <- function(lfmcmc) {

stopifnot_lfmcmc(lfmcmc)
get_n_statistics_cpp(lfmcmc)
get_n_stats_cpp(lfmcmc)

}

Expand Down
24 changes: 12 additions & 12 deletions R/cpp11.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,28 @@ use_kernel_fun_gaussian_cpp <- function(lfmcmc) {
.Call(`_epiworldR_use_kernel_fun_gaussian_cpp`, lfmcmc)
}

set_par_names_cpp <- function(lfmcmc, names) {
.Call(`_epiworldR_set_par_names_cpp`, lfmcmc, names)
set_params_names_cpp <- function(lfmcmc, names) {
.Call(`_epiworldR_set_params_names_cpp`, lfmcmc, names)
}

set_stats_names_cpp <- function(lfmcmc, names) {
.Call(`_epiworldR_set_stats_names_cpp`, lfmcmc, names)
}

get_params_mean_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_params_mean_cpp`, lfmcmc)
get_mean_params_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_mean_params_cpp`, lfmcmc)
}

get_stats_mean_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_stats_mean_cpp`, lfmcmc)
get_mean_stats_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_mean_stats_cpp`, lfmcmc)
}

print_lfmcmc_cpp <- function(lfmcmc, burnin) {
.Call(`_epiworldR_print_lfmcmc_cpp`, lfmcmc, burnin)
}

get_statistics_hist_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_statistics_hist_cpp`, lfmcmc)
get_sample_stats_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_sample_stats_cpp`, lfmcmc)
}

get_accepted_params_cpp <- function(lfmcmc) {
Expand All @@ -292,12 +292,12 @@ get_n_samples_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_n_samples_cpp`, lfmcmc)
}

get_n_statistics_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_n_statistics_cpp`, lfmcmc)
get_n_stats_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_n_stats_cpp`, lfmcmc)
}

get_n_parameters_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_n_parameters_cpp`, lfmcmc)
get_n_params_cpp <- function(lfmcmc) {
.Call(`_epiworldR_get_n_params_cpp`, lfmcmc)
}

print_cpp <- function(m, lite) {
Expand Down
2 changes: 1 addition & 1 deletion inst/include/epiworld/epiworld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/* Versioning */
#define EPIWORLD_VERSION_MAJOR 0
#define EPIWORLD_VERSION_MINOR 5
#define EPIWORLD_VERSION_MINOR 6
#define EPIWORLD_VERSION_PATCH 0

static const int epiworld_version_major = EPIWORLD_VERSION_MAJOR;
Expand Down
Loading
Loading