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

#include <Rcpp.h>

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// get_random_start_values_p
Rcpp::NumericMatrix get_random_start_values_p(int n_categories);
RcppExport SEXP _iotarelr_get_random_start_values_p(SEXP n_categoriesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< int >::type n_categories(n_categoriesSEXP);
    rcpp_result_gen = Rcpp::wrap(get_random_start_values_p(n_categories));
    return rcpp_result_gen;
END_RCPP
}
// get_random_start_values_class_sizes
Rcpp::NumericVector get_random_start_values_class_sizes(int n_categories);
RcppExport SEXP _iotarelr_get_random_start_values_class_sizes(SEXP n_categoriesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< int >::type n_categories(n_categoriesSEXP);
    rcpp_result_gen = Rcpp::wrap(get_random_start_values_class_sizes(n_categories));
    return rcpp_result_gen;
END_RCPP
}
// fct_log_likelihood_c
double fct_log_likelihood_c(Rcpp::NumericVector categorial_sizes, Rcpp::NumericMatrix aem, Rcpp::CharacterMatrix obs_pattern_shape, Rcpp::NumericVector obs_pattern_frq, Rcpp::CharacterVector categorical_levels);
RcppExport SEXP _iotarelr_fct_log_likelihood_c(SEXP categorial_sizesSEXP, SEXP aemSEXP, SEXP obs_pattern_shapeSEXP, SEXP obs_pattern_frqSEXP, SEXP categorical_levelsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type categorial_sizes(categorial_sizesSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type aem(aemSEXP);
    Rcpp::traits::input_parameter< Rcpp::CharacterMatrix >::type obs_pattern_shape(obs_pattern_shapeSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type obs_pattern_frq(obs_pattern_frqSEXP);
    Rcpp::traits::input_parameter< Rcpp::CharacterVector >::type categorical_levels(categorical_levelsSEXP);
    rcpp_result_gen = Rcpp::wrap(fct_log_likelihood_c(categorial_sizes, aem, obs_pattern_shape, obs_pattern_frq, categorical_levels));
    return rcpp_result_gen;
END_RCPP
}
// log_likelihood_multi_c
double log_likelihood_multi_c(Rcpp::NumericVector probabilities, Rcpp::NumericVector observations);
RcppExport SEXP _iotarelr_log_likelihood_multi_c(SEXP probabilitiesSEXP, SEXP observationsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type probabilities(probabilitiesSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type observations(observationsSEXP);
    rcpp_result_gen = Rcpp::wrap(log_likelihood_multi_c(probabilities, observations));
    return rcpp_result_gen;
END_RCPP
}
// grad_ll
Rcpp::NumericVector grad_ll(Rcpp::NumericVector param_values, Rcpp::NumericVector observations);
RcppExport SEXP _iotarelr_grad_ll(SEXP param_valuesSEXP, SEXP observationsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type param_values(param_valuesSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type observations(observationsSEXP);
    rcpp_result_gen = Rcpp::wrap(grad_ll(param_values, observations));
    return rcpp_result_gen;
END_RCPP
}
// est_con_multinominal_c
Rcpp::NumericVector est_con_multinominal_c(Rcpp::NumericVector observations, int anchor, int max_iter, double step_size, double cr_rel_change, int n_random_starts, bool fast, bool trace);
RcppExport SEXP _iotarelr_est_con_multinominal_c(SEXP observationsSEXP, SEXP anchorSEXP, SEXP max_iterSEXP, SEXP step_sizeSEXP, SEXP cr_rel_changeSEXP, SEXP n_random_startsSEXP, SEXP fastSEXP, SEXP traceSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type observations(observationsSEXP);
    Rcpp::traits::input_parameter< int >::type anchor(anchorSEXP);
    Rcpp::traits::input_parameter< int >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< double >::type step_size(step_sizeSEXP);
    Rcpp::traits::input_parameter< double >::type cr_rel_change(cr_rel_changeSEXP);
    Rcpp::traits::input_parameter< int >::type n_random_starts(n_random_startsSEXP);
    Rcpp::traits::input_parameter< bool >::type fast(fastSEXP);
    Rcpp::traits::input_parameter< bool >::type trace(traceSEXP);
    rcpp_result_gen = Rcpp::wrap(est_con_multinominal_c(observations, anchor, max_iter, step_size, cr_rel_change, n_random_starts, fast, trace));
    return rcpp_result_gen;
END_RCPP
}
// check_conformity_c
int check_conformity_c(Rcpp::NumericMatrix aem);
RcppExport SEXP _iotarelr_check_conformity_c(SEXP aemSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type aem(aemSEXP);
    rcpp_result_gen = Rcpp::wrap(check_conformity_c(aem));
    return rcpp_result_gen;
END_RCPP
}
// EM_algo_c
Rcpp::List EM_algo_c(Rcpp::CharacterMatrix obs_pattern_shape, Rcpp::NumericVector obs_pattern_frq, Rcpp::NumericMatrix obs_internal_count, Rcpp::CharacterVector categorical_levels, int random_starts, int max_iterations, double rel_convergence, double con_step_size, int con_random_starts, int con_max_iterations, double con_rel_convergence, bool fast, bool trace, bool con_trace);
RcppExport SEXP _iotarelr_EM_algo_c(SEXP obs_pattern_shapeSEXP, SEXP obs_pattern_frqSEXP, SEXP obs_internal_countSEXP, SEXP categorical_levelsSEXP, SEXP random_startsSEXP, SEXP max_iterationsSEXP, SEXP rel_convergenceSEXP, SEXP con_step_sizeSEXP, SEXP con_random_startsSEXP, SEXP con_max_iterationsSEXP, SEXP con_rel_convergenceSEXP, SEXP fastSEXP, SEXP traceSEXP, SEXP con_traceSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::CharacterMatrix >::type obs_pattern_shape(obs_pattern_shapeSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type obs_pattern_frq(obs_pattern_frqSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type obs_internal_count(obs_internal_countSEXP);
    Rcpp::traits::input_parameter< Rcpp::CharacterVector >::type categorical_levels(categorical_levelsSEXP);
    Rcpp::traits::input_parameter< int >::type random_starts(random_startsSEXP);
    Rcpp::traits::input_parameter< int >::type max_iterations(max_iterationsSEXP);
    Rcpp::traits::input_parameter< double >::type rel_convergence(rel_convergenceSEXP);
    Rcpp::traits::input_parameter< double >::type con_step_size(con_step_sizeSEXP);
    Rcpp::traits::input_parameter< int >::type con_random_starts(con_random_startsSEXP);
    Rcpp::traits::input_parameter< int >::type con_max_iterations(con_max_iterationsSEXP);
    Rcpp::traits::input_parameter< double >::type con_rel_convergence(con_rel_convergenceSEXP);
    Rcpp::traits::input_parameter< bool >::type fast(fastSEXP);
    Rcpp::traits::input_parameter< bool >::type trace(traceSEXP);
    Rcpp::traits::input_parameter< bool >::type con_trace(con_traceSEXP);
    rcpp_result_gen = Rcpp::wrap(EM_algo_c(obs_pattern_shape, obs_pattern_frq, obs_internal_count, categorical_levels, random_starts, max_iterations, rel_convergence, con_step_size, con_random_starts, con_max_iterations, con_rel_convergence, fast, trace, con_trace));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_iotarelr_get_random_start_values_p", (DL_FUNC) &_iotarelr_get_random_start_values_p, 1},
    {"_iotarelr_get_random_start_values_class_sizes", (DL_FUNC) &_iotarelr_get_random_start_values_class_sizes, 1},
    {"_iotarelr_fct_log_likelihood_c", (DL_FUNC) &_iotarelr_fct_log_likelihood_c, 5},
    {"_iotarelr_log_likelihood_multi_c", (DL_FUNC) &_iotarelr_log_likelihood_multi_c, 2},
    {"_iotarelr_grad_ll", (DL_FUNC) &_iotarelr_grad_ll, 2},
    {"_iotarelr_est_con_multinominal_c", (DL_FUNC) &_iotarelr_est_con_multinominal_c, 8},
    {"_iotarelr_check_conformity_c", (DL_FUNC) &_iotarelr_check_conformity_c, 1},
    {"_iotarelr_EM_algo_c", (DL_FUNC) &_iotarelr_EM_algo_c, 14},
    {NULL, NULL, 0}
};

RcppExport void R_init_iotarelr(DllInfo *dll) {
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}
