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

#include "../inst/include/mets.h"
#include <RcppArmadillo.h>
#include <Rcpp.h>
#include <string>
#include <set>

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

// ApplyBy2
List ApplyBy2(NumericMatrix idata, NumericVector icluster, SEXP F, Environment Env, std::string Argument, int Columnwise, int Reduce, double epsilon);
RcppExport SEXP _mets_ApplyBy2(SEXP idataSEXP, SEXP iclusterSEXP, SEXP FSEXP, SEXP EnvSEXP, SEXP ArgumentSEXP, SEXP ColumnwiseSEXP, SEXP ReduceSEXP, SEXP epsilonSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericMatrix >::type idata(idataSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type icluster(iclusterSEXP);
    Rcpp::traits::input_parameter< SEXP >::type F(FSEXP);
    Rcpp::traits::input_parameter< Environment >::type Env(EnvSEXP);
    Rcpp::traits::input_parameter< std::string >::type Argument(ArgumentSEXP);
    Rcpp::traits::input_parameter< int >::type Columnwise(ColumnwiseSEXP);
    Rcpp::traits::input_parameter< int >::type Reduce(ReduceSEXP);
    Rcpp::traits::input_parameter< double >::type epsilon(epsilonSEXP);
    rcpp_result_gen = Rcpp::wrap(ApplyBy2(idata, icluster, F, Env, Argument, Columnwise, Reduce, epsilon));
    return rcpp_result_gen;
END_RCPP
}
// ApplyBy
NumericMatrix ApplyBy(NumericMatrix idata, IntegerVector icluster, Function f);
RcppExport SEXP _mets_ApplyBy(SEXP idataSEXP, SEXP iclusterSEXP, SEXP fSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericMatrix >::type idata(idataSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type icluster(iclusterSEXP);
    Rcpp::traits::input_parameter< Function >::type f(fSEXP);
    rcpp_result_gen = Rcpp::wrap(ApplyBy(idata, icluster, f));
    return rcpp_result_gen;
END_RCPP
}
// S0_FG_GcR
RcppExport SEXP S0_FG_GcR(SEXP ia, SEXP iGc, SEXP itype2, SEXP istatus, SEXP istrata, SEXP instrata, SEXP istrata2, SEXP instrata2, SEXP iGcstart);
RcppExport SEXP _mets_S0_FG_GcR(SEXP iaSEXP, SEXP iGcSEXP, SEXP itype2SEXP, SEXP istatusSEXP, SEXP istrataSEXP, SEXP instrataSEXP, SEXP istrata2SEXP, SEXP instrata2SEXP, SEXP iGcstartSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type ia(iaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type iGc(iGcSEXP);
    Rcpp::traits::input_parameter< SEXP >::type itype2(itype2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type istatus(istatusSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata(istrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata(instrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata2(istrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata2(instrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type iGcstart(iGcstartSEXP);
    rcpp_result_gen = Rcpp::wrap(S0_FG_GcR(ia, iGc, itype2, istatus, istrata, instrata, istrata2, instrata2, iGcstart));
    return rcpp_result_gen;
END_RCPP
}
// GcjumpsR
RcppExport SEXP GcjumpsR(SEXP iGc, SEXP istatus, SEXP istrata2, SEXP instrata2, SEXP iGcstart, SEXP injumps);
RcppExport SEXP _mets_GcjumpsR(SEXP iGcSEXP, SEXP istatusSEXP, SEXP istrata2SEXP, SEXP instrata2SEXP, SEXP iGcstartSEXP, SEXP injumpsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type iGc(iGcSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istatus(istatusSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata2(istrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata2(instrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type iGcstart(iGcstartSEXP);
    Rcpp::traits::input_parameter< SEXP >::type injumps(injumpsSEXP);
    rcpp_result_gen = Rcpp::wrap(GcjumpsR(iGc, istatus, istrata2, instrata2, iGcstart, injumps));
    return rcpp_result_gen;
END_RCPP
}
// S0_FGRN
RcppExport SEXP S0_FGRN(SEXP ia, SEXP itype2, SEXP istatus, SEXP istrata, SEXP instrata, SEXP istrata2, SEXP instrata2, SEXP iGcjumps);
RcppExport SEXP _mets_S0_FGRN(SEXP iaSEXP, SEXP itype2SEXP, SEXP istatusSEXP, SEXP istrataSEXP, SEXP instrataSEXP, SEXP istrata2SEXP, SEXP instrata2SEXP, SEXP iGcjumpsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type ia(iaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type itype2(itype2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type istatus(istatusSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata(istrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata(instrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata2(istrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata2(instrata2SEXP);
    Rcpp::traits::input_parameter< SEXP >::type iGcjumps(iGcjumpsSEXP);
    rcpp_result_gen = Rcpp::wrap(S0_FGRN(ia, itype2, istatus, istrata, instrata, istrata2, instrata2, iGcjumps));
    return rcpp_result_gen;
END_RCPP
}
// riskstrataR
RcppExport SEXP riskstrataR(SEXP ia, SEXP istrata, SEXP instrata);
RcppExport SEXP _mets_riskstrataR(SEXP iaSEXP, SEXP istrataSEXP, SEXP instrataSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type ia(iaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata(istrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata(instrataSEXP);
    rcpp_result_gen = Rcpp::wrap(riskstrataR(ia, istrata, instrata));
    return rcpp_result_gen;
END_RCPP
}
// cumsumstratasumR
RcppExport SEXP cumsumstratasumR(SEXP ia, SEXP istrata, SEXP instrata, SEXP iallstrata);
RcppExport SEXP _mets_cumsumstratasumR(SEXP iaSEXP, SEXP istrataSEXP, SEXP instrataSEXP, SEXP iallstrataSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type ia(iaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type istrata(istrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type instrata(instrataSEXP);
    Rcpp::traits::input_parameter< SEXP >::type iallstrata(iallstrataSEXP);
    rcpp_result_gen = Rcpp::wrap(cumsumstratasumR(ia, istrata, instrata, iallstrata));
    return rcpp_result_gen;
END_RCPP
}
// scoreMVN
arma::mat scoreMVN(arma::mat& Y, arma::mat& Mu, arma::mat& dMu, arma::mat& S, arma::mat& dS, double itol);
static SEXP _mets_scoreMVN_try(SEXP YSEXP, SEXP MuSEXP, SEXP dMuSEXP, SEXP SSEXP, SEXP dSSEXP, SEXP itolSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< arma::mat& >::type Y(YSEXP);
    Rcpp::traits::input_parameter< arma::mat& >::type Mu(MuSEXP);
    Rcpp::traits::input_parameter< arma::mat& >::type dMu(dMuSEXP);
    Rcpp::traits::input_parameter< arma::mat& >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::mat& >::type dS(dSSEXP);
    Rcpp::traits::input_parameter< double >::type itol(itolSEXP);
    rcpp_result_gen = Rcpp::wrap(scoreMVN(Y, Mu, dMu, S, dS, itol));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_scoreMVN(SEXP YSEXP, SEXP MuSEXP, SEXP dMuSEXP, SEXP SSEXP, SEXP dSSEXP, SEXP itolSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_scoreMVN_try(YSEXP, MuSEXP, dMuSEXP, SSEXP, dSSEXP, itolSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// loglikMVN
arma::mat loglikMVN(arma::mat Yl, arma::mat Yu, arma::uvec Status, arma::mat Mu, arma::mat S, arma::mat Threshold, SEXP z, SEXP su, double itol);
static SEXP _mets_loglikMVN_try(SEXP YlSEXP, SEXP YuSEXP, SEXP StatusSEXP, SEXP MuSEXP, SEXP SSEXP, SEXP ThresholdSEXP, SEXP zSEXP, SEXP suSEXP, SEXP itolSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< arma::mat >::type Yl(YlSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type Yu(YuSEXP);
    Rcpp::traits::input_parameter< arma::uvec >::type Status(StatusSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type Mu(MuSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type Threshold(ThresholdSEXP);
    Rcpp::traits::input_parameter< SEXP >::type z(zSEXP);
    Rcpp::traits::input_parameter< SEXP >::type su(suSEXP);
    Rcpp::traits::input_parameter< double >::type itol(itolSEXP);
    rcpp_result_gen = Rcpp::wrap(loglikMVN(Yl, Yu, Status, Mu, S, Threshold, z, su, itol));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_loglikMVN(SEXP YlSEXP, SEXP YuSEXP, SEXP StatusSEXP, SEXP MuSEXP, SEXP SSEXP, SEXP ThresholdSEXP, SEXP zSEXP, SEXP suSEXP, SEXP itolSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_loglikMVN_try(YlSEXP, YuSEXP, StatusSEXP, MuSEXP, SSEXP, ThresholdSEXP, zSEXP, suSEXP, itolSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dmvn
NumericVector dmvn(arma::mat u, arma::mat mu, arma::mat rho);
static SEXP _mets_dmvn_try(SEXP uSEXP, SEXP muSEXP, SEXP rhoSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< arma::mat >::type u(uSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type mu(muSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type rho(rhoSEXP);
    rcpp_result_gen = Rcpp::wrap(dmvn(u, mu, rho));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_dmvn(SEXP uSEXP, SEXP muSEXP, SEXP rhoSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_dmvn_try(uSEXP, muSEXP, rhoSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// rmvn
arma::mat rmvn(unsigned n, arma::mat mu, arma::mat rho);
static SEXP _mets_rmvn_try(SEXP nSEXP, SEXP muSEXP, SEXP rhoSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< unsigned >::type n(nSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type mu(muSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type rho(rhoSEXP);
    rcpp_result_gen = Rcpp::wrap(rmvn(n, mu, rho));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_rmvn(SEXP nSEXP, SEXP muSEXP, SEXP rhoSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_rmvn_try(nSEXP, muSEXP, rhoSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// rpch
arma::vec rpch(unsigned n, std::vector<double> lambda, std::vector<double> time);
static SEXP _mets_rpch_try(SEXP nSEXP, SEXP lambdaSEXP, SEXP timeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< unsigned >::type n(nSEXP);
    Rcpp::traits::input_parameter< std::vector<double> >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< std::vector<double> >::type time(timeSEXP);
    rcpp_result_gen = Rcpp::wrap(rpch(n, lambda, time));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_rpch(SEXP nSEXP, SEXP lambdaSEXP, SEXP timeSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_rpch_try(nSEXP, lambdaSEXP, timeSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// cpch
arma::vec cpch(arma::vec& x, std::vector<double> lambda, std::vector<double> time);
static SEXP _mets_cpch_try(SEXP xSEXP, SEXP lambdaSEXP, SEXP timeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< arma::vec& >::type x(xSEXP);
    Rcpp::traits::input_parameter< std::vector<double> >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< std::vector<double> >::type time(timeSEXP);
    rcpp_result_gen = Rcpp::wrap(cpch(x, lambda, time));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_cpch(SEXP xSEXP, SEXP lambdaSEXP, SEXP timeSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_cpch_try(xSEXP, lambdaSEXP, timeSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// rchazC
arma::colvec rchazC(const arma::mat& cum, const arma::colvec rr, const arma::colvec entry);
static SEXP _mets_rchazC_try(SEXP cumSEXP, SEXP rrSEXP, SEXP entrySEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type cum(cumSEXP);
    Rcpp::traits::input_parameter< const arma::colvec >::type rr(rrSEXP);
    Rcpp::traits::input_parameter< const arma::colvec >::type entry(entrySEXP);
    rcpp_result_gen = Rcpp::wrap(rchazC(cum, rr, entry));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_rchazC(SEXP cumSEXP, SEXP rrSEXP, SEXP entrySEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_rchazC_try(cumSEXP, rrSEXP, entrySEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// simGL
arma::mat simGL(const arma::mat& dcum, const arma::colvec& St, const arma::colvec& rr, const arma::colvec& rd, const arma::colvec& z, const arma::colvec& fz, const arma::colvec& tc, const int type, const double theta, const int maxit, const double share);
static SEXP _mets_simGL_try(SEXP dcumSEXP, SEXP StSEXP, SEXP rrSEXP, SEXP rdSEXP, SEXP zSEXP, SEXP fzSEXP, SEXP tcSEXP, SEXP typeSEXP, SEXP thetaSEXP, SEXP maxitSEXP, SEXP shareSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type dcum(dcumSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type St(StSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type rr(rrSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type rd(rdSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type z(zSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type fz(fzSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type tc(tcSEXP);
    Rcpp::traits::input_parameter< const int >::type type(typeSEXP);
    Rcpp::traits::input_parameter< const double >::type theta(thetaSEXP);
    Rcpp::traits::input_parameter< const int >::type maxit(maxitSEXP);
    Rcpp::traits::input_parameter< const double >::type share(shareSEXP);
    rcpp_result_gen = Rcpp::wrap(simGL(dcum, St, rr, rd, z, fz, tc, type, theta, maxit, share));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_simGL(SEXP dcumSEXP, SEXP StSEXP, SEXP rrSEXP, SEXP rdSEXP, SEXP zSEXP, SEXP fzSEXP, SEXP tcSEXP, SEXP typeSEXP, SEXP thetaSEXP, SEXP maxitSEXP, SEXP shareSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_simGL_try(dcumSEXP, StSEXP, rrSEXP, rdSEXP, zSEXP, fzSEXP, tcSEXP, typeSEXP, thetaSEXP, maxitSEXP, shareSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// simSurvZ
arma::mat simSurvZ(const arma::mat& St, const arma::colvec& rd, const arma::colvec& z, const double theta, const int type);
static SEXP _mets_simSurvZ_try(SEXP StSEXP, SEXP rdSEXP, SEXP zSEXP, SEXP thetaSEXP, SEXP typeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type St(StSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type rd(rdSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type z(zSEXP);
    Rcpp::traits::input_parameter< const double >::type theta(thetaSEXP);
    Rcpp::traits::input_parameter< const int >::type type(typeSEXP);
    rcpp_result_gen = Rcpp::wrap(simSurvZ(St, rd, z, theta, type));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_simSurvZ(SEXP StSEXP, SEXP rdSEXP, SEXP zSEXP, SEXP thetaSEXP, SEXP typeSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_simSurvZ_try(StSEXP, rdSEXP, zSEXP, thetaSEXP, typeSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// tildeLambda1
arma::mat tildeLambda1(const arma::colvec& dLambda1, const arma::colvec& LambdaD, const arma::colvec& r1, const arma::colvec& rd, const arma::colvec& theta, const IntegerVector id);
static SEXP _mets_tildeLambda1_try(SEXP dLambda1SEXP, SEXP LambdaDSEXP, SEXP r1SEXP, SEXP rdSEXP, SEXP thetaSEXP, SEXP idSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::colvec& >::type dLambda1(dLambda1SEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type LambdaD(LambdaDSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type r1(r1SEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type rd(rdSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type theta(thetaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type id(idSEXP);
    rcpp_result_gen = Rcpp::wrap(tildeLambda1(dLambda1, LambdaD, r1, rd, theta, id));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_tildeLambda1(SEXP dLambda1SEXP, SEXP LambdaDSEXP, SEXP r1SEXP, SEXP rdSEXP, SEXP thetaSEXP, SEXP idSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_tildeLambda1_try(dLambda1SEXP, LambdaDSEXP, r1SEXP, rdSEXP, thetaSEXP, idSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// tildeLambda1R
arma::mat tildeLambda1R(const arma::colvec& dLambda1, const arma::colvec& LambdaD, const arma::colvec& r1, const arma::colvec& rd, const arma::colvec& theta, const IntegerVector id, const arma::colvec& sign);
static SEXP _mets_tildeLambda1R_try(SEXP dLambda1SEXP, SEXP LambdaDSEXP, SEXP r1SEXP, SEXP rdSEXP, SEXP thetaSEXP, SEXP idSEXP, SEXP signSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::colvec& >::type dLambda1(dLambda1SEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type LambdaD(LambdaDSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type r1(r1SEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type rd(rdSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type theta(thetaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type id(idSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type sign(signSEXP);
    rcpp_result_gen = Rcpp::wrap(tildeLambda1R(dLambda1, LambdaD, r1, rd, theta, id, sign));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_tildeLambda1R(SEXP dLambda1SEXP, SEXP LambdaDSEXP, SEXP r1SEXP, SEXP rdSEXP, SEXP thetaSEXP, SEXP idSEXP, SEXP signSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_tildeLambda1R_try(dLambda1SEXP, LambdaDSEXP, r1SEXP, rdSEXP, thetaSEXP, idSEXP, signSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// logl_weibull
double logl_weibull(const arma::vec& par, const arma::vec& entry, const arma::vec& exit, const arma::vec& status, const arma::mat& X, const arma::mat& Z);
static SEXP _mets_logl_weibull_try(SEXP parSEXP, SEXP entrySEXP, SEXP exitSEXP, SEXP statusSEXP, SEXP XSEXP, SEXP ZSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type par(parSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type entry(entrySEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type exit(exitSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type status(statusSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Z(ZSEXP);
    rcpp_result_gen = Rcpp::wrap(logl_weibull(par, entry, exit, status, X, Z));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_logl_weibull(SEXP parSEXP, SEXP entrySEXP, SEXP exitSEXP, SEXP statusSEXP, SEXP XSEXP, SEXP ZSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_logl_weibull_try(parSEXP, entrySEXP, exitSEXP, statusSEXP, XSEXP, ZSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// score_weibull
arma::mat score_weibull(const arma::vec& par, const arma::vec& entry, const arma::vec& exit, const arma::vec& status, const arma::mat& X, const arma::mat& Z, bool indiv);
static SEXP _mets_score_weibull_try(SEXP parSEXP, SEXP entrySEXP, SEXP exitSEXP, SEXP statusSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP indivSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const arma::vec& >::type par(parSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type entry(entrySEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type exit(exitSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type status(statusSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< bool >::type indiv(indivSEXP);
    rcpp_result_gen = Rcpp::wrap(score_weibull(par, entry, exit, status, X, Z, indiv));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _mets_score_weibull(SEXP parSEXP, SEXP entrySEXP, SEXP exitSEXP, SEXP statusSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP indivSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_mets_score_weibull_try(parSEXP, entrySEXP, exitSEXP, statusSEXP, XSEXP, ZSEXP, indivSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        (Rf_error)("%s", CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}

// validate (ensure exported C++ functions exist before calling them)
static int _mets_RcppExport_validate(const char* sig) { 
    static std::set<std::string> signatures;
    if (signatures.empty()) {
        signatures.insert("arma::mat(*.scoreMVN)(arma::mat&,arma::mat&,arma::mat&,arma::mat&,arma::mat&,double)");
        signatures.insert("arma::mat(*.loglikMVN)(arma::mat,arma::mat,arma::uvec,arma::mat,arma::mat,arma::mat,SEXP,SEXP,double)");
        signatures.insert("NumericVector(*.dmvn)(arma::mat,arma::mat,arma::mat)");
        signatures.insert("arma::mat(*.rmvn)(unsigned,arma::mat,arma::mat)");
        signatures.insert("arma::vec(*.rpch)(unsigned,std::vector<double>,std::vector<double>)");
        signatures.insert("arma::vec(*.cpch)(arma::vec&,std::vector<double>,std::vector<double>)");
        signatures.insert("arma::colvec(*.rchazC)(const arma::mat&,const arma::colvec,const arma::colvec)");
        signatures.insert("arma::mat(*.simGL)(const arma::mat&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const int,const double,const int,const double)");
        signatures.insert("arma::mat(*.simSurvZ)(const arma::mat&,const arma::colvec&,const arma::colvec&,const double,const int)");
        signatures.insert("arma::mat(*.tildeLambda1)(const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const IntegerVector)");
        signatures.insert("arma::mat(*.tildeLambda1R)(const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const arma::colvec&,const IntegerVector,const arma::colvec&)");
        signatures.insert("double(*.logl_weibull)(const arma::vec&,const arma::vec&,const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&)");
        signatures.insert("arma::mat(*.score_weibull)(const arma::vec&,const arma::vec&,const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,bool)");
    }
    return signatures.find(sig) != signatures.end();
}

// registerCCallable (register entry points for exported C++ functions)
RcppExport SEXP _mets_RcppExport_registerCCallable() { 
    R_RegisterCCallable("mets", "_mets_.scoreMVN", (DL_FUNC)_mets_scoreMVN_try);
    R_RegisterCCallable("mets", "_mets_.loglikMVN", (DL_FUNC)_mets_loglikMVN_try);
    R_RegisterCCallable("mets", "_mets_.dmvn", (DL_FUNC)_mets_dmvn_try);
    R_RegisterCCallable("mets", "_mets_.rmvn", (DL_FUNC)_mets_rmvn_try);
    R_RegisterCCallable("mets", "_mets_.rpch", (DL_FUNC)_mets_rpch_try);
    R_RegisterCCallable("mets", "_mets_.cpch", (DL_FUNC)_mets_cpch_try);
    R_RegisterCCallable("mets", "_mets_.rchazC", (DL_FUNC)_mets_rchazC_try);
    R_RegisterCCallable("mets", "_mets_.simGL", (DL_FUNC)_mets_simGL_try);
    R_RegisterCCallable("mets", "_mets_.simSurvZ", (DL_FUNC)_mets_simSurvZ_try);
    R_RegisterCCallable("mets", "_mets_.tildeLambda1", (DL_FUNC)_mets_tildeLambda1_try);
    R_RegisterCCallable("mets", "_mets_.tildeLambda1R", (DL_FUNC)_mets_tildeLambda1R_try);
    R_RegisterCCallable("mets", "_mets_.logl_weibull", (DL_FUNC)_mets_logl_weibull_try);
    R_RegisterCCallable("mets", "_mets_.score_weibull", (DL_FUNC)_mets_score_weibull_try);
    R_RegisterCCallable("mets", "_mets_RcppExport_validate", (DL_FUNC)_mets_RcppExport_validate);
    return R_NilValue;
}

RcppExport SEXP biprobit0(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP biprobit2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP bvncdf(SEXP, SEXP, SEXP);
RcppExport SEXP claytonoakes(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP claytonoakesbinRV(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP clusterindexdata(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP clusterindexM(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP cor(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP covrfR(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP covrfstrataCovR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP covrfstrataR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP CubeMat(SEXP, SEXP);
RcppExport SEXP CubeMattime(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP CubeVec(SEXP, SEXP, SEXP);
RcppExport SEXP cumsum2strataR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP cumsumidstratasumCovR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP cumsumidstratasumR(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP cumsumstrataPOR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP cumsumstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP diffstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP DLambetaR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP familypairindex(SEXP, SEXP, SEXP);
RcppExport SEXP FastApprox(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastCoxPLstrata(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastCoxPLstrataAddGam(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastCoxPLstrataPO(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastCoxPrepStrata(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastLong2(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP FastPattern(SEXP, SEXP, SEXP);
RcppExport SEXP headstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP indexstrataR(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP Matdoubleindex(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP McumsumstrataR(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP ModelMatrixTestCox(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP MsumstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP pBhat(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP pmvn0(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP PropTestCox(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP PropTestCoxClust(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP revcumsum2stratafdNR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP revcumsum2strataR(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP revcumsumidstratasumCovR(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP revcumsumidstratasumR(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP revcumsumR(SEXP);
RcppExport SEXP revcumsumstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP revcumsumstratasumR(SEXP, SEXP, SEXP);
RcppExport SEXP sumstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP tailstrataR(SEXP, SEXP, SEXP);
RcppExport SEXP twostageloglikebin(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP twostageloglikebinpairs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP twostageloglikeRV(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP twostageloglikeRVpairs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP Uhat(SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP uniprobit(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP vecAllStrataR(SEXP, SEXP, SEXP);
RcppExport SEXP vecCPMat(SEXP);
RcppExport SEXP vecMatMat(SEXP, SEXP);
RcppExport SEXP wherestrataR(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP XXMatFULL(SEXP, SEXP);

static const R_CallMethodDef CallEntries[] = {
    {"_mets_ApplyBy2", (DL_FUNC) &_mets_ApplyBy2, 8},
    {"_mets_ApplyBy", (DL_FUNC) &_mets_ApplyBy, 3},
    {"_mets_S0_FG_GcR", (DL_FUNC) &_mets_S0_FG_GcR, 9},
    {"_mets_GcjumpsR", (DL_FUNC) &_mets_GcjumpsR, 6},
    {"_mets_S0_FGRN", (DL_FUNC) &_mets_S0_FGRN, 8},
    {"_mets_riskstrataR", (DL_FUNC) &_mets_riskstrataR, 3},
    {"_mets_cumsumstratasumR", (DL_FUNC) &_mets_cumsumstratasumR, 4},
    {"_mets_scoreMVN", (DL_FUNC) &_mets_scoreMVN, 6},
    {"_mets_loglikMVN", (DL_FUNC) &_mets_loglikMVN, 9},
    {"_mets_dmvn", (DL_FUNC) &_mets_dmvn, 3},
    {"_mets_rmvn", (DL_FUNC) &_mets_rmvn, 3},
    {"_mets_rpch", (DL_FUNC) &_mets_rpch, 3},
    {"_mets_cpch", (DL_FUNC) &_mets_cpch, 3},
    {"_mets_rchazC", (DL_FUNC) &_mets_rchazC, 3},
    {"_mets_simGL", (DL_FUNC) &_mets_simGL, 11},
    {"_mets_simSurvZ", (DL_FUNC) &_mets_simSurvZ, 5},
    {"_mets_tildeLambda1", (DL_FUNC) &_mets_tildeLambda1, 6},
    {"_mets_tildeLambda1R", (DL_FUNC) &_mets_tildeLambda1R, 7},
    {"_mets_logl_weibull", (DL_FUNC) &_mets_logl_weibull, 6},
    {"_mets_score_weibull", (DL_FUNC) &_mets_score_weibull, 7},
    {"_mets_RcppExport_registerCCallable", (DL_FUNC) &_mets_RcppExport_registerCCallable, 0},
    {"biprobit0",                (DL_FUNC) &biprobit0,                 8},
    {"biprobit2",                (DL_FUNC) &biprobit2,                10},
    {"bvncdf",                   (DL_FUNC) &bvncdf,                    3},
    {"claytonoakes",             (DL_FUNC) &claytonoakes,              9},
    {"claytonoakesbinRV",        (DL_FUNC) &claytonoakesbinRV,        10},
    {"clusterindexdata",         (DL_FUNC) &clusterindexdata,          4},
    {"clusterindexM",            (DL_FUNC) &clusterindexM,             5},
    {"cor",                      (DL_FUNC) &cor,                      40},
    {"covrfR",                   (DL_FUNC) &covrfR,                    4},
    {"covrfstrataCovR",          (DL_FUNC) &covrfstrataCovR,           8},
    {"covrfstrataR",             (DL_FUNC) &covrfstrataR,              6},
    {"CubeMat",                  (DL_FUNC) &CubeMat,                   2},
    {"CubeMattime",              (DL_FUNC) &CubeMattime,               9},
    {"CubeVec",                  (DL_FUNC) &CubeVec,                   3},
    {"cumsum2strataR",           (DL_FUNC) &cumsum2strataR,            7},
    {"cumsumidstratasumCovR",    (DL_FUNC) &cumsumidstratasumCovR,     6},
    {"cumsumidstratasumR",       (DL_FUNC) &cumsumidstratasumR,        5},
    {"cumsumstrataPOR",          (DL_FUNC) &cumsumstrataPOR,           6},
    {"cumsumstrataR",            (DL_FUNC) &cumsumstrataR,             3},
    {"diffstrataR",              (DL_FUNC) &diffstrataR,               3},
    {"DLambetaR",                (DL_FUNC) &DLambetaR,                 8},
    {"familypairindex",          (DL_FUNC) &familypairindex,           3},
    {"FastApprox",               (DL_FUNC) &FastApprox,                4},
    {"FastCoxPLstrata",          (DL_FUNC) &FastCoxPLstrata,          11},
    {"FastCoxPLstrataAddGam",    (DL_FUNC) &FastCoxPLstrataAddGam,    18},
    {"FastCoxPLstrataPO",        (DL_FUNC) &FastCoxPLstrataPO,        11},
    {"FastCoxPrepStrata",        (DL_FUNC) &FastCoxPrepStrata,        11},
    {"FastLong2",                (DL_FUNC) &FastLong2,                 4},
    {"FastPattern",              (DL_FUNC) &FastPattern,               3},
    {"headstrataR",              (DL_FUNC) &headstrataR,               3},
    {"indexstrataR",             (DL_FUNC) &indexstrataR,              5},
    {"Matdoubleindex",           (DL_FUNC) &Matdoubleindex,            6},
    {"McumsumstrataR",           (DL_FUNC) &McumsumstrataR,            4},
    {"ModelMatrixTestCox",       (DL_FUNC) &ModelMatrixTestCox,        5},
    {"MsumstrataR",              (DL_FUNC) &MsumstrataR,               3},
    {"pBhat",                    (DL_FUNC) &pBhat,                     6},
    {"pmvn0",                    (DL_FUNC) &pmvn0,                     5},
    {"PropTestCox",              (DL_FUNC) &PropTestCox,               4},
    {"PropTestCoxClust",         (DL_FUNC) &PropTestCoxClust,         14},
    {"revcumsum2stratafdNR",     (DL_FUNC) &revcumsum2stratafdNR,      7},
    {"revcumsum2strataR",        (DL_FUNC) &revcumsum2strataR,         5},
    {"revcumsumidstratasumCovR", (DL_FUNC) &revcumsumidstratasumCovR,  6},
    {"revcumsumidstratasumR",    (DL_FUNC) &revcumsumidstratasumR,     5},
    {"revcumsumR",               (DL_FUNC) &revcumsumR,                1},
    {"revcumsumstrataR",         (DL_FUNC) &revcumsumstrataR,          3},
    {"revcumsumstratasumR",      (DL_FUNC) &revcumsumstratasumR,       3},
    {"sumstrataR",               (DL_FUNC) &sumstrataR,                3},
    {"tailstrataR",              (DL_FUNC) &tailstrataR,               3},
    {"twostageloglikebin",       (DL_FUNC) &twostageloglikebin,       21},
    {"twostageloglikebinpairs",  (DL_FUNC) &twostageloglikebinpairs,  22},
    {"twostageloglikeRV",        (DL_FUNC) &twostageloglikeRV,        19},
    {"twostageloglikeRVpairs",   (DL_FUNC) &twostageloglikeRVpairs,   19},
    {"Uhat",                     (DL_FUNC) &Uhat,                      5},
    {"uniprobit",                (DL_FUNC) &uniprobit,                 8},
    {"vecAllStrataR",            (DL_FUNC) &vecAllStrataR,             3},
    {"vecCPMat",                 (DL_FUNC) &vecCPMat,                  1},
    {"vecMatMat",                (DL_FUNC) &vecMatMat,                 2},
    {"wherestrataR",             (DL_FUNC) &wherestrataR,              4},
    {"XXMatFULL",                (DL_FUNC) &XXMatFULL,                 2},
    {NULL, NULL, 0}
};

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