# Generated by cpp11: do not edit by hand

create_forest_dataset_cpp <- function() {
  .Call(`_stochtree_create_forest_dataset_cpp`)
}

dataset_num_rows_cpp <- function(dataset) {
  .Call(`_stochtree_dataset_num_rows_cpp`, dataset)
}

dataset_num_covariates_cpp <- function(dataset) {
  .Call(`_stochtree_dataset_num_covariates_cpp`, dataset)
}

dataset_num_basis_cpp <- function(dataset) {
  .Call(`_stochtree_dataset_num_basis_cpp`, dataset)
}

dataset_has_basis_cpp <- function(dataset) {
  .Call(`_stochtree_dataset_has_basis_cpp`, dataset)
}

dataset_has_variance_weights_cpp <- function(dataset) {
  .Call(`_stochtree_dataset_has_variance_weights_cpp`, dataset)
}

forest_dataset_add_covariates_cpp <- function(dataset_ptr, covariates) {
  invisible(.Call(`_stochtree_forest_dataset_add_covariates_cpp`, dataset_ptr, covariates))
}

forest_dataset_add_basis_cpp <- function(dataset_ptr, basis) {
  invisible(.Call(`_stochtree_forest_dataset_add_basis_cpp`, dataset_ptr, basis))
}

forest_dataset_update_basis_cpp <- function(dataset_ptr, basis) {
  invisible(.Call(`_stochtree_forest_dataset_update_basis_cpp`, dataset_ptr, basis))
}

forest_dataset_update_var_weights_cpp <- function(dataset_ptr, weights, exponentiate) {
  invisible(.Call(`_stochtree_forest_dataset_update_var_weights_cpp`, dataset_ptr, weights, exponentiate))
}

forest_dataset_add_weights_cpp <- function(dataset_ptr, weights) {
  invisible(.Call(`_stochtree_forest_dataset_add_weights_cpp`, dataset_ptr, weights))
}

forest_dataset_get_covariates_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_forest_dataset_get_covariates_cpp`, dataset_ptr)
}

forest_dataset_get_basis_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_forest_dataset_get_basis_cpp`, dataset_ptr)
}

forest_dataset_get_variance_weights_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_forest_dataset_get_variance_weights_cpp`, dataset_ptr)
}

forest_dataset_has_auxiliary_dimension_cpp <- function(dataset_ptr, dim_idx) {
  .Call(`_stochtree_forest_dataset_has_auxiliary_dimension_cpp`, dataset_ptr, dim_idx)
}

forest_dataset_add_auxiliary_dimension_cpp <- function(dataset_ptr, dim_size) {
  invisible(.Call(`_stochtree_forest_dataset_add_auxiliary_dimension_cpp`, dataset_ptr, dim_size))
}

forest_dataset_get_auxiliary_data_value_cpp <- function(dataset_ptr, dim_idx, element_idx) {
  .Call(`_stochtree_forest_dataset_get_auxiliary_data_value_cpp`, dataset_ptr, dim_idx, element_idx)
}

forest_dataset_set_auxiliary_data_value_cpp <- function(dataset_ptr, dim_idx, element_idx, value) {
  invisible(.Call(`_stochtree_forest_dataset_set_auxiliary_data_value_cpp`, dataset_ptr, dim_idx, element_idx, value))
}

forest_dataset_get_auxiliary_data_vector_cpp <- function(dataset_ptr, dim_idx) {
  .Call(`_stochtree_forest_dataset_get_auxiliary_data_vector_cpp`, dataset_ptr, dim_idx)
}

create_column_vector_cpp <- function(outcome) {
  .Call(`_stochtree_create_column_vector_cpp`, outcome)
}

add_to_column_vector_cpp <- function(outcome, update_vector) {
  invisible(.Call(`_stochtree_add_to_column_vector_cpp`, outcome, update_vector))
}

subtract_from_column_vector_cpp <- function(outcome, update_vector) {
  invisible(.Call(`_stochtree_subtract_from_column_vector_cpp`, outcome, update_vector))
}

overwrite_column_vector_cpp <- function(outcome, new_vector) {
  invisible(.Call(`_stochtree_overwrite_column_vector_cpp`, outcome, new_vector))
}

propagate_trees_column_vector_cpp <- function(tracker, residual) {
  invisible(.Call(`_stochtree_propagate_trees_column_vector_cpp`, tracker, residual))
}

get_residual_cpp <- function(vector_ptr) {
  .Call(`_stochtree_get_residual_cpp`, vector_ptr)
}

create_rfx_dataset_cpp <- function() {
  .Call(`_stochtree_create_rfx_dataset_cpp`)
}

rfx_dataset_update_basis_cpp <- function(dataset_ptr, basis) {
  invisible(.Call(`_stochtree_rfx_dataset_update_basis_cpp`, dataset_ptr, basis))
}

rfx_dataset_update_var_weights_cpp <- function(dataset_ptr, weights, exponentiate) {
  invisible(.Call(`_stochtree_rfx_dataset_update_var_weights_cpp`, dataset_ptr, weights, exponentiate))
}

rfx_dataset_update_group_labels_cpp <- function(dataset_ptr, group_labels) {
  invisible(.Call(`_stochtree_rfx_dataset_update_group_labels_cpp`, dataset_ptr, group_labels))
}

rfx_dataset_num_basis_cpp <- function(dataset) {
  .Call(`_stochtree_rfx_dataset_num_basis_cpp`, dataset)
}

rfx_dataset_num_rows_cpp <- function(dataset) {
  .Call(`_stochtree_rfx_dataset_num_rows_cpp`, dataset)
}

rfx_dataset_has_group_labels_cpp <- function(dataset) {
  .Call(`_stochtree_rfx_dataset_has_group_labels_cpp`, dataset)
}

rfx_dataset_has_basis_cpp <- function(dataset) {
  .Call(`_stochtree_rfx_dataset_has_basis_cpp`, dataset)
}

rfx_dataset_has_variance_weights_cpp <- function(dataset) {
  .Call(`_stochtree_rfx_dataset_has_variance_weights_cpp`, dataset)
}

rfx_dataset_add_group_labels_cpp <- function(dataset_ptr, group_labels) {
  invisible(.Call(`_stochtree_rfx_dataset_add_group_labels_cpp`, dataset_ptr, group_labels))
}

rfx_dataset_add_basis_cpp <- function(dataset_ptr, basis) {
  invisible(.Call(`_stochtree_rfx_dataset_add_basis_cpp`, dataset_ptr, basis))
}

rfx_dataset_add_weights_cpp <- function(dataset_ptr, weights) {
  invisible(.Call(`_stochtree_rfx_dataset_add_weights_cpp`, dataset_ptr, weights))
}

rfx_dataset_get_group_labels_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_rfx_dataset_get_group_labels_cpp`, dataset_ptr)
}

