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

#ifndef RCPP_bsvarSIGNs_RCPPEXPORTS_H_GEN_
#define RCPP_bsvarSIGNs_RCPPEXPORTS_H_GEN_

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

namespace bsvarSIGNs {

    using namespace Rcpp;

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

    inline arma::field<arma::mat> bsvar_sign_single_draw_cpp(const int& p, const arma::mat& Y, const arma::mat& X, const arma::cube& sign_irf, const arma::mat& sign_narrative, const arma::mat& sign_B, const arma::field<arma::mat>& Z, const int& Nf, const Rcpp::List& prior, const int& max_tries, const int idx) {
        typedef SEXP(*Ptr_bsvar_sign_single_draw_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvar_sign_single_draw_cpp p_bsvar_sign_single_draw_cpp = NULL;
        if (p_bsvar_sign_single_draw_cpp == NULL) {
            validateSignature("arma::field<arma::mat>(*bsvar_sign_single_draw_cpp)(const int&,const arma::mat&,const arma::mat&,const arma::cube&,const arma::mat&,const arma::mat&,const arma::field<arma::mat>&,const int&,const Rcpp::List&,const int&,const int)");
            p_bsvar_sign_single_draw_cpp = (Ptr_bsvar_sign_single_draw_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvar_sign_single_draw_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvar_sign_single_draw_cpp(Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(sign_irf)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(sign_B)), Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(Nf)), Shield<SEXP>(Rcpp::wrap(prior)), Shield<SEXP>(Rcpp::wrap(max_tries)), Shield<SEXP>(Rcpp::wrap(idx)));
        }
        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::field<arma::mat> >(rcpp_result_gen);
    }

