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

#ifndef RCPP_smam_RCPPEXPORTS_H_GEN_
#define RCPP_smam_RCPPEXPORTS_H_GEN_

#include <RcppGSL.h>
#include <Rcpp.h>

namespace smam {

    using namespace Rcpp;

    namespace {
        void validateSignature(const char* sig) {
            Rcpp::Function require = Rcpp::Environment::base_env()["require"];
            require("smam", Rcpp::Named("quietly") = true);
            typedef int(*Ptr_validate)(const char*);
            static Ptr_validate p_validate = (Ptr_validate)
                R_GetCCallable("smam", "_smam_RcppExport_validate");
            if (!p_validate(sig)) {
                throw Rcpp::function_not_exported(
                    "C++ function with signature '" + std::string(sig) + "' not found in smam");
            }
        }
    }

    inline double norm_mrme(double z, double b, double d, NumericVector integrControl) {
        typedef SEXP(*Ptr_norm_mrme)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_norm_mrme p_norm_mrme = NULL;
        if (p_norm_mrme == NULL) {
            validateSignature("double(*norm_mrme)(double,double,double,NumericVector)");
            p_norm_mrme = (Ptr_norm_mrme)R_GetCCallable("smam", "_smam_norm_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_norm_mrme(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(b)), Shield<SEXP>(Rcpp::wrap(d)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector g10_mrme(NumericMatrix z, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_g10_mrme)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_g10_mrme p_g10_mrme = NULL;
        if (p_g10_mrme == NULL) {
            validateSignature("NumericVector(*g10_mrme)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_g10_mrme = (Ptr_g10_mrme)R_GetCCallable("smam", "_smam_g10_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g10_mrme(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector g01_mrme(NumericMatrix z, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_g01_mrme)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_g01_mrme p_g01_mrme = NULL;
        if (p_g01_mrme == NULL) {
            validateSignature("NumericVector(*g01_mrme)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_g01_mrme = (Ptr_g01_mrme)R_GetCCallable("smam", "_smam_g01_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g01_mrme(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector g00_mrme(NumericMatrix z, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_g00_mrme)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_g00_mrme p_g00_mrme = NULL;
        if (p_g00_mrme == NULL) {
            validateSignature("NumericVector(*g00_mrme)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_g00_mrme = (Ptr_g00_mrme)R_GetCCallable("smam", "_smam_g00_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g00_mrme(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector g11_mrme(NumericMatrix z, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_g11_mrme)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_g11_mrme p_g11_mrme = NULL;
        if (p_g11_mrme == NULL) {
            validateSignature("NumericVector(*g11_mrme)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_g11_mrme = (Ptr_g11_mrme)R_GetCCallable("smam", "_smam_g11_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g11_mrme(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector t11_mrme(NumericVector t, NumericVector theta) {
        typedef SEXP(*Ptr_t11_mrme)(SEXP,SEXP);
        static Ptr_t11_mrme p_t11_mrme = NULL;
        if (p_t11_mrme == NULL) {
            validateSignature("NumericVector(*t11_mrme)(NumericVector,NumericVector)");
            p_t11_mrme = (Ptr_t11_mrme)R_GetCCallable("smam", "_smam_t11_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_t11_mrme(Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector t00_mrme(NumericVector t, NumericVector theta) {
        typedef SEXP(*Ptr_t00_mrme)(SEXP,SEXP);
        static Ptr_t00_mrme p_t00_mrme = NULL;
        if (p_t00_mrme == NULL) {
            validateSignature("NumericVector(*t00_mrme)(NumericVector,NumericVector)");
            p_t00_mrme = (Ptr_t00_mrme)R_GetCCallable("smam", "_smam_t00_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_t00_mrme(Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector t10_mrme(NumericVector t, NumericVector theta) {
        typedef SEXP(*Ptr_t10_mrme)(SEXP,SEXP);
        static Ptr_t10_mrme p_t10_mrme = NULL;
        if (p_t10_mrme == NULL) {
            validateSignature("NumericVector(*t10_mrme)(NumericVector,NumericVector)");
            p_t10_mrme = (Ptr_t10_mrme)R_GetCCallable("smam", "_smam_t10_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_t10_mrme(Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector t01_mrme(NumericVector t, NumericVector theta) {
        typedef SEXP(*Ptr_t01_mrme)(SEXP,SEXP);
        static Ptr_t01_mrme p_t01_mrme = NULL;
        if (p_t01_mrme == NULL) {
            validateSignature("NumericVector(*t01_mrme)(NumericVector,NumericVector)");
            p_t01_mrme = (Ptr_t01_mrme)R_GetCCallable("smam", "_smam_t01_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_t01_mrme(Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double nllk_mrme(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_mrme)(SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme p_nllk_mrme = NULL;
        if (p_nllk_mrme == NULL) {
            validateSignature("double(*nllk_mrme)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_nllk_mrme = (Ptr_nllk_mrme)R_GetCCallable("smam", "_smam_nllk_mrme");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_naive_cmp(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_mrme_naive_cmp)(SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_naive_cmp p_nllk_mrme_naive_cmp = NULL;
        if (p_nllk_mrme_naive_cmp == NULL) {
            validateSignature("double(*nllk_mrme_naive_cmp)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_nllk_mrme_naive_cmp = (Ptr_nllk_mrme_naive_cmp)R_GetCCallable("smam", "_smam_nllk_mrme_naive_cmp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_naive_cmp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_fixed_sig_err(NumericVector& theta, double sig_err, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_mrme_fixed_sig_err)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_fixed_sig_err p_nllk_mrme_fixed_sig_err = NULL;
        if (p_nllk_mrme_fixed_sig_err == NULL) {
            validateSignature("double(*nllk_mrme_fixed_sig_err)(NumericVector&,double,NumericMatrix&,NumericVector&)");
            p_nllk_mrme_fixed_sig_err = (Ptr_nllk_mrme_fixed_sig_err)R_GetCCallable("smam", "_smam_nllk_mrme_fixed_sig_err");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_fixed_sig_err(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(sig_err)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_one_chain(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_mrme_one_chain)(SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_one_chain p_nllk_mrme_one_chain = NULL;
        if (p_nllk_mrme_one_chain == NULL) {
            validateSignature("double(*nllk_mrme_one_chain)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_nllk_mrme_one_chain = (Ptr_nllk_mrme_one_chain)R_GetCCallable("smam", "_smam_nllk_mrme_one_chain");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_one_chain(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_one_chain_fixed_sig_err(NumericVector& theta, double sig_err, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_mrme_one_chain_fixed_sig_err)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_one_chain_fixed_sig_err p_nllk_mrme_one_chain_fixed_sig_err = NULL;
        if (p_nllk_mrme_one_chain_fixed_sig_err == NULL) {
            validateSignature("double(*nllk_mrme_one_chain_fixed_sig_err)(NumericVector&,double,NumericMatrix&,NumericVector&)");
            p_nllk_mrme_one_chain_fixed_sig_err = (Ptr_nllk_mrme_one_chain_fixed_sig_err)R_GetCCallable("smam", "_smam_nllk_mrme_one_chain_fixed_sig_err");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_one_chain_fixed_sig_err(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(sig_err)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q10_mrme_approx(NumericVector z, double t, NumericVector theta, NumericVector integrControl, NumericVector err_start, NumericVector err_end, NumericVector err_end_prob) {
        typedef SEXP(*Ptr_q10_mrme_approx)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q10_mrme_approx p_q10_mrme_approx = NULL;
        if (p_q10_mrme_approx == NULL) {
            validateSignature("double(*q10_mrme_approx)(NumericVector,double,NumericVector,NumericVector,NumericVector,NumericVector,NumericVector)");
            p_q10_mrme_approx = (Ptr_q10_mrme_approx)R_GetCCallable("smam", "_smam_q10_mrme_approx");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q10_mrme_approx(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q01_mrme_approx(NumericVector z, double t, NumericVector theta, NumericVector integrControl, NumericVector err_start, NumericVector err_end, NumericVector err_end_prob) {
        typedef SEXP(*Ptr_q01_mrme_approx)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q01_mrme_approx p_q01_mrme_approx = NULL;
        if (p_q01_mrme_approx == NULL) {
            validateSignature("double(*q01_mrme_approx)(NumericVector,double,NumericVector,NumericVector,NumericVector,NumericVector,NumericVector)");
            p_q01_mrme_approx = (Ptr_q01_mrme_approx)R_GetCCallable("smam", "_smam_q01_mrme_approx");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q01_mrme_approx(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q00_mrme_approx(NumericVector z, double t, NumericVector theta, NumericVector integrControl, NumericVector err_start, NumericVector err_end, NumericVector err_end_prob) {
        typedef SEXP(*Ptr_q00_mrme_approx)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q00_mrme_approx p_q00_mrme_approx = NULL;
        if (p_q00_mrme_approx == NULL) {
            validateSignature("double(*q00_mrme_approx)(NumericVector,double,NumericVector,NumericVector,NumericVector,NumericVector,NumericVector)");
            p_q00_mrme_approx = (Ptr_q00_mrme_approx)R_GetCCallable("smam", "_smam_q00_mrme_approx");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q00_mrme_approx(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q11_mrme_approx(NumericVector z, double t, NumericVector theta, NumericVector integrControl, NumericVector err_start, NumericVector err_end, NumericVector err_end_prob) {
        typedef SEXP(*Ptr_q11_mrme_approx)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q11_mrme_approx p_q11_mrme_approx = NULL;
        if (p_q11_mrme_approx == NULL) {
            validateSignature("double(*q11_mrme_approx)(NumericVector,double,NumericVector,NumericVector,NumericVector,NumericVector,NumericVector)");
            p_q11_mrme_approx = (Ptr_q11_mrme_approx)R_GetCCallable("smam", "_smam_q11_mrme_approx");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q11_mrme_approx(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_approx(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, NumericMatrix& approx_norm_even, NumericMatrix& approx_norm_odd) {
        typedef SEXP(*Ptr_nllk_mrme_approx)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_approx p_nllk_mrme_approx = NULL;
        if (p_nllk_mrme_approx == NULL) {
            validateSignature("double(*nllk_mrme_approx)(NumericVector&,NumericMatrix&,NumericVector&,NumericMatrix&,NumericMatrix&)");
            p_nllk_mrme_approx = (Ptr_nllk_mrme_approx)R_GetCCallable("smam", "_smam_nllk_mrme_approx");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_approx(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(approx_norm_even)), Shield<SEXP>(Rcpp::wrap(approx_norm_odd)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q10_mrme_approx_1dim(double z, double t, NumericVector theta, NumericVector integrControl, double err_start, double err_end, double err_end_prob) {
        typedef SEXP(*Ptr_q10_mrme_approx_1dim)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q10_mrme_approx_1dim p_q10_mrme_approx_1dim = NULL;
        if (p_q10_mrme_approx_1dim == NULL) {
            validateSignature("double(*q10_mrme_approx_1dim)(double,double,NumericVector,NumericVector,double,double,double)");
            p_q10_mrme_approx_1dim = (Ptr_q10_mrme_approx_1dim)R_GetCCallable("smam", "_smam_q10_mrme_approx_1dim");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q10_mrme_approx_1dim(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q01_mrme_approx_1dim(double z, double t, NumericVector theta, NumericVector integrControl, double err_start, double err_end, double err_end_prob) {
        typedef SEXP(*Ptr_q01_mrme_approx_1dim)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q01_mrme_approx_1dim p_q01_mrme_approx_1dim = NULL;
        if (p_q01_mrme_approx_1dim == NULL) {
            validateSignature("double(*q01_mrme_approx_1dim)(double,double,NumericVector,NumericVector,double,double,double)");
            p_q01_mrme_approx_1dim = (Ptr_q01_mrme_approx_1dim)R_GetCCallable("smam", "_smam_q01_mrme_approx_1dim");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q01_mrme_approx_1dim(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q00_mrme_approx_1dim(double z, double t, NumericVector theta, NumericVector integrControl, double err_start, double err_end, double err_end_prob) {
        typedef SEXP(*Ptr_q00_mrme_approx_1dim)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q00_mrme_approx_1dim p_q00_mrme_approx_1dim = NULL;
        if (p_q00_mrme_approx_1dim == NULL) {
            validateSignature("double(*q00_mrme_approx_1dim)(double,double,NumericVector,NumericVector,double,double,double)");
            p_q00_mrme_approx_1dim = (Ptr_q00_mrme_approx_1dim)R_GetCCallable("smam", "_smam_q00_mrme_approx_1dim");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q00_mrme_approx_1dim(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double q11_mrme_approx_1dim(double z, double t, NumericVector theta, NumericVector integrControl, double err_start, double err_end, double err_end_prob) {
        typedef SEXP(*Ptr_q11_mrme_approx_1dim)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_q11_mrme_approx_1dim p_q11_mrme_approx_1dim = NULL;
        if (p_q11_mrme_approx_1dim == NULL) {
            validateSignature("double(*q11_mrme_approx_1dim)(double,double,NumericVector,NumericVector,double,double,double)");
            p_q11_mrme_approx_1dim = (Ptr_q11_mrme_approx_1dim)R_GetCCallable("smam", "_smam_q11_mrme_approx_1dim");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_q11_mrme_approx_1dim(Shield<SEXP>(Rcpp::wrap(z)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(err_start)), Shield<SEXP>(Rcpp::wrap(err_end)), Shield<SEXP>(Rcpp::wrap(err_end_prob)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_mrme_approx_1dim(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, NumericMatrix& approx_norm_even, NumericMatrix& approx_norm_odd) {
        typedef SEXP(*Ptr_nllk_mrme_approx_1dim)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_mrme_approx_1dim p_nllk_mrme_approx_1dim = NULL;
        if (p_nllk_mrme_approx_1dim == NULL) {
            validateSignature("double(*nllk_mrme_approx_1dim)(NumericVector&,NumericMatrix&,NumericVector&,NumericMatrix&,NumericMatrix&)");
            p_nllk_mrme_approx_1dim = (Ptr_nllk_mrme_approx_1dim)R_GetCCallable("smam", "_smam_nllk_mrme_approx_1dim");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_mrme_approx_1dim(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(approx_norm_even)), Shield<SEXP>(Rcpp::wrap(approx_norm_odd)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector vp11(NumericVector vw, double t, double lambda1, double lambda0) {
        typedef SEXP(*Ptr_vp11)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_vp11 p_vp11 = NULL;
        if (p_vp11 == NULL) {
            validateSignature("NumericVector(*vp11)(NumericVector,double,double,double)");
            p_vp11 = (Ptr_vp11)R_GetCCallable("smam", "_smam_vp11");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_vp11(Shield<SEXP>(Rcpp::wrap(vw)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda0)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector vp10(NumericVector vw, double t, double lambda1, double lambda0) {
        typedef SEXP(*Ptr_vp10)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_vp10 p_vp10 = NULL;
        if (p_vp10 == NULL) {
            validateSignature("NumericVector(*vp10)(NumericVector,double,double,double)");
            p_vp10 = (Ptr_vp10)R_GetCCallable("smam", "_smam_vp10");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_vp10(Shield<SEXP>(Rcpp::wrap(vw)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda0)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector vp00(NumericVector vw, double t, double lambda1, double lambda0) {
        typedef SEXP(*Ptr_vp00)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_vp00 p_vp00 = NULL;
        if (p_vp00 == NULL) {
            validateSignature("NumericVector(*vp00)(NumericVector,double,double,double)");
            p_vp00 = (Ptr_vp00)R_GetCCallable("smam", "_smam_vp00");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_vp00(Shield<SEXP>(Rcpp::wrap(vw)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda0)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector vp01(NumericVector vw, double t, double lambda1, double lambda0) {
        typedef SEXP(*Ptr_vp01)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_vp01 p_vp01 = NULL;
        if (p_vp01 == NULL) {
            validateSignature("NumericVector(*vp01)(NumericVector,double,double,double)");
            p_vp01 = (Ptr_vp01)R_GetCCallable("smam", "_smam_vp01");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_vp01(Shield<SEXP>(Rcpp::wrap(vw)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda0)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector h11(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_h11)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_h11 p_h11 = NULL;
        if (p_h11 == NULL) {
            validateSignature("NumericVector(*h11)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_h11 = (Ptr_h11)R_GetCCallable("smam", "_smam_h11");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_h11(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector h10(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_h10)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_h10 p_h10 = NULL;
        if (p_h10 == NULL) {
            validateSignature("NumericVector(*h10)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_h10 = (Ptr_h10)R_GetCCallable("smam", "_smam_h10");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_h10(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector h00(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_h00)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_h00 p_h00 = NULL;
        if (p_h00 == NULL) {
            validateSignature("NumericVector(*h00)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_h00 = (Ptr_h00)R_GetCCallable("smam", "_smam_h00");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_h00(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector h01(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_h01)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_h01 p_h01 = NULL;
        if (p_h01 == NULL) {
            validateSignature("NumericVector(*h01)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_h01 = (Ptr_h01)R_GetCCallable("smam", "_smam_h01");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_h01(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double ncllk_m1_inc(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, LogicalVector& logtr) {
        typedef SEXP(*Ptr_ncllk_m1_inc)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ncllk_m1_inc p_ncllk_m1_inc = NULL;
        if (p_ncllk_m1_inc == NULL) {
            validateSignature("double(*ncllk_m1_inc)(NumericVector&,NumericMatrix&,NumericVector&,LogicalVector&)");
            p_ncllk_m1_inc = (Ptr_ncllk_m1_inc)R_GetCCallable("smam", "_smam_ncllk_m1_inc");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ncllk_m1_inc(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(logtr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_inc(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, LogicalVector& logtr) {
        typedef SEXP(*Ptr_nllk_inc)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_inc p_nllk_inc = NULL;
        if (p_nllk_inc == NULL) {
            validateSignature("double(*nllk_inc)(NumericVector&,NumericMatrix&,NumericVector&,LogicalVector&)");
            p_nllk_inc = (Ptr_nllk_inc)R_GetCCallable("smam", "_smam_nllk_inc");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_inc(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(logtr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericMatrix fwd_bwd_mr(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_fwd_bwd_mr)(SEXP,SEXP,SEXP);
        static Ptr_fwd_bwd_mr p_fwd_bwd_mr = NULL;
        if (p_fwd_bwd_mr == NULL) {
            validateSignature("NumericMatrix(*fwd_bwd_mr)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_fwd_bwd_mr = (Ptr_fwd_bwd_mr)R_GetCCallable("smam", "_smam_fwd_bwd_mr");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fwd_bwd_mr(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericMatrix viterbi_mr(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_viterbi_mr)(SEXP,SEXP,SEXP);
        static Ptr_viterbi_mr p_viterbi_mr = NULL;
        if (p_viterbi_mr == NULL) {
            validateSignature("NumericMatrix(*viterbi_mr)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_viterbi_mr = (Ptr_viterbi_mr)R_GetCCallable("smam", "_smam_viterbi_mr");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_viterbi_mr(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericMatrix partial_viterbi_mr(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, int& startpoint, int& pathlength) {
        typedef SEXP(*Ptr_partial_viterbi_mr)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_partial_viterbi_mr p_partial_viterbi_mr = NULL;
        if (p_partial_viterbi_mr == NULL) {
            validateSignature("NumericMatrix(*partial_viterbi_mr)(NumericVector&,NumericMatrix&,NumericVector&,int&,int&)");
            p_partial_viterbi_mr = (Ptr_partial_viterbi_mr)R_GetCCallable("smam", "_smam_partial_viterbi_mr");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_partial_viterbi_mr(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(startpoint)), Shield<SEXP>(Rcpp::wrap(pathlength)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline double mrllk_state(NumericVector& theta, NumericMatrix& data, IntegerVector& state, NumericVector& integrControl) {
        typedef SEXP(*Ptr_mrllk_state)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_mrllk_state p_mrllk_state = NULL;
        if (p_mrllk_state == NULL) {
            validateSignature("double(*mrllk_state)(NumericVector&,NumericMatrix&,IntegerVector&,NumericVector&)");
            p_mrllk_state = (Ptr_mrllk_state)R_GetCCallable("smam", "_smam_mrllk_state");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_mrllk_state(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(state)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericMatrix fwd_bwd_ths(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_fwd_bwd_ths)(SEXP,SEXP,SEXP);
        static Ptr_fwd_bwd_ths p_fwd_bwd_ths = NULL;
        if (p_fwd_bwd_ths == NULL) {
            validateSignature("NumericMatrix(*fwd_bwd_ths)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_fwd_bwd_ths = (Ptr_fwd_bwd_ths)R_GetCCallable("smam", "_smam_fwd_bwd_ths");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fwd_bwd_ths(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericMatrix viterbi_ths(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_viterbi_ths)(SEXP,SEXP,SEXP);
        static Ptr_viterbi_ths p_viterbi_ths = NULL;
        if (p_viterbi_ths == NULL) {
            validateSignature("NumericMatrix(*viterbi_ths)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_viterbi_ths = (Ptr_viterbi_ths)R_GetCCallable("smam", "_smam_viterbi_ths");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_viterbi_ths(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericMatrix partial_viterbi_ths(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, int& startpoint, int& pathlength) {
        typedef SEXP(*Ptr_partial_viterbi_ths)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_partial_viterbi_ths p_partial_viterbi_ths = NULL;
        if (p_partial_viterbi_ths == NULL) {
            validateSignature("NumericMatrix(*partial_viterbi_ths)(NumericVector&,NumericMatrix&,NumericVector&,int&,int&)");
            p_partial_viterbi_ths = (Ptr_partial_viterbi_ths)R_GetCCallable("smam", "_smam_partial_viterbi_ths");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_partial_viterbi_ths(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(startpoint)), Shield<SEXP>(Rcpp::wrap(pathlength)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericVector ths_vp00(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp00)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp00 p_ths_vp00 = NULL;
        if (p_ths_vp00 == NULL) {
            validateSignature("NumericVector(*ths_vp00)(NumericVector,double,double,double,double,double)");
            p_ths_vp00 = (Ptr_ths_vp00)R_GetCCallable("smam", "_smam_ths_vp00");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp00(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp01(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp01)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp01 p_ths_vp01 = NULL;
        if (p_ths_vp01 == NULL) {
            validateSignature("NumericVector(*ths_vp01)(NumericVector,double,double,double,double,double)");
            p_ths_vp01 = (Ptr_ths_vp01)R_GetCCallable("smam", "_smam_ths_vp01");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp01(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp02(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp02)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp02 p_ths_vp02 = NULL;
        if (p_ths_vp02 == NULL) {
            validateSignature("NumericVector(*ths_vp02)(NumericVector,double,double,double,double,double)");
            p_ths_vp02 = (Ptr_ths_vp02)R_GetCCallable("smam", "_smam_ths_vp02");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp02(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp10(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp10)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp10 p_ths_vp10 = NULL;
        if (p_ths_vp10 == NULL) {
            validateSignature("NumericVector(*ths_vp10)(NumericVector,double,double,double,double,double)");
            p_ths_vp10 = (Ptr_ths_vp10)R_GetCCallable("smam", "_smam_ths_vp10");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp10(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp11(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp11)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp11 p_ths_vp11 = NULL;
        if (p_ths_vp11 == NULL) {
            validateSignature("NumericVector(*ths_vp11)(NumericVector,double,double,double,double,double)");
            p_ths_vp11 = (Ptr_ths_vp11)R_GetCCallable("smam", "_smam_ths_vp11");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp11(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp12(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp12)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp12 p_ths_vp12 = NULL;
        if (p_ths_vp12 == NULL) {
            validateSignature("NumericVector(*ths_vp12)(NumericVector,double,double,double,double,double)");
            p_ths_vp12 = (Ptr_ths_vp12)R_GetCCallable("smam", "_smam_ths_vp12");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp12(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp20(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp20)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp20 p_ths_vp20 = NULL;
        if (p_ths_vp20 == NULL) {
            validateSignature("NumericVector(*ths_vp20)(NumericVector,double,double,double,double,double)");
            p_ths_vp20 = (Ptr_ths_vp20)R_GetCCallable("smam", "_smam_ths_vp20");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp20(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp21(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp21)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp21 p_ths_vp21 = NULL;
        if (p_ths_vp21 == NULL) {
            validateSignature("NumericVector(*ths_vp21)(NumericVector,double,double,double,double,double)");
            p_ths_vp21 = (Ptr_ths_vp21)R_GetCCallable("smam", "_smam_ths_vp21");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp21(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_vp22(NumericVector vs, double t, double lambda0, double lambda1, double lambda2, double p) {
        typedef SEXP(*Ptr_ths_vp22)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_vp22 p_ths_vp22 = NULL;
        if (p_ths_vp22 == NULL) {
            validateSignature("NumericVector(*ths_vp22)(NumericVector,double,double,double,double,double)");
            p_ths_vp22 = (Ptr_ths_vp22)R_GetCCallable("smam", "_smam_ths_vp22");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_vp22(Shield<SEXP>(Rcpp::wrap(vs)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(lambda0)), Shield<SEXP>(Rcpp::wrap(lambda1)), Shield<SEXP>(Rcpp::wrap(lambda2)), Shield<SEXP>(Rcpp::wrap(p)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h00(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h00)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h00 p_ths_h00 = NULL;
        if (p_ths_h00 == NULL) {
            validateSignature("NumericVector(*ths_h00)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h00 = (Ptr_ths_h00)R_GetCCallable("smam", "_smam_ths_h00");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h00(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h01(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h01)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h01 p_ths_h01 = NULL;
        if (p_ths_h01 == NULL) {
            validateSignature("NumericVector(*ths_h01)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h01 = (Ptr_ths_h01)R_GetCCallable("smam", "_smam_ths_h01");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h01(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h02(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h02)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h02 p_ths_h02 = NULL;
        if (p_ths_h02 == NULL) {
            validateSignature("NumericVector(*ths_h02)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h02 = (Ptr_ths_h02)R_GetCCallable("smam", "_smam_ths_h02");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h02(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h10(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h10)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h10 p_ths_h10 = NULL;
        if (p_ths_h10 == NULL) {
            validateSignature("NumericVector(*ths_h10)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h10 = (Ptr_ths_h10)R_GetCCallable("smam", "_smam_ths_h10");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h10(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h11(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h11)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h11 p_ths_h11 = NULL;
        if (p_ths_h11 == NULL) {
            validateSignature("NumericVector(*ths_h11)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h11 = (Ptr_ths_h11)R_GetCCallable("smam", "_smam_ths_h11");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h11(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h12(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h12)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h12 p_ths_h12 = NULL;
        if (p_ths_h12 == NULL) {
            validateSignature("NumericVector(*ths_h12)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h12 = (Ptr_ths_h12)R_GetCCallable("smam", "_smam_ths_h12");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h12(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h20(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h20)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h20 p_ths_h20 = NULL;
        if (p_ths_h20 == NULL) {
            validateSignature("NumericVector(*ths_h20)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h20 = (Ptr_ths_h20)R_GetCCallable("smam", "_smam_ths_h20");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h20(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h21(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h21)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h21 p_ths_h21 = NULL;
        if (p_ths_h21 == NULL) {
            validateSignature("NumericVector(*ths_h21)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h21 = (Ptr_ths_h21)R_GetCCallable("smam", "_smam_ths_h21");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h21(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h22(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl) {
        typedef SEXP(*Ptr_ths_h22)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h22 p_ths_h22 = NULL;
        if (p_ths_h22 == NULL) {
            validateSignature("NumericVector(*ths_h22)(NumericMatrix,NumericVector,NumericVector,NumericVector)");
            p_ths_h22 = (Ptr_ths_h22)R_GetCCallable("smam", "_smam_ths_h22");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h22(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h00_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h00_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h00_paral p_ths_h00_paral = NULL;
        if (p_ths_h00_paral == NULL) {
            validateSignature("NumericVector(*ths_h00_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h00_paral = (Ptr_ths_h00_paral)R_GetCCallable("smam", "_smam_ths_h00_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h00_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h01_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h01_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h01_paral p_ths_h01_paral = NULL;
        if (p_ths_h01_paral == NULL) {
            validateSignature("NumericVector(*ths_h01_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h01_paral = (Ptr_ths_h01_paral)R_GetCCallable("smam", "_smam_ths_h01_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h01_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h02_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h02_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h02_paral p_ths_h02_paral = NULL;
        if (p_ths_h02_paral == NULL) {
            validateSignature("NumericVector(*ths_h02_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h02_paral = (Ptr_ths_h02_paral)R_GetCCallable("smam", "_smam_ths_h02_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h02_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h10_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h10_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h10_paral p_ths_h10_paral = NULL;
        if (p_ths_h10_paral == NULL) {
            validateSignature("NumericVector(*ths_h10_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h10_paral = (Ptr_ths_h10_paral)R_GetCCallable("smam", "_smam_ths_h10_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h10_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h11_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h11_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h11_paral p_ths_h11_paral = NULL;
        if (p_ths_h11_paral == NULL) {
            validateSignature("NumericVector(*ths_h11_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h11_paral = (Ptr_ths_h11_paral)R_GetCCallable("smam", "_smam_ths_h11_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h11_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h12_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h12_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h12_paral p_ths_h12_paral = NULL;
        if (p_ths_h12_paral == NULL) {
            validateSignature("NumericVector(*ths_h12_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h12_paral = (Ptr_ths_h12_paral)R_GetCCallable("smam", "_smam_ths_h12_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h12_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h20_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h20_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h20_paral p_ths_h20_paral = NULL;
        if (p_ths_h20_paral == NULL) {
            validateSignature("NumericVector(*ths_h20_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h20_paral = (Ptr_ths_h20_paral)R_GetCCallable("smam", "_smam_ths_h20_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h20_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h21_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h21_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h21_paral p_ths_h21_paral = NULL;
        if (p_ths_h21_paral == NULL) {
            validateSignature("NumericVector(*ths_h21_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h21_paral = (Ptr_ths_h21_paral)R_GetCCallable("smam", "_smam_ths_h21_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h21_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector ths_h22_paral(NumericMatrix x, NumericVector t, NumericVector theta, NumericVector integrControl, int grainSize) {
        typedef SEXP(*Ptr_ths_h22_paral)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ths_h22_paral p_ths_h22_paral = NULL;
        if (p_ths_h22_paral == NULL) {
            validateSignature("NumericVector(*ths_h22_paral)(NumericMatrix,NumericVector,NumericVector,NumericVector,int)");
            p_ths_h22_paral = (Ptr_ths_h22_paral)R_GetCCallable("smam", "_smam_ths_h22_paral");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ths_h22_paral(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericMatrix con_v_m(NumericVector x) {
        typedef SEXP(*Ptr_con_v_m)(SEXP);
        static Ptr_con_v_m p_con_v_m = NULL;
        if (p_con_v_m == NULL) {
            validateSignature("NumericMatrix(*con_v_m)(NumericVector)");
            p_con_v_m = (Ptr_con_v_m)R_GetCCallable("smam", "_smam_con_v_m");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_con_v_m(Shield<SEXP>(Rcpp::wrap(x)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericVector con_n_v(double x) {
        typedef SEXP(*Ptr_con_n_v)(SEXP);
        static Ptr_con_n_v p_con_n_v = NULL;
        if (p_con_n_v == NULL) {
            validateSignature("NumericVector(*con_n_v)(double)");
            p_con_n_v = (Ptr_con_n_v)R_GetCCallable("smam", "_smam_con_n_v");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_con_n_v(Shield<SEXP>(Rcpp::wrap(x)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double nllk_fwd_ths(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl) {
        typedef SEXP(*Ptr_nllk_fwd_ths)(SEXP,SEXP,SEXP);
        static Ptr_nllk_fwd_ths p_nllk_fwd_ths = NULL;
        if (p_nllk_fwd_ths == NULL) {
            validateSignature("double(*nllk_fwd_ths)(NumericVector&,NumericMatrix&,NumericVector&)");
            p_nllk_fwd_ths = (Ptr_nllk_fwd_ths)R_GetCCallable("smam", "_smam_nllk_fwd_ths");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_fwd_ths(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double nllk_fwd_ths_parallel(NumericVector& theta, NumericMatrix& data, NumericVector& integrControl, int grainSize) {
        typedef SEXP(*Ptr_nllk_fwd_ths_parallel)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_nllk_fwd_ths_parallel p_nllk_fwd_ths_parallel = NULL;
        if (p_nllk_fwd_ths_parallel == NULL) {
            validateSignature("double(*nllk_fwd_ths_parallel)(NumericVector&,NumericMatrix&,NumericVector&,int)");
            p_nllk_fwd_ths_parallel = (Ptr_nllk_fwd_ths_parallel)R_GetCCallable("smam", "_smam_nllk_fwd_ths_parallel");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nllk_fwd_ths_parallel(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(data)), Shield<SEXP>(Rcpp::wrap(integrControl)), Shield<SEXP>(Rcpp::wrap(grainSize)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

}

#endif // RCPP_smam_RCPPEXPORTS_H_GEN_