rfx_dataset_get_basis_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_rfx_dataset_get_basis_cpp`, dataset_ptr)
}

rfx_dataset_get_variance_weights_cpp <- function(dataset_ptr) {
  .Call(`_stochtree_rfx_dataset_get_variance_weights_cpp`, dataset_ptr)
}

rfx_container_cpp <- function(num_components, num_groups) {
  .Call(`_stochtree_rfx_container_cpp`, num_components, num_groups)
}

rfx_container_from_json_cpp <- function(json_ptr, rfx_label) {
  .Call(`_stochtree_rfx_container_from_json_cpp`, json_ptr, rfx_label)
}

rfx_label_mapper_from_json_cpp <- function(json_ptr, rfx_label) {
  .Call(`_stochtree_rfx_label_mapper_from_json_cpp`, json_ptr, rfx_label)
}

rfx_group_ids_from_json_cpp <- function(json_ptr, rfx_label) {
  .Call(`_stochtree_rfx_group_ids_from_json_cpp`, json_ptr, rfx_label)
}

rfx_container_append_from_json_cpp <- function(rfx_container_ptr, json_ptr, rfx_label) {
  invisible(.Call(`_stochtree_rfx_container_append_from_json_cpp`, rfx_container_ptr, json_ptr, rfx_label))
}

rfx_container_from_json_string_cpp <- function(json_string, rfx_label) {
  .Call(`_stochtree_rfx_container_from_json_string_cpp`, json_string, rfx_label)
}

rfx_label_mapper_from_json_string_cpp <- function(json_string, rfx_label) {
  .Call(`_stochtree_rfx_label_mapper_from_json_string_cpp`, json_string, rfx_label)
}

rfx_group_ids_from_json_string_cpp <- function(json_string, rfx_label) {
  .Call(`_stochtree_rfx_group_ids_from_json_string_cpp`, json_string, rfx_label)
}

rfx_container_append_from_json_string_cpp <- function(rfx_container_ptr, json_string, rfx_label) {
  invisible(.Call(`_stochtree_rfx_container_append_from_json_string_cpp`, rfx_container_ptr, json_string, rfx_label))
}

rfx_model_cpp <- function(num_components, num_groups) {
  .Call(`_stochtree_rfx_model_cpp`, num_components, num_groups)
}

rfx_tracker_cpp <- function(group_labels) {
  .Call(`_stochtree_rfx_tracker_cpp`, group_labels)
}

rfx_label_mapper_cpp <- function(rfx_tracker) {
  .Call(`_stochtree_rfx_label_mapper_cpp`, rfx_tracker)
}

rfx_model_sample_random_effects_cpp <- function(rfx_model, rfx_dataset, residual, rfx_tracker, rfx_container, keep_sample, global_variance, rng) {
  invisible(.Call(`_stochtree_rfx_model_sample_random_effects_cpp`, rfx_model, rfx_dataset, residual, rfx_tracker, rfx_container, keep_sample, global_variance, rng))
}

rfx_model_predict_cpp <- function(rfx_model, rfx_dataset, rfx_tracker) {
  .Call(`_stochtree_rfx_model_predict_cpp`, rfx_model, rfx_dataset, rfx_tracker)
}

rfx_container_predict_cpp <- function(rfx_container, rfx_dataset, label_mapper) {
  .Call(`_stochtree_rfx_container_predict_cpp`, rfx_container, rfx_dataset, label_mapper)
}

rfx_container_num_samples_cpp <- function(rfx_container) {
  .Call(`_stochtree_rfx_container_num_samples_cpp`, rfx_container)
}

rfx_container_num_components_cpp <- function(rfx_container) {
  .Call(`_stochtree_rfx_container_num_components_cpp`, rfx_container)
}

rfx_container_num_groups_cpp <- function(rfx_container) {
  .Call(`_stochtree_rfx_container_num_groups_cpp`, rfx_container)
}

rfx_container_delete_sample_cpp <- function(rfx_container, sample_num) {
  invisible(.Call(`_stochtree_rfx_container_delete_sample_cpp`, rfx_container, sample_num))
}

rfx_model_set_working_parameter_cpp <- function(rfx_model, working_param_init) {
  invisible(.Call(`_stochtree_rfx_model_set_working_parameter_cpp`, rfx_model, working_param_init))
}

rfx_model_set_group_parameters_cpp <- function(rfx_model, group_params_init) {
  invisible(.Call(`_stochtree_rfx_model_set_group_parameters_cpp`, rfx_model, group_params_init))
}

rfx_model_set_working_parameter_covariance_cpp <- function(rfx_model, working_param_cov_init) {
  invisible(.Call(`_stochtree_rfx_model_set_working_parameter_covariance_cpp`, rfx_model, working_param_cov_init))
}

rfx_model_set_group_parameter_covariance_cpp <- function(rfx_model, group_param_cov_init) {
  invisible(.Call(`_stochtree_rfx_model_set_group_parameter_covariance_cpp`, rfx_model, group_param_cov_init))
}

rfx_model_set_variance_prior_shape_cpp <- function(rfx_model, shape) {
  invisible(.Call(`_stochtree_rfx_model_set_variance_prior_shape_cpp`, rfx_model, shape))
}

rfx_model_set_variance_prior_scale_cpp <- function(rfx_model, scale) {
  invisible(.Call(`_stochtree_rfx_model_set_variance_prior_scale_cpp`, rfx_model, scale))
}

rfx_tracker_get_unique_group_ids_cpp <- function(rfx_tracker) {
  .Call(`_stochtree_rfx_tracker_get_unique_group_ids_cpp`, rfx_tracker)
}

rfx_container_get_beta_cpp <- function(rfx_container_ptr) {
  .Call(`_stochtree_rfx_container_get_beta_cpp`, rfx_container_ptr)
}

rfx_container_get_alpha_cpp <- function(rfx_container_ptr) {
  .Call(`_stochtree_rfx_container_get_alpha_cpp`, rfx_container_ptr)
}

rfx_container_get_xi_cpp <- function(rfx_container_ptr) {
  .Call(`_stochtree_rfx_container_get_xi_cpp`, rfx_container_ptr)
}

rfx_container_get_sigma_cpp <- function(rfx_container_ptr) {
  .Call(`_stochtree_rfx_container_get_sigma_cpp`, rfx_container_ptr)
}

rfx_label_mapper_to_list_cpp <- function(label_mapper_ptr) {
  .Call(`_stochtree_rfx_label_mapper_to_list_cpp`, label_mapper_ptr)
}

reset_rfx_model_cpp <- function(rfx_model, rfx_container, sample_num) {
  invisible(.Call(`_stochtree_reset_rfx_model_cpp`, rfx_model, rfx_container, sample_num))
}

reset_rfx_tracker_cpp <- function(tracker, dataset, residual, rfx_model) {
  invisible(.Call(`_stochtree_reset_rfx_tracker_cpp`, tracker, dataset, residual, rfx_model))
}

root_reset_rfx_tracker_cpp <- function(tracker, dataset, residual, rfx_model) {
  invisible(.Call(`_stochtree_root_reset_rfx_tracker_cpp`, tracker, dataset, residual, rfx_model))
}

sum_cpp <- function(x) {
  .Call(`_stochtree_sum_cpp`, x)
}

mean_cpp <- function(x) {
  .Call(`_stochtree_mean_cpp`, x)
}

var_cpp <- function(x) {
  .Call(`_stochtree_var_cpp`, x)
}

sd_cpp <- function(x) {
  .Call(`_stochtree_sd_cpp`, x)
}

active_forest_cpp <- function(num_trees, output_dimension, is_leaf_constant, is_exponentiated) {
  .Call(`_stochtree_active_forest_cpp`, num_trees, output_dimension, is_leaf_constant, is_exponentiated)
}

forest_container_cpp <- function(num_trees, output_dimension, is_leaf_constant, is_exponentiated) {
  .Call(`_stochtree_forest_container_cpp`, num_trees, output_dimension, is_leaf_constant, is_exponentiated)
}

forest_container_from_json_cpp <- function(json_ptr, forest_label) {
  .Call(`_stochtree_forest_container_from_json_cpp`, json_ptr, forest_label)
}

forest_container_append_from_json_cpp <- function(forest_sample_ptr, json_ptr, forest_label) {
  invisible(.Call(`_stochtree_forest_container_append_from_json_cpp`, forest_sample_ptr, json_ptr, forest_label))
}

forest_container_from_json_string_cpp <- function(json_string, forest_label) {
  .Call(`_stochtree_forest_container_from_json_string_cpp`, json_string, forest_label)
}

forest_merge_cpp <- function(inbound_forest_ptr, outbound_forest_ptr) {
  invisible(.Call(`_stochtree_forest_merge_cpp`, inbound_forest_ptr, outbound_forest_ptr))
}

forest_add_constant_cpp <- function(forest_ptr, constant_value) {
  invisible(.Call(`_stochtree_forest_add_constant_cpp`, forest_ptr, constant_value))
}

forest_multiply_constant_cpp <- function(forest_ptr, constant_multiple) {
  invisible(.Call(`_stochtree_forest_multiply_constant_cpp`, forest_ptr, constant_multiple))
}

forest_container_append_from_json_string_cpp <- function(forest_sample_ptr, json_string, forest_label) {
  invisible(.Call(`_stochtree_forest_container_append_from_json_string_cpp`, forest_sample_ptr, json_string, forest_label))
}

combine_forests_forest_container_cpp <- function(forest_samples, forest_inds) {
  invisible(.Call(`_stochtree_combine_forests_forest_container_cpp`, forest_samples, forest_inds))
}

add_to_forest_forest_container_cpp <- function(forest_samples, forest_index, constant_value) {
  invisible(.Call(`_stochtree_add_to_forest_forest_container_cpp`, forest_samples, forest_index, constant_value))
}

multiply_forest_forest_container_cpp <- function(forest_samples, forest_index, constant_multiple) {
  invisible(.Call(`_stochtree_multiply_forest_forest_container_cpp`, forest_samples, forest_index, constant_multiple))
}

num_samples_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_num_samples_forest_container_cpp`, forest_samples)
}