    inline Rcpp::List bsvar_sign_par_cpp(const int& p, const arma::mat& Y, const arma::mat& X, const arma::cube& sign_irf, const arma::mat& sign_narrative, const arma::mat& sign_B, const arma::field<arma::mat>& Z, const int& Nf, const Rcpp::List& prior, const int& max_tries = 10000, const int idx = 0) {
        typedef SEXP(*Ptr_bsvar_sign_par_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvar_sign_par_cpp p_bsvar_sign_par_cpp = NULL;
        if (p_bsvar_sign_par_cpp == NULL) {
            validateSignature("Rcpp::List(*bsvar_sign_par_cpp)(const int&,const arma::mat&,const arma::mat&,const arma::cube&,const arma::mat&,const arma::mat&,const arma::field<arma::mat>&,const int&,const Rcpp::List&,const int&,const int)");
            p_bsvar_sign_par_cpp = (Ptr_bsvar_sign_par_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvar_sign_par_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvar_sign_par_cpp(Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(sign_irf)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(sign_B)), Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(Nf)), Shield<SEXP>(Rcpp::wrap(prior)), Shield<SEXP>(Rcpp::wrap(max_tries)), Shield<SEXP>(Rcpp::wrap(idx)));
        }
        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 Rcpp::List bsvar_sign_cpp(const int& S, const int& p, const arma::mat& Y, const arma::mat& X, const arma::cube& sign_irf, const arma::mat& sign_narrative, const arma::mat& sign_B, const arma::field<arma::mat>& Z, const int& Nf, const Rcpp::List& prior, const bool show_progress = true, const int thin = 100, const int& max_tries = 10000) {
        typedef SEXP(*Ptr_bsvar_sign_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvar_sign_cpp p_bsvar_sign_cpp = NULL;
        if (p_bsvar_sign_cpp == NULL) {
            validateSignature("Rcpp::List(*bsvar_sign_cpp)(const int&,const int&,const arma::mat&,const arma::mat&,const arma::cube&,const arma::mat&,const arma::mat&,const arma::field<arma::mat>&,const int&,const Rcpp::List&,const bool,const int,const int&)");
            p_bsvar_sign_cpp = (Ptr_bsvar_sign_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvar_sign_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvar_sign_cpp(Shield<SEXP>(Rcpp::wrap(S)), Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(sign_irf)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(sign_B)), Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(Nf)), Shield<SEXP>(Rcpp::wrap(prior)), Shield<SEXP>(Rcpp::wrap(show_progress)), Shield<SEXP>(Rcpp::wrap(thin)), Shield<SEXP>(Rcpp::wrap(max_tries)));
        }
        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::cube bsvarSIGNs_structural_shocks(arma::cube& posterior_B, arma::cube& posterior_A, arma::mat& Y, arma::mat& X) {
        typedef SEXP(*Ptr_bsvarSIGNs_structural_shocks)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvarSIGNs_structural_shocks p_bsvarSIGNs_structural_shocks = NULL;
        if (p_bsvarSIGNs_structural_shocks == NULL) {
            validateSignature("arma::cube(*bsvarSIGNs_structural_shocks)(arma::cube&,arma::cube&,arma::mat&,arma::mat&)");
            p_bsvarSIGNs_structural_shocks = (Ptr_bsvarSIGNs_structural_shocks)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvarSIGNs_structural_shocks");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvarSIGNs_structural_shocks(Shield<SEXP>(Rcpp::wrap(posterior_B)), Shield<SEXP>(Rcpp::wrap(posterior_A)), Shield<SEXP>(Rcpp::wrap(Y)), 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<arma::cube >(rcpp_result_gen);
    }

    inline arma::cube bsvarSIGNs_fitted_values(arma::cube& posterior_A, arma::cube& posterior_B, arma::cube& posterior_sigma, arma::mat& X) {
        typedef SEXP(*Ptr_bsvarSIGNs_fitted_values)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvarSIGNs_fitted_values p_bsvarSIGNs_fitted_values = NULL;
        if (p_bsvarSIGNs_fitted_values == NULL) {
            validateSignature("arma::cube(*bsvarSIGNs_fitted_values)(arma::cube&,arma::cube&,arma::cube&,arma::mat&)");
            p_bsvarSIGNs_fitted_values = (Ptr_bsvarSIGNs_fitted_values)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvarSIGNs_fitted_values");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvarSIGNs_fitted_values(Shield<SEXP>(Rcpp::wrap(posterior_A)), Shield<SEXP>(Rcpp::wrap(posterior_B)), Shield<SEXP>(Rcpp::wrap(posterior_sigma)), 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<arma::cube >(rcpp_result_gen);
    }

    inline arma::cube ir1_cpp(const arma::mat& B, const arma::mat& Theta0, int horizon, const int& p) {
        typedef SEXP(*Ptr_ir1_cpp)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_ir1_cpp p_ir1_cpp = NULL;
        if (p_ir1_cpp == NULL) {
            validateSignature("arma::cube(*ir1_cpp)(const arma::mat&,const arma::mat&,int,const int&)");
            p_ir1_cpp = (Ptr_ir1_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_ir1_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ir1_cpp(Shield<SEXP>(Rcpp::wrap(B)), Shield<SEXP>(Rcpp::wrap(Theta0)), Shield<SEXP>(Rcpp::wrap(horizon)), 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<arma::cube >(rcpp_result_gen);
    }

    inline arma::field<arma::cube> bsvarSIGNs_ir(arma::cube& posterior_B, arma::cube& posterior_Theta0, const int horizon, const int p, const bool standardise = false) {
        typedef SEXP(*Ptr_bsvarSIGNs_ir)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_bsvarSIGNs_ir p_bsvarSIGNs_ir = NULL;
        if (p_bsvarSIGNs_ir == NULL) {
            validateSignature("arma::field<arma::cube>(*bsvarSIGNs_ir)(arma::cube&,arma::cube&,const int,const int,const bool)");
            p_bsvarSIGNs_ir = (Ptr_bsvarSIGNs_ir)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvarSIGNs_ir");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvarSIGNs_ir(Shield<SEXP>(Rcpp::wrap(posterior_B)), Shield<SEXP>(Rcpp::wrap(posterior_Theta0)), Shield<SEXP>(Rcpp::wrap(horizon)), Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(standardise)));
        }
        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::field<arma::cube> >(rcpp_result_gen);
    }

    inline arma::field<arma::cube> bsvarSIGNs_hd(arma::field<arma::cube>& posterior_irf_T, arma::cube& structural_shocks, const bool show_progress = true) {
        typedef SEXP(*Ptr_bsvarSIGNs_hd)(SEXP,SEXP,SEXP);
        static Ptr_bsvarSIGNs_hd p_bsvarSIGNs_hd = NULL;
        if (p_bsvarSIGNs_hd == NULL) {
            validateSignature("arma::field<arma::cube>(*bsvarSIGNs_hd)(arma::field<arma::cube>&,arma::cube&,const bool)");
            p_bsvarSIGNs_hd = (Ptr_bsvarSIGNs_hd)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvarSIGNs_hd");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvarSIGNs_hd(Shield<SEXP>(Rcpp::wrap(posterior_irf_T)), Shield<SEXP>(Rcpp::wrap(structural_shocks)), Shield<SEXP>(Rcpp::wrap(show_progress)));
        }
        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::field<arma::cube> >(rcpp_result_gen);
    }

    inline arma::mat hd1_cpp(const int& var_i, const int& t, const int& h, const arma::mat& Epsilon, const arma::cube& irf) {
        typedef SEXP(*Ptr_hd1_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_hd1_cpp p_hd1_cpp = NULL;
        if (p_hd1_cpp == NULL) {
            validateSignature("arma::mat(*hd1_cpp)(const int&,const int&,const int&,const arma::mat&,const arma::cube&)");
            p_hd1_cpp = (Ptr_hd1_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_hd1_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_hd1_cpp(Shield<SEXP>(Rcpp::wrap(var_i)), Shield<SEXP>(Rcpp::wrap(t)), Shield<SEXP>(Rcpp::wrap(h)), Shield<SEXP>(Rcpp::wrap(Epsilon)), Shield<SEXP>(Rcpp::wrap(irf)));
        }
        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::field<arma::cube> bsvarSIGNs_fevd(arma::field<arma::cube>& posterior_irf) {
        typedef SEXP(*Ptr_bsvarSIGNs_fevd)(SEXP);
        static Ptr_bsvarSIGNs_fevd p_bsvarSIGNs_fevd = NULL;
        if (p_bsvarSIGNs_fevd == NULL) {
            validateSignature("arma::field<arma::cube>(*bsvarSIGNs_fevd)(arma::field<arma::cube>&)");
            p_bsvarSIGNs_fevd = (Ptr_bsvarSIGNs_fevd)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_bsvarSIGNs_fevd");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_bsvarSIGNs_fevd(Shield<SEXP>(Rcpp::wrap(posterior_irf)));
        }
        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::field<arma::cube> >(rcpp_result_gen);
    }

    inline Rcpp::List forecast_bsvarSIGNs(arma::cube& posterior_Sigma, arma::cube& posterior_A, arma::mat& posterior_hyper, arma::vec& X_T, arma::mat& exogenous_forecast, arma::mat& cond_forecast, const int& covid, const int& T, const int& horizon) {
        typedef SEXP(*Ptr_forecast_bsvarSIGNs)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_forecast_bsvarSIGNs p_forecast_bsvarSIGNs = NULL;
        if (p_forecast_bsvarSIGNs == NULL) {
            validateSignature("Rcpp::List(*forecast_bsvarSIGNs)(arma::cube&,arma::cube&,arma::mat&,arma::vec&,arma::mat&,arma::mat&,const int&,const int&,const int&)");
            p_forecast_bsvarSIGNs = (Ptr_forecast_bsvarSIGNs)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_forecast_bsvarSIGNs");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_forecast_bsvarSIGNs(Shield<SEXP>(Rcpp::wrap(posterior_Sigma)), Shield<SEXP>(Rcpp::wrap(posterior_A)), Shield<SEXP>(Rcpp::wrap(posterior_hyper)), Shield<SEXP>(Rcpp::wrap(X_T)), Shield<SEXP>(Rcpp::wrap(exogenous_forecast)), Shield<SEXP>(Rcpp::wrap(cond_forecast)), Shield<SEXP>(Rcpp::wrap(covid)), Shield<SEXP>(Rcpp::wrap(T)), Shield<SEXP>(Rcpp::wrap(horizon)));
        }
        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 metropolis(const int T, const int t0, arma::vec x, arma::mat Sigma, Rcpp::Function log_target) {
        typedef SEXP(*Ptr_metropolis)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_metropolis p_metropolis = NULL;
        if (p_metropolis == NULL) {
            validateSignature("arma::mat(*metropolis)(const int,const int,arma::vec,arma::mat,Rcpp::Function)");
            p_metropolis = (Ptr_metropolis)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_metropolis");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_metropolis(Shield<SEXP>(Rcpp::wrap(T)), Shield<SEXP>(Rcpp::wrap(t0)), Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(Sigma)), Shield<SEXP>(Rcpp::wrap(log_target)));
        }
        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 bool match_sign_narrative(const arma::mat& Epsilon, const arma::mat& sign_narrative, const arma::cube& irf) {
        typedef SEXP(*Ptr_match_sign_narrative)(SEXP,SEXP,SEXP);
        static Ptr_match_sign_narrative p_match_sign_narrative = NULL;
        if (p_match_sign_narrative == NULL) {
            validateSignature("bool(*match_sign_narrative)(const arma::mat&,const arma::mat&,const arma::cube&)");
            p_match_sign_narrative = (Ptr_match_sign_narrative)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_match_sign_narrative");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_match_sign_narrative(Shield<SEXP>(Rcpp::wrap(Epsilon)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(irf)));
        }
        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<bool >(rcpp_result_gen);
    }

    inline double log_weight_narrative(const int& T, arma::mat sign_narrative, const arma::cube& irf) {
        typedef SEXP(*Ptr_log_weight_narrative)(SEXP,SEXP,SEXP);
        static Ptr_log_weight_narrative p_log_weight_narrative = NULL;
        if (p_log_weight_narrative == NULL) {
            validateSignature("double(*log_weight_narrative)(const int&,arma::mat,const arma::cube&)");
            p_log_weight_narrative = (Ptr_log_weight_narrative)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_weight_narrative");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_weight_narrative(Shield<SEXP>(Rcpp::wrap(T)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(irf)));
        }
        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 arma::field<arma::mat> ZIRF(const arma::field<arma::mat>& Z, const arma::mat& irf_0) {
        typedef SEXP(*Ptr_ZIRF)(SEXP,SEXP);
        static Ptr_ZIRF p_ZIRF = NULL;
        if (p_ZIRF == NULL) {
            validateSignature("arma::field<arma::mat>(*ZIRF)(const arma::field<arma::mat>&,const arma::mat&)");
            p_ZIRF = (Ptr_ZIRF)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_ZIRF");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ZIRF(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(irf_0)));
        }
        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::field<arma::mat> >(rcpp_result_gen);
    }

    inline arma::colvec zero_restrictions(const arma::field<arma::mat>& Z, const arma::colvec vec_structural) {
        typedef SEXP(*Ptr_zero_restrictions)(SEXP,SEXP);
        static Ptr_zero_restrictions p_zero_restrictions = NULL;
        if (p_zero_restrictions == NULL) {
            validateSignature("arma::colvec(*zero_restrictions)(const arma::field<arma::mat>&,const arma::colvec)");
            p_zero_restrictions = (Ptr_zero_restrictions)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_zero_restrictions");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_zero_restrictions(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(vec_structural)));
        }
        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::colvec >(rcpp_result_gen);
    }

    inline arma::colvec g_fh(const arma::field<arma::mat>& Z, const arma::mat& A0, const arma::mat& Aplus) {
        typedef SEXP(*Ptr_g_fh)(SEXP,SEXP,SEXP);
        static Ptr_g_fh p_g_fh = NULL;
        if (p_g_fh == NULL) {
            validateSignature("arma::colvec(*g_fh)(const arma::field<arma::mat>&,const arma::mat&,const arma::mat&)");
            p_g_fh = (Ptr_g_fh)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_g_fh");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g_fh(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(A0)), Shield<SEXP>(Rcpp::wrap(Aplus)));
        }
        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::colvec >(rcpp_result_gen);
    }

    inline arma::colvec g_fh_vec(const arma::field<arma::mat>& Z, const arma::colvec vec_structural) {
        typedef SEXP(*Ptr_g_fh_vec)(SEXP,SEXP);
        static Ptr_g_fh_vec p_g_fh_vec = NULL;
        if (p_g_fh_vec == NULL) {
            validateSignature("arma::colvec(*g_fh_vec)(const arma::field<arma::mat>&,const arma::colvec)");
            p_g_fh_vec = (Ptr_g_fh_vec)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_g_fh_vec");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_g_fh_vec(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(vec_structural)));
        }
        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::colvec >(rcpp_result_gen);
    }

    inline double log_volume_element(const arma::field<arma::mat>& Z, const arma::mat& A0, const arma::mat& Aplus) {
        typedef SEXP(*Ptr_log_volume_element)(SEXP,SEXP,SEXP);
        static Ptr_log_volume_element p_log_volume_element = NULL;
        if (p_log_volume_element == NULL) {
            validateSignature("double(*log_volume_element)(const arma::field<arma::mat>&,const arma::mat&,const arma::mat&)");
            p_log_volume_element = (Ptr_log_volume_element)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_volume_element");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_volume_element(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(A0)), Shield<SEXP>(Rcpp::wrap(Aplus)));
        }
        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 log_weight_zero(const arma::field<arma::mat>& Z, const arma::mat& B, const arma::mat& h_inv, const arma::mat& Q) {
        typedef SEXP(*Ptr_log_weight_zero)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_log_weight_zero p_log_weight_zero = NULL;
        if (p_log_weight_zero == NULL) {
            validateSignature("double(*log_weight_zero)(const arma::field<arma::mat>&,const arma::mat&,const arma::mat&,const arma::mat&)");
            p_log_weight_zero = (Ptr_log_weight_zero)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_weight_zero");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_weight_zero(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(B)), Shield<SEXP>(Rcpp::wrap(h_inv)), Shield<SEXP>(Rcpp::wrap(Q)));
        }
        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 arma::mat rzeroQ(const arma::field<arma::mat>& Z, const arma::mat& irf_0) {
        typedef SEXP(*Ptr_rzeroQ)(SEXP,SEXP);
        static Ptr_rzeroQ p_rzeroQ = NULL;
        if (p_rzeroQ == NULL) {
            validateSignature("arma::mat(*rzeroQ)(const arma::field<arma::mat>&,const arma::mat&)");
            p_rzeroQ = (Ptr_rzeroQ)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_rzeroQ");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_rzeroQ(Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(irf_0)));
        }
        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 rmatnorm_cpp(const arma::mat& M, const arma::mat& U, const arma::mat& V) {
        typedef SEXP(*Ptr_rmatnorm_cpp)(SEXP,SEXP,SEXP);
        static Ptr_rmatnorm_cpp p_rmatnorm_cpp = NULL;
        if (p_rmatnorm_cpp == NULL) {
            validateSignature("arma::mat(*rmatnorm_cpp)(const arma::mat&,const arma::mat&,const arma::mat&)");
            p_rmatnorm_cpp = (Ptr_rmatnorm_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_rmatnorm_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_rmatnorm_cpp(Shield<SEXP>(Rcpp::wrap(M)), Shield<SEXP>(Rcpp::wrap(U)), Shield<SEXP>(Rcpp::wrap(V)));
        }
        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 riwish_cpp(const arma::mat& S, const double& nu) {
        typedef SEXP(*Ptr_riwish_cpp)(SEXP,SEXP);
        static Ptr_riwish_cpp p_riwish_cpp = NULL;
        if (p_riwish_cpp == NULL) {
            validateSignature("arma::mat(*riwish_cpp)(const arma::mat&,const double&)");
            p_riwish_cpp = (Ptr_riwish_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_riwish_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_riwish_cpp(Shield<SEXP>(Rcpp::wrap(S)), Shield<SEXP>(Rcpp::wrap(nu)));
        }
        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::field<arma::mat> niw_cpp(const arma::mat& Y, const arma::mat& X, const arma::mat& prior_B, const arma::mat& prior_V, const arma::mat& prior_S, const int& prior_nu) {
        typedef SEXP(*Ptr_niw_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_niw_cpp p_niw_cpp = NULL;
        if (p_niw_cpp == NULL) {
            validateSignature("arma::field<arma::mat>(*niw_cpp)(const arma::mat&,const arma::mat&,const arma::mat&,const arma::mat&,const arma::mat&,const int&)");
            p_niw_cpp = (Ptr_niw_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_niw_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_niw_cpp(Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(prior_B)), Shield<SEXP>(Rcpp::wrap(prior_V)), Shield<SEXP>(Rcpp::wrap(prior_S)), Shield<SEXP>(Rcpp::wrap(prior_nu)));
        }
        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::field<arma::mat> >(rcpp_result_gen);
    }

    inline bool match_sign_irf(const arma::mat& Q, const arma::cube& sign_irf, const arma::cube& irf) {
        typedef SEXP(*Ptr_match_sign_irf)(SEXP,SEXP,SEXP);
        static Ptr_match_sign_irf p_match_sign_irf = NULL;
        if (p_match_sign_irf == NULL) {
            validateSignature("bool(*match_sign_irf)(const arma::mat&,const arma::cube&,const arma::cube&)");
            p_match_sign_irf = (Ptr_match_sign_irf)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_match_sign_irf");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_match_sign_irf(Shield<SEXP>(Rcpp::wrap(Q)), Shield<SEXP>(Rcpp::wrap(sign_irf)), Shield<SEXP>(Rcpp::wrap(irf)));
        }
        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<bool >(rcpp_result_gen);
    }

    inline arma::field<arma::mat> sample_Q(const int& p, const arma::mat& Y, const arma::mat& X, arma::mat& B, arma::mat& h_invp, arma::mat& chol_Sigma, const Rcpp::List& prior, const arma::cube& sign_irf, const arma::mat& sign_narrative, const arma::mat& sign_B, const arma::field<arma::mat>& Z, const int& Nf, const int& max_tries) {
        typedef SEXP(*Ptr_sample_Q)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_sample_Q p_sample_Q = NULL;
        if (p_sample_Q == NULL) {
            validateSignature("arma::field<arma::mat>(*sample_Q)(const int&,const arma::mat&,const arma::mat&,arma::mat&,arma::mat&,arma::mat&,const Rcpp::List&,const arma::cube&,const arma::mat&,const arma::mat&,const arma::field<arma::mat>&,const int&,const int&)");
            p_sample_Q = (Ptr_sample_Q)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_sample_Q");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_sample_Q(Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(B)), Shield<SEXP>(Rcpp::wrap(h_invp)), Shield<SEXP>(Rcpp::wrap(chol_Sigma)), Shield<SEXP>(Rcpp::wrap(prior)), Shield<SEXP>(Rcpp::wrap(sign_irf)), Shield<SEXP>(Rcpp::wrap(sign_narrative)), Shield<SEXP>(Rcpp::wrap(sign_B)), Shield<SEXP>(Rcpp::wrap(Z)), Shield<SEXP>(Rcpp::wrap(Nf)), Shield<SEXP>(Rcpp::wrap(max_tries)));
        }
        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::field<arma::mat> >(rcpp_result_gen);
    }

    inline arma::field<arma::mat> sample_restricted_B_cpp(const arma::mat& post_B, const arma::mat& post_V, const arma::mat& Sigma, const int& p, const int& N, const int& Nf, const int& K) {
        typedef SEXP(*Ptr_sample_restricted_B_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_sample_restricted_B_cpp p_sample_restricted_B_cpp = NULL;
        if (p_sample_restricted_B_cpp == NULL) {
            validateSignature("arma::field<arma::mat>(*sample_restricted_B_cpp)(const arma::mat&,const arma::mat&,const arma::mat&,const int&,const int&,const int&,const int&)");
            p_sample_restricted_B_cpp = (Ptr_sample_restricted_B_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_sample_restricted_B_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_sample_restricted_B_cpp(Shield<SEXP>(Rcpp::wrap(post_B)), Shield<SEXP>(Rcpp::wrap(post_V)), Shield<SEXP>(Rcpp::wrap(Sigma)), Shield<SEXP>(Rcpp::wrap(p)), Shield<SEXP>(Rcpp::wrap(N)), Shield<SEXP>(Rcpp::wrap(Nf)), Shield<SEXP>(Rcpp::wrap(K)));
        }
        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::field<arma::mat> >(rcpp_result_gen);
    }

    inline double log_dgamma(const double& x, const double& k, const double& theta) {
        typedef SEXP(*Ptr_log_dgamma)(SEXP,SEXP,SEXP);
        static Ptr_log_dgamma p_log_dgamma = NULL;
        if (p_log_dgamma == NULL) {
            validateSignature("double(*log_dgamma)(const double&,const double&,const double&)");
            p_log_dgamma = (Ptr_log_dgamma)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_dgamma");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_dgamma(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(k)), 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<double >(rcpp_result_gen);
    }

    inline double log_dinvgamma(const double& x, const double& alpha, const double& beta) {
        typedef SEXP(*Ptr_log_dinvgamma)(SEXP,SEXP,SEXP);
        static Ptr_log_dinvgamma p_log_dinvgamma = NULL;
        if (p_log_dinvgamma == NULL) {
            validateSignature("double(*log_dinvgamma)(const double&,const double&,const double&)");
            p_log_dinvgamma = (Ptr_log_dinvgamma)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_dinvgamma");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_dinvgamma(Shield<SEXP>(Rcpp::wrap(x)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(beta)));
        }
        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 log_prior_hyper(const arma::vec& hyper, const arma::vec& model, const Rcpp::List& prior) {
        typedef SEXP(*Ptr_log_prior_hyper)(SEXP,SEXP,SEXP);
        static Ptr_log_prior_hyper p_log_prior_hyper = NULL;
        if (p_log_prior_hyper == NULL) {
            validateSignature("double(*log_prior_hyper)(const arma::vec&,const arma::vec&,const Rcpp::List&)");
            p_log_prior_hyper = (Ptr_log_prior_hyper)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_prior_hyper");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_prior_hyper(Shield<SEXP>(Rcpp::wrap(hyper)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(prior)));
        }
        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 log_mvgamma(const int& n, const double& x) {
        typedef SEXP(*Ptr_log_mvgamma)(SEXP,SEXP);
        static Ptr_log_mvgamma p_log_mvgamma = NULL;
        if (p_log_mvgamma == NULL) {
            validateSignature("double(*log_mvgamma)(const int&,const double&)");
            p_log_mvgamma = (Ptr_log_mvgamma)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_mvgamma");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_mvgamma(Shield<SEXP>(Rcpp::wrap(n)), 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<double >(rcpp_result_gen);
    }

    inline double log_ml(const arma::mat& b, const arma::mat& Omega, const arma::mat& Psi, const int& d, const arma::mat& Y, const arma::mat& X) {
        typedef SEXP(*Ptr_log_ml)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_log_ml p_log_ml = NULL;
        if (p_log_ml == NULL) {
            validateSignature("double(*log_ml)(const arma::mat&,const arma::mat&,const arma::mat&,const int&,const arma::mat&,const arma::mat&)");
            p_log_ml = (Ptr_log_ml)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_ml");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_ml(Shield<SEXP>(Rcpp::wrap(b)), Shield<SEXP>(Rcpp::wrap(Omega)), Shield<SEXP>(Rcpp::wrap(Psi)), Shield<SEXP>(Rcpp::wrap(d)), Shield<SEXP>(Rcpp::wrap(Y)), 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<double >(rcpp_result_gen);
    }

    inline double log_ml_dummy(const arma::vec& hyper, const arma::vec& model, const arma::mat& Y, const arma::mat& X, const Rcpp::List& prior) {
        typedef SEXP(*Ptr_log_ml_dummy)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_log_ml_dummy p_log_ml_dummy = NULL;
        if (p_log_ml_dummy == NULL) {
            validateSignature("double(*log_ml_dummy)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const Rcpp::List&)");
            p_log_ml_dummy = (Ptr_log_ml_dummy)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_ml_dummy");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_ml_dummy(Shield<SEXP>(Rcpp::wrap(hyper)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(prior)));
        }
        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 log_posterior_hyper(const arma::vec& hyper, const arma::vec& model, const arma::mat& Y, const arma::mat& X, const Rcpp::List& prior) {
        typedef SEXP(*Ptr_log_posterior_hyper)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_log_posterior_hyper p_log_posterior_hyper = NULL;
        if (p_log_posterior_hyper == NULL) {
            validateSignature("double(*log_posterior_hyper)(const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const Rcpp::List&)");
            p_log_posterior_hyper = (Ptr_log_posterior_hyper)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_log_posterior_hyper");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_log_posterior_hyper(Shield<SEXP>(Rcpp::wrap(hyper)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(prior)));
        }
        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 arma::mat extend_hyper(const arma::vec& init, const arma::vec& model, const arma::mat& hypers) {
        typedef SEXP(*Ptr_extend_hyper)(SEXP,SEXP,SEXP);
        static Ptr_extend_hyper p_extend_hyper = NULL;
        if (p_extend_hyper == NULL) {
            validateSignature("arma::mat(*extend_hyper)(const arma::vec&,const arma::vec&,const arma::mat&)");
            p_extend_hyper = (Ptr_extend_hyper)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_extend_hyper");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_extend_hyper(Shield<SEXP>(Rcpp::wrap(init)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(hypers)));
        }
        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 narrow_hyper(const arma::vec& model, arma::mat hypers) {
        typedef SEXP(*Ptr_narrow_hyper)(SEXP,SEXP);
        static Ptr_narrow_hyper p_narrow_hyper = NULL;
        if (p_narrow_hyper == NULL) {
            validateSignature("arma::mat(*narrow_hyper)(const arma::vec&,arma::mat)");
            p_narrow_hyper = (Ptr_narrow_hyper)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_narrow_hyper");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_narrow_hyper(Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(hypers)));
        }
        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 sample_hyper(const int& S, const int& start, const arma::vec& init, const arma::vec& model, const arma::mat& Y, const arma::mat& X, const arma::mat& W, const Rcpp::List& prior) {
        typedef SEXP(*Ptr_sample_hyper)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_sample_hyper p_sample_hyper = NULL;
        if (p_sample_hyper == NULL) {
            validateSignature("arma::mat(*sample_hyper)(const int&,const int&,const arma::vec&,const arma::vec&,const arma::mat&,const arma::mat&,const arma::mat&,const Rcpp::List&)");
            p_sample_hyper = (Ptr_sample_hyper)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_sample_hyper");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_sample_hyper(Shield<SEXP>(Rcpp::wrap(S)), Shield<SEXP>(Rcpp::wrap(start)), Shield<SEXP>(Rcpp::wrap(init)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(W)), Shield<SEXP>(Rcpp::wrap(prior)));
        }
        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 qr_sign_cpp(const arma::mat& A) {
        typedef SEXP(*Ptr_qr_sign_cpp)(SEXP);
        static Ptr_qr_sign_cpp p_qr_sign_cpp = NULL;
        if (p_qr_sign_cpp == NULL) {
            validateSignature("arma::mat(*qr_sign_cpp)(const arma::mat&)");
            p_qr_sign_cpp = (Ptr_qr_sign_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_qr_sign_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_qr_sign_cpp(Shield<SEXP>(Rcpp::wrap(A)));
        }
        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 rortho_cpp(const int& N) {
        typedef SEXP(*Ptr_rortho_cpp)(SEXP);
        static Ptr_rortho_cpp p_rortho_cpp = NULL;
        if (p_rortho_cpp == NULL) {
            validateSignature("arma::mat(*rortho_cpp)(const int&)");
            p_rortho_cpp = (Ptr_rortho_cpp)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_rortho_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_rortho_cpp(Shield<SEXP>(Rcpp::wrap(N)));
        }
        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 bool match_sign(const arma::mat& A, const arma::mat& sign) {
        typedef SEXP(*Ptr_match_sign)(SEXP,SEXP);
        static Ptr_match_sign p_match_sign = NULL;
        if (p_match_sign == NULL) {
            validateSignature("bool(*match_sign)(const arma::mat&,const arma::mat&)");
            p_match_sign = (Ptr_match_sign)R_GetCCallable("bsvarSIGNs", "_bsvarSIGNs_match_sign");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_match_sign(Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(sign)));
        }
        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<bool >(rcpp_result_gen);
    }

}

#endif // RCPP_bsvarSIGNs_RCPPEXPORTS_H_GEN_
