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

#include <RcppArmadillo.h>
#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

// Rcpp_LM
Rcpp::List Rcpp_LM(const arma::mat& YY, const arma::mat& XX, const arma::uvec& var_groups, const arma::uword& test_type0, const int& ncores);
RcppExport SEXP _CSeQTL_Rcpp_LM(SEXP YYSEXP, SEXP XXSEXP, SEXP var_groupsSEXP, SEXP test_type0SEXP, SEXP ncoresSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type YY(YYSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type var_groups(var_groupsSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type test_type0(test_type0SEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_LM(YY, XX, var_groups, test_type0, ncores));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_FDR
Rcpp::List Rcpp_CSeQTL_FDR(const arma::vec& pvalues, const double& lambda, const int& ncores);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_FDR(SEXP pvaluesSEXP, SEXP lambdaSEXP, SEXP ncoresSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type pvalues(pvaluesSEXP);
    Rcpp::traits::input_parameter< const double& >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_FDR(pvalues, lambda, ncores));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_profile_PAR
arma::vec Rcpp_CSeQTL_profile_PAR(const arma::vec& TREC, const arma::vec& hap2, const arma::vec& ASREC, const arma::uvec& PHASE, const arma::uvec& SNP, const arma::mat& RHO, const arma::mat& XX, const arma::vec& upPARS, const arma::uword& index, const arma::vec& bounds, const arma::uword& max_iter, const double& eps, const int& ncores, const bool& show);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_profile_PAR(SEXP TRECSEXP, SEXP hap2SEXP, SEXP ASRECSEXP, SEXP PHASESEXP, SEXP SNPSEXP, SEXP RHOSEXP, SEXP XXSEXP, SEXP upPARSSEXP, SEXP indexSEXP, SEXP boundsSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP ncoresSEXP, SEXP showSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type TREC(TRECSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type hap2(hap2SEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type ASREC(ASRECSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type PHASE(PHASESEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type SNP(SNPSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type RHO(RHOSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type upPARS(upPARSSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type index(indexSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type bounds(boundsSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_profile_PAR(TREC, hap2, ASREC, PHASE, SNP, RHO, XX, upPARS, index, bounds, max_iter, eps, ncores, show));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_profile_PARS
arma::mat Rcpp_CSeQTL_profile_PARS(const arma::vec& TREC, const arma::vec& hap2, const arma::vec& ASREC, const arma::uvec& PHASE, const arma::uvec& SNP, const arma::mat& RHO, const arma::mat& XX, const arma::vec& upPARS, const arma::vec& bounds, const arma::uword& max_iter, const double& eps, const int& ncores, const bool& show);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_profile_PARS(SEXP TRECSEXP, SEXP hap2SEXP, SEXP ASRECSEXP, SEXP PHASESEXP, SEXP SNPSEXP, SEXP RHOSEXP, SEXP XXSEXP, SEXP upPARSSEXP, SEXP boundsSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP ncoresSEXP, SEXP showSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type TREC(TRECSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type hap2(hap2SEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type ASREC(ASRECSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type PHASE(PHASESEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type SNP(SNPSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type RHO(RHOSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type upPARS(upPARSSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type bounds(boundsSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_profile_PARS(TREC, hap2, ASREC, PHASE, SNP, RHO, XX, upPARS, bounds, max_iter, eps, ncores, show));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_cooksD
arma::mat Rcpp_CSeQTL_cooksD(const arma::vec& TREC, const arma::mat& RHO, const arma::mat& XX, const double& trim_thres, const arma::uword& max_iter, const double& eps, const double& mad_const, const int& ncores, const double& gr_eps, const double& conv_eps, const bool& show);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_cooksD(SEXP TRECSEXP, SEXP RHOSEXP, SEXP XXSEXP, SEXP trim_thresSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP mad_constSEXP, SEXP ncoresSEXP, SEXP gr_epsSEXP, SEXP conv_epsSEXP, SEXP showSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type TREC(TRECSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type RHO(RHOSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const double& >::type trim_thres(trim_thresSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type mad_const(mad_constSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    Rcpp::traits::input_parameter< const double& >::type gr_eps(gr_epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type conv_eps(conv_epsSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_cooksD(TREC, RHO, XX, trim_thres, max_iter, eps, mad_const, ncores, gr_eps, conv_eps, show));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_BFGS_smart
Rcpp::List Rcpp_CSeQTL_BFGS_smart(const arma::vec& TREC, const arma::vec& hap2, const arma::vec& ASREC, const arma::uvec& PHASE_0, const arma::uvec& SNP, const arma::mat& RHO, const arma::mat& XX, const arma::vec& upPARS_0, const bool& iFullModel, const bool& trim, const double& trim_thres, const bool& hypotest, const bool& swap, const arma::uword& numAS, const arma::uword& numASn, const arma::uword& numAS_het, const double& mad_const, const arma::uword& max_iter, const double& eps, const int& ncores, const double& gr_eps, const double& conv_eps, const double& hess_shift, const bool& show);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_BFGS_smart(SEXP TRECSEXP, SEXP hap2SEXP, SEXP ASRECSEXP, SEXP PHASE_0SEXP, SEXP SNPSEXP, SEXP RHOSEXP, SEXP XXSEXP, SEXP upPARS_0SEXP, SEXP iFullModelSEXP, SEXP trimSEXP, SEXP trim_thresSEXP, SEXP hypotestSEXP, SEXP swapSEXP, SEXP numASSEXP, SEXP numASnSEXP, SEXP numAS_hetSEXP, SEXP mad_constSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP ncoresSEXP, SEXP gr_epsSEXP, SEXP conv_epsSEXP, SEXP hess_shiftSEXP, SEXP showSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type TREC(TRECSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type hap2(hap2SEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type ASREC(ASRECSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type PHASE_0(PHASE_0SEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type SNP(SNPSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type RHO(RHOSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type upPARS_0(upPARS_0SEXP);
    Rcpp::traits::input_parameter< const bool& >::type iFullModel(iFullModelSEXP);
    Rcpp::traits::input_parameter< const bool& >::type trim(trimSEXP);
    Rcpp::traits::input_parameter< const double& >::type trim_thres(trim_thresSEXP);
    Rcpp::traits::input_parameter< const bool& >::type hypotest(hypotestSEXP);
    Rcpp::traits::input_parameter< const bool& >::type swap(swapSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numAS(numASSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numASn(numASnSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numAS_het(numAS_hetSEXP);
    Rcpp::traits::input_parameter< const double& >::type mad_const(mad_constSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    Rcpp::traits::input_parameter< const double& >::type gr_eps(gr_epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type conv_eps(conv_epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type hess_shift(hess_shiftSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_BFGS_smart(TREC, hap2, ASREC, PHASE_0, SNP, RHO, XX, upPARS_0, iFullModel, trim, trim_thres, hypotest, swap, numAS, numASn, numAS_het, mad_const, max_iter, eps, ncores, gr_eps, conv_eps, hess_shift, show));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_GS
Rcpp::List Rcpp_CSeQTL_GS(const arma::mat& XX, const arma::mat& TREC_0, const arma::umat& SNP, const arma::mat& hap2, const arma::mat& ASREC, const arma::umat& PHASE_0, const arma::mat& RHO, const arma::umat& GS_index, const bool& trim, const bool& swapCT, const double& trim_thres, const arma::uword& numAS, const arma::uword& numASn, const arma::uword& numAS_het, const double& cistrans, const double& mad_const, const arma::uword& max_iter, const double& eps, const double& gr_eps, const double& conv_eps, const bool& show, const bool& prompt, const int& ncores);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_GS(SEXP XXSEXP, SEXP TREC_0SEXP, SEXP SNPSEXP, SEXP hap2SEXP, SEXP ASRECSEXP, SEXP PHASE_0SEXP, SEXP RHOSEXP, SEXP GS_indexSEXP, SEXP trimSEXP, SEXP swapCTSEXP, SEXP trim_thresSEXP, SEXP numASSEXP, SEXP numASnSEXP, SEXP numAS_hetSEXP, SEXP cistransSEXP, SEXP mad_constSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP gr_epsSEXP, SEXP conv_epsSEXP, SEXP showSEXP, SEXP promptSEXP, SEXP ncoresSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type TREC_0(TREC_0SEXP);
    Rcpp::traits::input_parameter< const arma::umat& >::type SNP(SNPSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type hap2(hap2SEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type ASREC(ASRECSEXP);
    Rcpp::traits::input_parameter< const arma::umat& >::type PHASE_0(PHASE_0SEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type RHO(RHOSEXP);
    Rcpp::traits::input_parameter< const arma::umat& >::type GS_index(GS_indexSEXP);
    Rcpp::traits::input_parameter< const bool& >::type trim(trimSEXP);
    Rcpp::traits::input_parameter< const bool& >::type swapCT(swapCTSEXP);
    Rcpp::traits::input_parameter< const double& >::type trim_thres(trim_thresSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numAS(numASSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numASn(numASnSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type numAS_het(numAS_hetSEXP);
    Rcpp::traits::input_parameter< const double& >::type cistrans(cistransSEXP);
    Rcpp::traits::input_parameter< const double& >::type mad_const(mad_constSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type gr_eps(gr_epsSEXP);
    Rcpp::traits::input_parameter< const double& >::type conv_eps(conv_epsSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    Rcpp::traits::input_parameter< const bool& >::type prompt(promptSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_GS(XX, TREC_0, SNP, hap2, ASREC, PHASE_0, RHO, GS_index, trim, swapCT, trim_thres, numAS, numASn, numAS_het, cistrans, mad_const, max_iter, eps, gr_eps, conv_eps, show, prompt, ncores));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_calc_GI
arma::umat Rcpp_calc_GI(const arma::uword& PP, const arma::uword& QQ);
RcppExport SEXP _CSeQTL_Rcpp_calc_GI(SEXP PPSEXP, SEXP QQSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::uword& >::type PP(PPSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type QQ(QQSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_calc_GI(PP, QQ));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_CSeQTL_MU
arma::mat Rcpp_CSeQTL_MU(const arma::umat& GI, const arma::vec& PARS);
RcppExport SEXP _CSeQTL_Rcpp_CSeQTL_MU(SEXP GISEXP, SEXP PARSSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::umat& >::type GI(GISEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type PARS(PARSSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_CSeQTL_MU(GI, PARS));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_calc_MAF_all
arma::vec Rcpp_calc_MAF_all(const arma::mat& SNP, const bool& phasing, const bool& show, const int& ncores);
RcppExport SEXP _CSeQTL_Rcpp_calc_MAF_all(SEXP SNPSEXP, SEXP phasingSEXP, SEXP showSEXP, SEXP ncoresSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type SNP(SNPSEXP);
    Rcpp::traits::input_parameter< const bool& >::type phasing(phasingSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    Rcpp::traits::input_parameter< const int& >::type ncores(ncoresSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_calc_MAF_all(SNP, phasing, show, ncores));
    return rcpp_result_gen;
END_RCPP
}
// Rcpp_NB_reg_one
arma::vec Rcpp_NB_reg_one(const arma::vec& YY, const arma::mat& XX, const arma::vec& OO, const arma::uword& max_iter, const double& eps, const bool& show);
RcppExport SEXP _CSeQTL_Rcpp_NB_reg_one(SEXP YYSEXP, SEXP XXSEXP, SEXP OOSEXP, SEXP max_iterSEXP, SEXP epsSEXP, SEXP showSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type YY(YYSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type XX(XXSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type OO(OOSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< const double& >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< const bool& >::type show(showSEXP);
    rcpp_result_gen = Rcpp::wrap(Rcpp_NB_reg_one(YY, XX, OO, max_iter, eps, show));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_CSeQTL_Rcpp_LM", (DL_FUNC) &_CSeQTL_Rcpp_LM, 5},
    {"_CSeQTL_Rcpp_CSeQTL_FDR", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_FDR, 3},
    {"_CSeQTL_Rcpp_CSeQTL_profile_PAR", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_profile_PAR, 14},
    {"_CSeQTL_Rcpp_CSeQTL_profile_PARS", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_profile_PARS, 13},
    {"_CSeQTL_Rcpp_CSeQTL_cooksD", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_cooksD, 11},
    {"_CSeQTL_Rcpp_CSeQTL_BFGS_smart", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_BFGS_smart, 24},
    {"_CSeQTL_Rcpp_CSeQTL_GS", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_GS, 23},
    {"_CSeQTL_Rcpp_calc_GI", (DL_FUNC) &_CSeQTL_Rcpp_calc_GI, 2},
    {"_CSeQTL_Rcpp_CSeQTL_MU", (DL_FUNC) &_CSeQTL_Rcpp_CSeQTL_MU, 2},
    {"_CSeQTL_Rcpp_calc_MAF_all", (DL_FUNC) &_CSeQTL_Rcpp_calc_MAF_all, 4},
    {"_CSeQTL_Rcpp_NB_reg_one", (DL_FUNC) &_CSeQTL_Rcpp_NB_reg_one, 6},
    {NULL, NULL, 0}
};

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