ensemble_tree_max_depth_forest_container_cpp <- function(forest_samples, ensemble_num, tree_num) {
  .Call(`_stochtree_ensemble_tree_max_depth_forest_container_cpp`, forest_samples, ensemble_num, tree_num)
}

ensemble_average_max_depth_forest_container_cpp <- function(forest_samples, ensemble_num) {
  .Call(`_stochtree_ensemble_average_max_depth_forest_container_cpp`, forest_samples, ensemble_num)
}

average_max_depth_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_average_max_depth_forest_container_cpp`, forest_samples)
}

num_leaves_ensemble_forest_container_cpp <- function(forest_samples, forest_num) {
  .Call(`_stochtree_num_leaves_ensemble_forest_container_cpp`, forest_samples, forest_num)
}

sum_leaves_squared_ensemble_forest_container_cpp <- function(forest_samples, forest_num) {
  .Call(`_stochtree_sum_leaves_squared_ensemble_forest_container_cpp`, forest_samples, forest_num)
}

num_trees_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_num_trees_forest_container_cpp`, forest_samples)
}

json_save_forest_container_cpp <- function(forest_samples, json_filename) {
  invisible(.Call(`_stochtree_json_save_forest_container_cpp`, forest_samples, json_filename))
}

json_load_forest_container_cpp <- function(forest_samples, json_filename) {
  invisible(.Call(`_stochtree_json_load_forest_container_cpp`, forest_samples, json_filename))
}

