R/RcppExports.R

Defines functions demog_test draw_equilibrium_age draw_equilibrium_death_age open_sir_rcpp sample_int sample_double weighted_sample_int weighted_sample_double weighted_sample_min_int weighted_sample_min_double years_to_steps days_to_steps

Documented in days_to_steps demog_test draw_equilibrium_age draw_equilibrium_death_age open_sir_rcpp sample_double sample_int weighted_sample_double weighted_sample_int weighted_sample_min_double weighted_sample_min_int years_to_steps

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Test demography
#'
#' @param N Population size
#' @param days Simulation time (days)
#' @param substep Substeps per day
#' @param age_of_death Probability of age of death
#' @param equilibrium_age Equilibrium age distribution
#' @export
demog_test <- function(N, days, substep, age_of_death, equilibrium_age) {
    .Call('_siR_demog_test', PACKAGE = 'siR', N, days, substep, age_of_death, equilibrium_age)
}

#' Draw an age (in days) from the equilibrium age distribution
#'
#' @param age_years Vector of integersof possible age years
#' @param equilibrium_age Equilribrium age distribution
#' @return An integer age (days)
#' @export
draw_equilibrium_age <- function(age_years, equilibrium_age) {
    .Call('_siR_draw_equilibrium_age', PACKAGE = 'siR', age_years, equilibrium_age)
}

#' Draw a death age conditional on an age from the equilibrium age distribution
#'
#' @param age Age (days) drawn from equilibrium age distribution
#' @param age_years Vector of integers of possible age years
#' @param age_of_death Equilribrium age of death distribution
#' @param max_age Maximum age (years)
#' @return An integer death age (days)
draw_equilibrium_death_age <- function(age, age_years, age_of_death, max_age) {
    .Call('_siR_draw_equilibrium_death_age', PACKAGE = 'siR', age, age_years, age_of_death, max_age)
}

#' Test demography
#'
#' @param N Population size
#' @param days Simulation time (days)
#' @param substep Substeps per day
#' @param age_of_death Probability of age of death
#' @param equilibrium_age Equilibrium age distribution
#' @param beta Beta parameter (per day)
#' @param i0 Initial number of infecteds
#' @param sigma Recovery rate (per day)
#' @export
open_sir_rcpp <- function(N, days, substep, age_of_death, equilibrium_age, beta, sigma, i0) {
    .Call('_siR_open_sir_rcpp', PACKAGE = 'siR', N, days, substep, age_of_death, equilibrium_age, beta, sigma, i0)
}

#' Sample single integer from range.
#'
#' @param from Starting integer (inclusive)
#' @param to End integer (inclusive)
#' @export
sample_int <- function(from, to) {
    .Call('_siR_sample_int', PACKAGE = 'siR', from, to)
}

#' Sample single double from range.
#'
#' @param from Starting double (inclusive)
#' @param to End double (inclusive)
#' @export
sample_double <- function(from, to) {
    .Call('_siR_sample_double', PACKAGE = 'siR', from, to)
}

#' Sample single integer from vector with probability weights.
#'
#' @param x Vector of integers to sample from
#' @param weights Vector of weights
#' @return Probability weighted sample
#' @export
weighted_sample_int <- function(x, weights) {
    .Call('_siR_weighted_sample_int', PACKAGE = 'siR', x, weights)
}

#' Sample single double from vector with probability weights.
#'
#' @param x Vector of integers to sample from
#' @param weights Vector of weights
#' @return Probability weighted sample
#' @export
weighted_sample_double <- function(x, weights) {
    .Call('_siR_weighted_sample_double', PACKAGE = 'siR', x, weights)
}

#' Sample single integer from vector with probability weights conditional on
#' minimum lower bound.
#'
#' @param x Vector of integers to sample from (must be ordered)
#' @param weights Vector of weights
#' @param lower Lower value of x that must be exceeded
#' @return Probability weighted sample
#' @export
weighted_sample_min_int <- function(x, weights, lower) {
    .Call('_siR_weighted_sample_min_int', PACKAGE = 'siR', x, weights, lower)
}

#' Sample single double from vector with probability weights conditional on
#' minimum lower bound.
#'
#' @param x Vector of integers to sample from (must be ordered)
#' @param weights Vector of weights
#' @param lower Lower value of x that must be exceeded
#' @return Probability weighted sample
#' @export
weighted_sample_min_double <- function(x, weights, lower) {
    .Call('_siR_weighted_sample_min_double', PACKAGE = 'siR', x, weights, lower)
}

#' Convert years to steps
#'
#' @param years Number of years
#' @param substep Substeps per day
#' @export
years_to_steps <- function(years, substep) {
    .Call('_siR_years_to_steps', PACKAGE = 'siR', years, substep)
}

#' Convert days to steps
#'
#' @param days Number of days
#' @param substep Substeps per day
#' @export
days_to_steps <- function(days, substep) {
    .Call('_siR_days_to_steps', PACKAGE = 'siR', days, substep)
}
mrc-ide/siR documentation built on May 6, 2019, 4:33 p.m.