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

#ifndef RCPP_targeted_RCPPEXPORTS_H_GEN_
#define RCPP_targeted_RCPPEXPORTS_H_GEN_

#include "targeted_types.h"
#include <RcppArmadillo.h>
#include <Rcpp.h>

namespace targeted {

    using namespace Rcpp;

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

    inline Rcpp::List _NB(arma::vec y, arma::vec x, arma::uvec xlev, arma::vec ylev, arma::vec weights, double laplacesmooth = 1.0) {
        typedef SEXP(*Ptr__NB)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr__NB p__NB = NULL;
        if (p__NB == NULL) {
            validateSignature("Rcpp::List(*_NB)(arma::vec,arma::vec,arma::uvec,arma::vec,arma::vec,double)");
            p__NB = (Ptr__NB)R_GetCCallable("targeted", "_targeted__NB");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__NB(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(xlev)), Shield<SEXP>(Rcpp::wrap(ylev)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(laplacesmooth)));
        }
        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<Rcpp::List >(rcpp_result_gen);
    }

    inline arma::mat _ode_solve(odeptr_t f, arma::mat input, arma::mat init, arma::mat par) {
        typedef SEXP(*Ptr__ode_solve)(SEXP,SEXP,SEXP,SEXP);
        static Ptr__ode_solve p__ode_solve = NULL;
        if (p__ode_solve == NULL) {
            validateSignature("arma::mat(*_ode_solve)(odeptr_t,arma::mat,arma::mat,arma::mat)");
            p__ode_solve = (Ptr__ode_solve)R_GetCCallable("targeted", "_targeted__ode_solve");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__ode_solve(Shield<SEXP>(Rcpp::wrap(f)), Shield<SEXP>(Rcpp::wrap(input)), Shield<SEXP>(Rcpp::wrap(init)), Shield<SEXP>(Rcpp::wrap(par)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline arma::vec bin_logl(const arma::vec& y, const arma::vec& a, const arma::mat& x1, const arma::mat& x2, const arma::vec par, const arma::vec& weights, std::string type = "rd", bool indiv = false) {
        typedef SEXP(*Ptr_bin_logl)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_logl p_bin_logl = NULL;
        if (p_bin_logl == NULL) {
            validateSignature("arma::vec(*bin_logl)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const arma::vec,const arma::vec&,std::string,bool)");
            p_bin_logl = (Ptr_bin_logl)R_GetCCallable("targeted", "_targeted_bin_logl");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_logl(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(type)), Shield<SEXP>(Rcpp::wrap(indiv)));
        }
        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<arma::vec >(rcpp_result_gen);
    }

    inline arma::mat bin_dlogl(const arma::vec& y, const arma::vec& a, const arma::mat& x1, const arma::mat& x2, const arma::vec par, const arma::vec& weights, std::string type = "rd", bool indiv = false) {
        typedef SEXP(*Ptr_bin_dlogl)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_dlogl p_bin_dlogl = NULL;
        if (p_bin_dlogl == NULL) {
            validateSignature("arma::mat(*bin_dlogl)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const arma::vec,const arma::vec&,std::string,bool)");
            p_bin_dlogl = (Ptr_bin_dlogl)R_GetCCallable("targeted", "_targeted_bin_dlogl");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_dlogl(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(type)), Shield<SEXP>(Rcpp::wrap(indiv)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline arma::mat bin_pa(const arma::vec& y, const arma::vec& a, const arma::mat& x1, const arma::mat& x2, const arma::vec par, std::string type = "rd") {
        typedef SEXP(*Ptr_bin_pa)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_pa p_bin_pa = NULL;
        if (p_bin_pa == NULL) {
            validateSignature("arma::mat(*bin_pa)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const arma::vec,std::string)");
            p_bin_pa = (Ptr_bin_pa)R_GetCCallable("targeted", "_targeted_bin_pa");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_pa(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(type)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline arma::cx_mat bin_dlogl_c(const arma::cx_vec& y, const arma::cx_vec& a, const arma::cx_mat& x1, const arma::cx_mat& x2, const arma::cx_vec par, const arma::cx_vec& weights, std::string type = "rd", bool indiv = false) {
        typedef SEXP(*Ptr_bin_dlogl_c)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_dlogl_c p_bin_dlogl_c = NULL;
        if (p_bin_dlogl_c == NULL) {
            validateSignature("arma::cx_mat(*bin_dlogl_c)(const arma::cx_vec&,const arma::cx_vec&,const arma::cx_mat&,const arma::cx_mat&,const arma::cx_vec,const arma::cx_vec&,std::string,bool)");
            p_bin_dlogl_c = (Ptr_bin_dlogl_c)R_GetCCallable("targeted", "_targeted_bin_dlogl_c");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_dlogl_c(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(type)), Shield<SEXP>(Rcpp::wrap(indiv)));
        }
        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<arma::cx_mat >(rcpp_result_gen);
    }

    inline arma::mat bin_esteq(const arma::vec& y, const arma::vec& a, const arma::mat& x1, const arma::mat& x2, const arma::vec& pr, arma::vec alpha, arma::vec par, const arma::vec& weights, std::string type = "rd") {
        typedef SEXP(*Ptr_bin_esteq)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_esteq p_bin_esteq = NULL;
        if (p_bin_esteq == NULL) {
            validateSignature("arma::mat(*bin_esteq)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const arma::vec&,arma::vec,arma::vec,const arma::vec&,std::string)");
            p_bin_esteq = (Ptr_bin_esteq)R_GetCCallable("targeted", "_targeted_bin_esteq");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_esteq(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(pr)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(type)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline arma::cx_mat bin_esteq_c(const arma::cx_vec& y, const arma::cx_vec& a, const arma::cx_mat& x1, const arma::cx_mat& x2, const arma::cx_mat& x3, arma::cx_vec alpha, arma::cx_vec par, const arma::cx_vec& weights, std::string type = "rd") {
        typedef SEXP(*Ptr_bin_esteq_c)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bin_esteq_c p_bin_esteq_c = NULL;
        if (p_bin_esteq_c == NULL) {
            validateSignature("arma::cx_mat(*bin_esteq_c)(const arma::cx_vec&,const arma::cx_vec&,const arma::cx_mat&,const arma::cx_mat&,const arma::cx_mat&,arma::cx_vec,arma::cx_vec,const arma::cx_vec&,std::string)");
            p_bin_esteq_c = (Ptr_bin_esteq_c)R_GetCCallable("targeted", "_targeted_bin_esteq_c");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bin_esteq_c(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(x3)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(par)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(type)));
        }
        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<arma::cx_mat >(rcpp_result_gen);
    }

    inline Rcpp::List ace_est(const arma::vec& y, const arma::mat& a, const arma::mat& x1, const arma::mat& x2, const arma::vec& theta, const arma::vec& weights, bool binary = true) {
        typedef SEXP(*Ptr_ace_est)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ace_est p_ace_est = NULL;
        if (p_ace_est == NULL) {
            validateSignature("Rcpp::List(*ace_est)(const arma::vec&,const arma::mat&,const arma::mat&,const arma::mat&,const arma::vec&,const arma::vec&,bool)");
            p_ace_est = (Ptr_ace_est)R_GetCCallable("targeted", "_targeted_ace_est");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ace_est(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(a)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(x2)), Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(binary)));
        }
        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<Rcpp::List >(rcpp_result_gen);
    }

    inline arma::mat fast_iid(const arma::vec& y, const arma::vec& p, const arma::mat& x1, const arma::vec& weights, bool logistic = true) {
        typedef SEXP(*Ptr_fast_iid)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_fast_iid p_fast_iid = NULL;
        if (p_fast_iid == NULL) {
            validateSignature("arma::mat(*fast_iid)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::vec&,bool)");
            p_fast_iid = (Ptr_fast_iid)R_GetCCallable("targeted", "_targeted_fast_iid");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fast_iid(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(x1)), Shield<SEXP>(Rcpp::wrap(weights)), Shield<SEXP>(Rcpp::wrap(logistic)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline List _clusterid(const arma::uvec& id) {
        typedef SEXP(*Ptr__clusterid)(SEXP);
        static Ptr__clusterid p__clusterid = NULL;
        if (p__clusterid == NULL) {
            validateSignature("List(*_clusterid)(const arma::uvec&)");
            p__clusterid = (Ptr__clusterid)R_GetCCallable("targeted", "_targeted__clusterid");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__clusterid(Shield<SEXP>(Rcpp::wrap(id)));
        }
        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<List >(rcpp_result_gen);
    }

    inline arma::mat _groupsum(const arma::mat& x, const arma::uvec& cluster, bool reduce = true) {
        typedef SEXP(*Ptr__groupsum)(SEXP,SEXP,SEXP);
        static Ptr__groupsum p__groupsum = NULL;
        if (p__groupsum == NULL) {
            validateSignature("arma::mat(*_groupsum)(const arma::mat&,const arma::uvec&,bool)");
            p__groupsum = (Ptr__groupsum)R_GetCCallable("targeted", "_targeted__groupsum");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__groupsum(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(cluster)), Shield<SEXP>(Rcpp::wrap(reduce)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline arma::mat _softmax(arma::mat& lp, bool ref = true, bool log = false) {
        typedef SEXP(*Ptr__softmax)(SEXP,SEXP,SEXP);
        static Ptr__softmax p__softmax = NULL;
        if (p__softmax == NULL) {
            validateSignature("arma::mat(*_softmax)(arma::mat&,bool,bool)");
            p__softmax = (Ptr__softmax)R_GetCCallable("targeted", "_targeted__softmax");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__softmax(Shield<SEXP>(Rcpp::wrap(lp)), Shield<SEXP>(Rcpp::wrap(ref)), Shield<SEXP>(Rcpp::wrap(log)));
        }
        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<arma::mat >(rcpp_result_gen);
    }

    inline List _pava(const arma::vec& y, const NumericVector& x, const NumericVector& weights) {
        typedef SEXP(*Ptr__pava)(SEXP,SEXP,SEXP);
        static Ptr__pava p__pava = NULL;
        if (p__pava == NULL) {
            validateSignature("List(*_pava)(const arma::vec&,const NumericVector&,const NumericVector&)");
            p__pava = (Ptr__pava)R_GetCCallable("targeted", "_targeted__pava");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p__pava(Shield<SEXP>(Rcpp::wrap(y)), Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(weights)));
        }
        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<List >(rcpp_result_gen);
    }

}

#endif // RCPP_targeted_RCPPEXPORTS_H_GEN_