leaf_dimension_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_leaf_dimension_forest_container_cpp`, forest_samples)
}

is_leaf_constant_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_is_leaf_constant_forest_container_cpp`, forest_samples)
}

is_exponentiated_forest_container_cpp <- function(forest_samples) {
  .Call(`_stochtree_is_exponentiated_forest_container_cpp`, forest_samples)
}

all_roots_forest_container_cpp <- function(forest_samples, forest_num) {
  .Call(`_stochtree_all_roots_forest_container_cpp`, forest_samples, forest_num)
}

add_sample_forest_container_cpp <- function(forest_samples) {
  invisible(.Call(`_stochtree_add_sample_forest_container_cpp`, forest_samples))
}

set_leaf_value_forest_container_cpp <- function(forest_samples, leaf_value) {
  invisible(.Call(`_stochtree_set_leaf_value_forest_container_cpp`, forest_samples, leaf_value))
}

add_sample_value_forest_container_cpp <- function(forest_samples, leaf_value) {
  invisible(.Call(`_stochtree_add_sample_value_forest_container_cpp`, forest_samples, leaf_value))
}

add_sample_vector_forest_container_cpp <- function(forest_samples, leaf_vector) {
  invisible(.Call(`_stochtree_add_sample_vector_forest_container_cpp`, forest_samples, leaf_vector))
}

