R/RcppExports.R

Defines functions get_waterlevel_cpp param_from_prior_exp_cpp param_from_prior_cpp initial_draw_from_prior sim_envidiv_cpp sq_numbers_cpp_tbb create_ref_table_tbb_par create_ref_table_tbb_serial test_envidiv_tbb

Documented in create_ref_table_tbb_par create_ref_table_tbb_serial get_waterlevel_cpp initial_draw_from_prior param_from_prior_cpp param_from_prior_exp_cpp sim_envidiv_cpp sq_numbers_cpp_tbb test_envidiv_tbb

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

#' function to test table conversion
#' @param model a vector of the four parameters of the model
#' @param crown_age crown age of the tree to be simulated
#' @return list
#' @export
test_envidiv_tbb <- function(model, crown_age) {
    .Call('_enviDiv_test_envidiv_tbb', PACKAGE = 'enviDiv', model, crown_age)
}

#' simulate a tree using environmental diversification
#' @param model a vector of the four paramaters of the model
#' @param num_repl a vector that indicates the time points of water level changes
#' @param crown_age crown age of the tree to be simulated
#' @param min_lin minimum number of lineages
#' @param max_lin maximum number of lineages
#' @param num_threads number of threads
#' @return newick string
#' @export
create_ref_table_tbb_serial <- function(model, num_repl, crown_age, min_lin, max_lin, num_threads) {
    .Call('_enviDiv_create_ref_table_tbb_serial', PACKAGE = 'enviDiv', model, num_repl, crown_age, min_lin, max_lin, num_threads)
}

#' simulate a tree using environmental diversification
#' @param model a vector of the four paramaters of the model
#' @param num_repl a vector that indicates the time points of water level changes
#' @param crown_age crown age of the tree to be simulated
#' @param min_lin minimum number of lineages
#' @param max_lin maximum number of lineages
#' @param num_threads number of threads
#' @return newick string
#' @export
create_ref_table_tbb_par <- function(model, num_repl, crown_age, min_lin, max_lin, num_threads) {
    .Call('_enviDiv_create_ref_table_tbb_par', PACKAGE = 'enviDiv', model, num_repl, crown_age, min_lin, max_lin, num_threads)
}

#' test multithreaded works!
#' @param n size of vector
#' @param num_threads number of threads
#' @return vector of squared numbers
#' @export
sq_numbers_cpp_tbb <- function(n, num_threads) {
    .Call('_enviDiv_sq_numbers_cpp_tbb', PACKAGE = 'enviDiv', n, num_threads)
}

#' simulate a tree using environmental diversification
#' @param model chosen model
#' @param parameters a vector of parameters
#' @param crown_age crown age of the tree to be simulated
#' @param min_lin minimum number of lineages
#' @param max_lin maximum number of lineages
#' @return newick string
#' @export
sim_envidiv_cpp <- function(model, parameters, crown_age, max_lin) {
    .Call('_enviDiv_sim_envidiv_cpp', PACKAGE = 'enviDiv', model, parameters, crown_age, max_lin)
}

#' generate particles from the prior
#' @param num_particles number of particles
#' @param crown_age crown age
#' @param min_lin minimum number of lineages
#' @param max_lin maximum number of lineages
#' @param verbose verbose output
#' @return numeric matrix
#' @export
initial_draw_from_prior <- function(num_particles, crown_age, min_lin, max_lin, verbose) {
    .Call('_enviDiv_initial_draw_from_prior', PACKAGE = 'enviDiv', num_particles, crown_age, min_lin, max_lin, verbose)
}

#' draw parameter combinations from the prior
#' @return vector with 6 entries: extinction, sympatric speciation at high
#' water, sympatric speciation at low water, allopatric speciation, amount of
#' perturbation, the chosen water model
#' @export
param_from_prior_cpp <- function() {
    .Call('_enviDiv_param_from_prior_cpp', PACKAGE = 'enviDiv')
}

#' draw parameter combinations from the prior
#' @return vector with 6  entries: extinction, sympatric speciation at high
#' water, sympatric speciation at low water, allopatric speciation, amount of
#' perturbation, the chosen water model
#' @export
param_from_prior_exp_cpp <- function() {
    .Call('_enviDiv_param_from_prior_exp_cpp', PACKAGE = 'enviDiv')
}

#' draw water level change2
#' @param water_model water model
#' @param maximum_time crown age
#' @param water level change rate per MY, default is 10
#' @return water level changes
#' @export
get_waterlevel_cpp <- function(water_model, maximum_time, rate = 10) {
    .Call('_enviDiv_get_waterlevel_cpp', PACKAGE = 'enviDiv', water_model, maximum_time, rate)
}
thijsjanzen/enviDiv documentation built on Feb. 17, 2025, 8:20 p.m.