// 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

// simple_quadrature_grm
List simple_quadrature_grm(int n_points);
RcppExport SEXP _exametrika_simple_quadrature_grm(SEXP n_pointsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< int >::type n_points(n_pointsSEXP);
    rcpp_result_gen = Rcpp::wrap(simple_quadrature_grm(n_points));
    return rcpp_result_gen;
END_RCPP
}
// target_to_params_grm
List target_to_params_grm(NumericVector target, int nitems, IntegerVector ncat);
RcppExport SEXP _exametrika_target_to_params_grm(SEXP targetSEXP, SEXP nitemsSEXP, SEXP ncatSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type target(targetSEXP);
    Rcpp::traits::input_parameter< int >::type nitems(nitemsSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type ncat(ncatSEXP);
    rcpp_result_gen = Rcpp::wrap(target_to_params_grm(target, nitems, ncat));
    return rcpp_result_gen;
END_RCPP
}
// log_lik_grm_cpp
double log_lik_grm_cpp(NumericVector target, IntegerMatrix dat, int n_quad_points);
RcppExport SEXP _exametrika_log_lik_grm_cpp(SEXP targetSEXP, SEXP datSEXP, SEXP n_quad_pointsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type target(targetSEXP);
    Rcpp::traits::input_parameter< IntegerMatrix >::type dat(datSEXP);
    Rcpp::traits::input_parameter< int >::type n_quad_points(n_quad_pointsSEXP);
    rcpp_result_gen = Rcpp::wrap(log_lik_grm_cpp(target, dat, n_quad_points));
    return rcpp_result_gen;
END_RCPP
}
// score_function_analytical_grm
NumericVector score_function_analytical_grm(NumericVector target, IntegerMatrix dat, int n_quad_points);
RcppExport SEXP _exametrika_score_function_analytical_grm(SEXP targetSEXP, SEXP datSEXP, SEXP n_quad_pointsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type target(targetSEXP);
    Rcpp::traits::input_parameter< IntegerMatrix >::type dat(datSEXP);
    Rcpp::traits::input_parameter< int >::type n_quad_points(n_quad_pointsSEXP);
    rcpp_result_gen = Rcpp::wrap(score_function_analytical_grm(target, dat, n_quad_points));
    return rcpp_result_gen;
END_RCPP
}
// score_function_numerical_grm
NumericVector score_function_numerical_grm(NumericVector target, IntegerMatrix dat, int n_quad_points);
RcppExport SEXP _exametrika_score_function_numerical_grm(SEXP targetSEXP, SEXP datSEXP, SEXP n_quad_pointsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type target(targetSEXP);
    Rcpp::traits::input_parameter< IntegerMatrix >::type dat(datSEXP);
    Rcpp::traits::input_parameter< int >::type n_quad_points(n_quad_pointsSEXP);
    rcpp_result_gen = Rcpp::wrap(score_function_numerical_grm(target, dat, n_quad_points));
    return rcpp_result_gen;
END_RCPP
}
// compare_gradients_grm
List compare_gradients_grm(NumericVector target, IntegerMatrix dat, int n_quad_points);
RcppExport SEXP _exametrika_compare_gradients_grm(SEXP targetSEXP, SEXP datSEXP, SEXP n_quad_pointsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type target(targetSEXP);
    Rcpp::traits::input_parameter< IntegerMatrix >::type dat(datSEXP);
    Rcpp::traits::input_parameter< int >::type n_quad_points(n_quad_pointsSEXP);
    rcpp_result_gen = Rcpp::wrap(compare_gradients_grm(target, dat, n_quad_points));
    return rcpp_result_gen;
END_RCPP
}
// irm_gibbs_core_cpp
List irm_gibbs_core_cpp(NumericVector Uq_vec, IntegerVector Uq_dim, NumericMatrix Z, NumericMatrix cls01_init, NumericMatrix fld01_init, double gamma_c, double gamma_f, NumericVector alpha_vec_R, int max_iter, int stable_limit, bool verbose);
RcppExport SEXP _exametrika_irm_gibbs_core_cpp(SEXP Uq_vecSEXP, SEXP Uq_dimSEXP, SEXP ZSEXP, SEXP cls01_initSEXP, SEXP fld01_initSEXP, SEXP gamma_cSEXP, SEXP gamma_fSEXP, SEXP alpha_vec_RSEXP, SEXP max_iterSEXP, SEXP stable_limitSEXP, SEXP verboseSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type Uq_vec(Uq_vecSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Uq_dim(Uq_dimSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type cls01_init(cls01_initSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type fld01_init(fld01_initSEXP);
    Rcpp::traits::input_parameter< double >::type gamma_c(gamma_cSEXP);
    Rcpp::traits::input_parameter< double >::type gamma_f(gamma_fSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type alpha_vec_R(alpha_vec_RSEXP);
    Rcpp::traits::input_parameter< int >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< int >::type stable_limit(stable_limitSEXP);
    Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP);
    rcpp_result_gen = Rcpp::wrap(irm_gibbs_core_cpp(Uq_vec, Uq_dim, Z, cls01_init, fld01_init, gamma_c, gamma_f, alpha_vec_R, max_iter, stable_limit, verbose));
    return rcpp_result_gen;
END_RCPP
}
// qBiNormal_cpp
double qBiNormal_cpp(double a, double b, double rho);
RcppExport SEXP _exametrika_qBiNormal_cpp(SEXP aSEXP, SEXP bSEXP, SEXP rhoSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< double >::type a(aSEXP);
    Rcpp::traits::input_parameter< double >::type b(bSEXP);
    Rcpp::traits::input_parameter< double >::type rho(rhoSEXP);
    rcpp_result_gen = Rcpp::wrap(qBiNormal_cpp(a, b, rho));
    return rcpp_result_gen;
END_RCPP
}
// polychoric_likelihood_cpp
double polychoric_likelihood_cpp(double rho, IntegerMatrix mat);
RcppExport SEXP _exametrika_polychoric_likelihood_cpp(SEXP rhoSEXP, SEXP matSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< double >::type rho(rhoSEXP);
    Rcpp::traits::input_parameter< IntegerMatrix >::type mat(matSEXP);
    rcpp_result_gen = Rcpp::wrap(polychoric_likelihood_cpp(rho, mat));
    return rcpp_result_gen;
END_RCPP
}
// polychoric_cpp
double polychoric_cpp(IntegerVector x, IntegerVector y);
RcppExport SEXP _exametrika_polychoric_cpp(SEXP xSEXP, SEXP ySEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< IntegerVector >::type x(xSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type y(ySEXP);
    rcpp_result_gen = Rcpp::wrap(polychoric_cpp(x, y));
    return rcpp_result_gen;
END_RCPP
}
// polychoric_matrix_cpp
NumericMatrix polychoric_matrix_cpp(IntegerMatrix data);
RcppExport SEXP _exametrika_polychoric_matrix_cpp(SEXP dataSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< IntegerMatrix >::type data(dataSEXP);
    rcpp_result_gen = Rcpp::wrap(polychoric_matrix_cpp(data));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_exametrika_simple_quadrature_grm", (DL_FUNC) &_exametrika_simple_quadrature_grm, 1},
    {"_exametrika_target_to_params_grm", (DL_FUNC) &_exametrika_target_to_params_grm, 3},
    {"_exametrika_log_lik_grm_cpp", (DL_FUNC) &_exametrika_log_lik_grm_cpp, 3},
    {"_exametrika_score_function_analytical_grm", (DL_FUNC) &_exametrika_score_function_analytical_grm, 3},
    {"_exametrika_score_function_numerical_grm", (DL_FUNC) &_exametrika_score_function_numerical_grm, 3},
    {"_exametrika_compare_gradients_grm", (DL_FUNC) &_exametrika_compare_gradients_grm, 3},
    {"_exametrika_irm_gibbs_core_cpp", (DL_FUNC) &_exametrika_irm_gibbs_core_cpp, 11},
    {"_exametrika_qBiNormal_cpp", (DL_FUNC) &_exametrika_qBiNormal_cpp, 3},
    {"_exametrika_polychoric_likelihood_cpp", (DL_FUNC) &_exametrika_polychoric_likelihood_cpp, 2},
    {"_exametrika_polychoric_cpp", (DL_FUNC) &_exametrika_polychoric_cpp, 2},
    {"_exametrika_polychoric_matrix_cpp", (DL_FUNC) &_exametrika_polychoric_matrix_cpp, 1},
    {NULL, NULL, 0}
};

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