add_numeric_split_tree_value_forest_container_cpp <- function(forest_samples, forest_num, tree_num, leaf_num, feature_num, split_threshold, left_leaf_value, right_leaf_value) {
  invisible(.Call(`_stochtree_add_numeric_split_tree_value_forest_container_cpp`, forest_samples, forest_num, tree_num, leaf_num, feature_num, split_threshold, left_leaf_value, right_leaf_value))
}

add_numeric_split_tree_vector_forest_container_cpp <- function(forest_samples, forest_num, tree_num, leaf_num, feature_num, split_threshold, left_leaf_vector, right_leaf_vector) {
  invisible(.Call(`_stochtree_add_numeric_split_tree_vector_forest_container_cpp`, forest_samples, forest_num, tree_num, leaf_num, feature_num, split_threshold, left_leaf_vector, right_leaf_vector))
}

get_tree_leaves_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_get_tree_leaves_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

get_tree_split_counts_forest_container_cpp <- function(forest_samples, forest_num, tree_num, num_features) {
  .Call(`_stochtree_get_tree_split_counts_forest_container_cpp`, forest_samples, forest_num, tree_num, num_features)
}

get_forest_split_counts_forest_container_cpp <- function(forest_samples, forest_num, num_features) {
  .Call(`_stochtree_get_forest_split_counts_forest_container_cpp`, forest_samples, forest_num, num_features)
}

get_overall_split_counts_forest_container_cpp <- function(forest_samples, num_features) {
  .Call(`_stochtree_get_overall_split_counts_forest_container_cpp`, forest_samples, num_features)
}

get_granular_split_count_array_forest_container_cpp <- function(forest_samples, num_features) {
  .Call(`_stochtree_get_granular_split_count_array_forest_container_cpp`, forest_samples, num_features)
}

set_leaf_vector_forest_container_cpp <- function(forest_samples, leaf_vector) {
  invisible(.Call(`_stochtree_set_leaf_vector_forest_container_cpp`, forest_samples, leaf_vector))
}

is_leaf_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_is_leaf_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

is_numeric_split_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_is_numeric_split_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

is_categorical_split_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_is_categorical_split_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

parent_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_parent_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

left_child_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_left_child_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

right_child_node_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_right_child_node_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

node_depth_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_node_depth_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

split_index_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_split_index_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

split_theshold_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_split_theshold_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

split_categories_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_split_categories_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

leaf_values_forest_container_cpp <- function(forest_samples, forest_num, tree_num, node_id) {
  .Call(`_stochtree_leaf_values_forest_container_cpp`, forest_samples, forest_num, tree_num, node_id)
}

num_nodes_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_num_nodes_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

num_leaves_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_num_leaves_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

num_leaf_parents_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_num_leaf_parents_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

num_split_nodes_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_num_split_nodes_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

nodes_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_nodes_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

leaves_forest_container_cpp <- function(forest_samples, forest_num, tree_num) {
  .Call(`_stochtree_leaves_forest_container_cpp`, forest_samples, forest_num, tree_num)
}

initialize_forest_model_cpp <- function(data, residual, forest_samples, tracker, init_values, leaf_model_int) {
  invisible(.Call(`_stochtree_initialize_forest_model_cpp`, data, residual, forest_samples, tracker, init_values, leaf_model_int))
}

adjust_residual_forest_container_cpp <- function(data, residual, forest_samples, tracker, requires_basis, forest_num, add) {
  invisible(.Call(`_stochtree_adjust_residual_forest_container_cpp`, data, residual, forest_samples, tracker, requires_basis, forest_num, add))
}

propagate_basis_update_forest_container_cpp <- function(data, residual, forest_samples, tracker, forest_num) {
  invisible(.Call(`_stochtree_propagate_basis_update_forest_container_cpp`, data, residual, forest_samples, tracker, forest_num))
}

remove_sample_forest_container_cpp <- function(forest_samples, forest_num) {
  invisible(.Call(`_stochtree_remove_sample_forest_container_cpp`, forest_samples, forest_num))
}

predict_forest_cpp <- function(forest_samples, dataset) {
  .Call(`_stochtree_predict_forest_cpp`, forest_samples, dataset)
}

predict_forest_raw_cpp <- function(forest_samples, dataset) {
  .Call(`_stochtree_predict_forest_raw_cpp`, forest_samples, dataset)
}

predict_forest_raw_single_forest_cpp <- function(forest_samples, dataset, forest_num) {
  .Call(`_stochtree_predict_forest_raw_single_forest_cpp`, forest_samples, dataset, forest_num)
}

predict_forest_raw_single_tree_cpp <- function(forest_samples, dataset, forest_num, tree_num) {
  .Call(`_stochtree_predict_forest_raw_single_tree_cpp`, forest_samples, dataset, forest_num, tree_num)
}

predict_active_forest_cpp <- function(active_forest, dataset) {
  .Call(`_stochtree_predict_active_forest_cpp`, active_forest, dataset)
}

predict_raw_active_forest_cpp <- function(active_forest, dataset) {
  .Call(`_stochtree_predict_raw_active_forest_cpp`, active_forest, dataset)
}

leaf_dimension_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_leaf_dimension_active_forest_cpp`, active_forest)
}

average_max_depth_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_average_max_depth_active_forest_cpp`, active_forest)
}

num_trees_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_num_trees_active_forest_cpp`, active_forest)
}

ensemble_tree_max_depth_active_forest_cpp <- function(active_forest, tree_num) {
  .Call(`_stochtree_ensemble_tree_max_depth_active_forest_cpp`, active_forest, tree_num)
}

is_leaf_constant_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_is_leaf_constant_active_forest_cpp`, active_forest)
}

is_exponentiated_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_is_exponentiated_active_forest_cpp`, active_forest)
}

all_roots_active_forest_cpp <- function(active_forest) {
  .Call(`_stochtree_all_roots_active_forest_cpp`, active_forest)
}

set_leaf_value_active_forest_cpp <- function(active_forest, leaf_value) {
  invisible(.Call(`_stochtree_set_leaf_value_active_forest_cpp`, active_forest, leaf_value))
}

set_leaf_vector_active_forest_cpp <- function(active_forest, leaf_vector) {
  invisible(.Call(`_stochtree_set_leaf_vector_active_forest_cpp`, active_forest, leaf_vector))
}

add_numeric_split_tree_value_active_forest_cpp <- function(active_forest, tree_num, leaf_num, feature_num, split_threshold, left_leaf_value, right_leaf_value) {
  invisible(.Call(`_stochtree_add_numeric_split_tree_value_active_forest_cpp`, active_forest, tree_num, leaf_num, feature_num, split_threshold, left_leaf_value, right_leaf_value))
}

add_numeric_split_tree_vector_active_forest_cpp <- function(active_forest, tree_num, leaf_num, feature_num, split_threshold, left_leaf_vector, right_leaf_vector) {
  invisible(.Call(`_stochtree_add_numeric_split_tree_vector_active_forest_cpp`, active_forest, tree_num, leaf_num, feature_num, split_threshold, left_leaf_vector, right_leaf_vector))
}

get_tree_leaves_active_forest_cpp <- function(active_forest, tree_num) {
  .Call(`_stochtree_get_tree_leaves_active_forest_cpp`, active_forest, tree_num)
}

get_tree_split_counts_active_forest_cpp <- function(active_forest, tree_num, num_features) {
  .Call(`_stochtree_get_tree_split_counts_active_forest_cpp`, active_forest, tree_num, num_features)
}

get_overall_split_counts_active_forest_cpp <- function(active_forest, num_features) {
  .Call(`_stochtree_get_overall_split_counts_active_forest_cpp`, active_forest, num_features)
}

get_granular_split_count_array_active_forest_cpp <- function(active_forest, num_features) {
  .Call(`_stochtree_get_granular_split_count_array_active_forest_cpp`, active_forest, num_features)
}

initialize_forest_model_active_forest_cpp <- function(data, residual, active_forest, tracker, init_values, leaf_model_int) {
  invisible(.Call(`_stochtree_initialize_forest_model_active_forest_cpp`, data, residual, active_forest, tracker, init_values, leaf_model_int))
}

adjust_residual_active_forest_cpp <- function(data, residual, active_forest, tracker, requires_basis, add) {
  invisible(.Call(`_stochtree_adjust_residual_active_forest_cpp`, data, residual, active_forest, tracker, requires_basis, add))
}

propagate_basis_update_active_forest_cpp <- function(data, residual, active_forest, tracker) {
  invisible(.Call(`_stochtree_propagate_basis_update_active_forest_cpp`, data, residual, active_forest, tracker))
}

reset_active_forest_cpp <- function(active_forest, forest_samples, forest_num) {
  invisible(.Call(`_stochtree_reset_active_forest_cpp`, active_forest, forest_samples, forest_num))
}

reset_forest_model_cpp <- function(forest_tracker, forest, data, residual, is_mean_model) {
  invisible(.Call(`_stochtree_reset_forest_model_cpp`, forest_tracker, forest, data, residual, is_mean_model))
}

root_reset_active_forest_cpp <- function(active_forest) {
  invisible(.Call(`_stochtree_root_reset_active_forest_cpp`, active_forest))
}

forest_container_get_max_leaf_index_cpp <- function(forest_container, forest_num) {
  .Call(`_stochtree_forest_container_get_max_leaf_index_cpp`, forest_container, forest_num)
}

compute_leaf_indices_cpp <- function(forest_container, covariates, forest_nums) {
  .Call(`_stochtree_compute_leaf_indices_cpp`, forest_container, covariates, forest_nums)
}

sample_gfr_one_iteration_cpp <- function(data, residual, forest_samples, active_forest, tracker, split_prior, rng, sweep_indices, feature_types, cutpoint_grid_size, leaf_model_scale_input, variable_weights, a_forest, b_forest, global_variance, leaf_model_int, keep_forest, num_features_subsample, num_threads) {
  invisible(.Call(`_stochtree_sample_gfr_one_iteration_cpp`, data, residual, forest_samples, active_forest, tracker, split_prior, rng, sweep_indices, feature_types, cutpoint_grid_size, leaf_model_scale_input, variable_weights, a_forest, b_forest, global_variance, leaf_model_int, keep_forest, num_features_subsample, num_threads))
}

sample_mcmc_one_iteration_cpp <- function(data, residual, forest_samples, active_forest, tracker, split_prior, rng, sweep_indices, feature_types, cutpoint_grid_size, leaf_model_scale_input, variable_weights, a_forest, b_forest, global_variance, leaf_model_int, keep_forest, num_threads) {
  invisible(.Call(`_stochtree_sample_mcmc_one_iteration_cpp`, data, residual, forest_samples, active_forest, tracker, split_prior, rng, sweep_indices, feature_types, cutpoint_grid_size, leaf_model_scale_input, variable_weights, a_forest, b_forest, global_variance, leaf_model_int, keep_forest, num_threads))
}

sample_sigma2_one_iteration_cpp <- function(residual, dataset, rng, a, b) {
  .Call(`_stochtree_sample_sigma2_one_iteration_cpp`, residual, dataset, rng, a, b)
}

sample_tau_one_iteration_cpp <- function(active_forest, rng, a, b) {
  .Call(`_stochtree_sample_tau_one_iteration_cpp`, active_forest, rng, a, b)
}

rng_cpp <- function(random_seed) {
  .Call(`_stochtree_rng_cpp`, random_seed)
}

tree_prior_cpp <- function(alpha, beta, min_samples_leaf, max_depth) {
  .Call(`_stochtree_tree_prior_cpp`, alpha, beta, min_samples_leaf, max_depth)
}

update_alpha_tree_prior_cpp <- function(tree_prior_ptr, alpha) {
  invisible(.Call(`_stochtree_update_alpha_tree_prior_cpp`, tree_prior_ptr, alpha))
}

update_beta_tree_prior_cpp <- function(tree_prior_ptr, beta) {
  invisible(.Call(`_stochtree_update_beta_tree_prior_cpp`, tree_prior_ptr, beta))
}

update_min_samples_leaf_tree_prior_cpp <- function(tree_prior_ptr, min_samples_leaf) {
  invisible(.Call(`_stochtree_update_min_samples_leaf_tree_prior_cpp`, tree_prior_ptr, min_samples_leaf))
}

update_max_depth_tree_prior_cpp <- function(tree_prior_ptr, max_depth) {
  invisible(.Call(`_stochtree_update_max_depth_tree_prior_cpp`, tree_prior_ptr, max_depth))
}

get_alpha_tree_prior_cpp <- function(tree_prior_ptr) {
  .Call(`_stochtree_get_alpha_tree_prior_cpp`, tree_prior_ptr)
}

get_beta_tree_prior_cpp <- function(tree_prior_ptr) {
  .Call(`_stochtree_get_beta_tree_prior_cpp`, tree_prior_ptr)
}

get_min_samples_leaf_tree_prior_cpp <- function(tree_prior_ptr) {
  .Call(`_stochtree_get_min_samples_leaf_tree_prior_cpp`, tree_prior_ptr)
}

get_max_depth_tree_prior_cpp <- function(tree_prior_ptr) {
  .Call(`_stochtree_get_max_depth_tree_prior_cpp`, tree_prior_ptr)
}

forest_tracker_cpp <- function(data, feature_types, num_trees, n) {
  .Call(`_stochtree_forest_tracker_cpp`, data, feature_types, num_trees, n)
}

get_cached_forest_predictions_cpp <- function(tracker_ptr) {
  .Call(`_stochtree_get_cached_forest_predictions_cpp`, tracker_ptr)
}

sample_without_replacement_integer_cpp <- function(population_vector, sampling_probs, sample_size) {
  .Call(`_stochtree_sample_without_replacement_integer_cpp`, population_vector, sampling_probs, sample_size)
}

ordinal_sampler_cpp <- function() {
  .Call(`_stochtree_ordinal_sampler_cpp`)
}

ordinal_sampler_update_latent_variables_cpp <- function(sampler_ptr, data_ptr, outcome_ptr, rng_ptr) {
  invisible(.Call(`_stochtree_ordinal_sampler_update_latent_variables_cpp`, sampler_ptr, data_ptr, outcome_ptr, rng_ptr))
}

ordinal_sampler_update_gamma_params_cpp <- function(sampler_ptr, data_ptr, outcome_ptr, alpha_gamma, beta_gamma, gamma_0, rng_ptr) {
  invisible(.Call(`_stochtree_ordinal_sampler_update_gamma_params_cpp`, sampler_ptr, data_ptr, outcome_ptr, alpha_gamma, beta_gamma, gamma_0, rng_ptr))
}

ordinal_sampler_update_cumsum_exp_cpp <- function(sampler_ptr, data_ptr) {
  invisible(.Call(`_stochtree_ordinal_sampler_update_cumsum_exp_cpp`, sampler_ptr, data_ptr))
}

init_json_cpp <- function() {
  .Call(`_stochtree_init_json_cpp`)
}

json_add_double_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_double_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_value))
}

json_add_double_cpp <- function(json_ptr, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_double_cpp`, json_ptr, field_name, field_value))
}

json_add_integer_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_integer_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_value))
}

json_add_integer_cpp <- function(json_ptr, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_integer_cpp`, json_ptr, field_name, field_value))
}

json_add_bool_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_bool_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_value))
}

json_add_bool_cpp <- function(json_ptr, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_bool_cpp`, json_ptr, field_name, field_value))
}

json_add_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_vector))
}

json_add_vector_cpp <- function(json_ptr, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_vector_cpp`, json_ptr, field_name, field_vector))
}

json_add_integer_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_integer_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_vector))
}

json_add_integer_vector_cpp <- function(json_ptr, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_integer_vector_cpp`, json_ptr, field_name, field_vector))
}

json_add_string_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_string_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_vector))
}

json_add_string_vector_cpp <- function(json_ptr, field_name, field_vector) {
  invisible(.Call(`_stochtree_json_add_string_vector_cpp`, json_ptr, field_name, field_vector))
}

json_add_string_subfolder_cpp <- function(json_ptr, subfolder_name, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_string_subfolder_cpp`, json_ptr, subfolder_name, field_name, field_value))
}

json_add_string_cpp <- function(json_ptr, field_name, field_value) {
  invisible(.Call(`_stochtree_json_add_string_cpp`, json_ptr, field_name, field_value))
}

json_contains_field_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_contains_field_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_contains_field_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_contains_field_cpp`, json_ptr, field_name)
}

json_extract_double_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_double_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_double_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_double_cpp`, json_ptr, field_name)
}

json_extract_integer_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_integer_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_integer_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_integer_cpp`, json_ptr, field_name)
}

json_extract_bool_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_bool_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_bool_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_bool_cpp`, json_ptr, field_name)
}

json_extract_string_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_string_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_string_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_string_cpp`, json_ptr, field_name)
}

json_extract_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_vector_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_vector_cpp`, json_ptr, field_name)
}

json_extract_integer_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_integer_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_integer_vector_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_integer_vector_cpp`, json_ptr, field_name)
}

json_extract_string_vector_subfolder_cpp <- function(json_ptr, subfolder_name, field_name) {
  .Call(`_stochtree_json_extract_string_vector_subfolder_cpp`, json_ptr, subfolder_name, field_name)
}

json_extract_string_vector_cpp <- function(json_ptr, field_name) {
  .Call(`_stochtree_json_extract_string_vector_cpp`, json_ptr, field_name)
}

json_add_forest_cpp <- function(json_ptr, forest_samples) {
  .Call(`_stochtree_json_add_forest_cpp`, json_ptr, forest_samples)
}

json_increment_rfx_count_cpp <- function(json_ptr) {
  invisible(.Call(`_stochtree_json_increment_rfx_count_cpp`, json_ptr))
}

json_add_rfx_container_cpp <- function(json_ptr, rfx_samples) {
  .Call(`_stochtree_json_add_rfx_container_cpp`, json_ptr, rfx_samples)
}

json_add_rfx_label_mapper_cpp <- function(json_ptr, label_mapper) {
  .Call(`_stochtree_json_add_rfx_label_mapper_cpp`, json_ptr, label_mapper)
}

json_add_rfx_groupids_cpp <- function(json_ptr, groupids) {
  .Call(`_stochtree_json_add_rfx_groupids_cpp`, json_ptr, groupids)
}

get_json_string_cpp <- function(json_ptr) {
  .Call(`_stochtree_get_json_string_cpp`, json_ptr)
}

json_save_file_cpp <- function(json_ptr, filename) {
  invisible(.Call(`_stochtree_json_save_file_cpp`, json_ptr, filename))
}

json_load_file_cpp <- function(json_ptr, filename) {
  invisible(.Call(`_stochtree_json_load_file_cpp`, json_ptr, filename))
}

json_load_string_cpp <- function(json_ptr, json_string) {
  invisible(.Call(`_stochtree_json_load_string_cpp`, json_ptr, json_string))
}
