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

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

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// forward_cpp_h
double forward_cpp_h(const arma::mat& allprobs, const arma::rowvec& delta, const arma::mat& Gamma);
RcppExport SEXP _LaMa_forward_cpp_h(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Gamma(GammaSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_h(allprobs, delta, Gamma));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_g
double forward_cpp_g(const arma::mat& allprobs, const arma::rowvec& delta, const arma::cube& Gamma);
RcppExport SEXP _LaMa_forward_cpp_g(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_g(allprobs, delta, Gamma));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_g_tracks
double forward_cpp_g_tracks(const arma::mat& allprobs, const arma::mat& Delta, const arma::cube& Gamma, const IntegerVector trackInd);
RcppExport SEXP _LaMa_forward_cpp_g_tracks(SEXP allprobsSEXP, SEXP DeltaSEXP, SEXP GammaSEXP, SEXP trackIndSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Delta(DeltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type trackInd(trackIndSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_g_tracks(allprobs, Delta, Gamma, trackInd));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_h_tracks
double forward_cpp_h_tracks(const arma::mat& allprobs, const arma::mat& Delta, const arma::cube& Gamma, const IntegerVector trackInd);
RcppExport SEXP _LaMa_forward_cpp_h_tracks(SEXP allprobsSEXP, SEXP DeltaSEXP, SEXP GammaSEXP, SEXP trackIndSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Delta(DeltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type trackInd(trackIndSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_h_tracks(allprobs, Delta, Gamma, trackInd));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_p
double forward_cpp_p(const arma::mat& allprobs, const arma::rowvec& delta, const arma::cube& Gamma, const std::vector<int> tod);
RcppExport SEXP _LaMa_forward_cpp_p(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP, SEXP todSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const std::vector<int> >::type tod(todSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_p(allprobs, delta, Gamma, tod));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_s
double forward_cpp_s(const arma::mat& allprobs, const arma::rowvec& delta, const arma::mat& Gamma, const IntegerVector& agsizes);
RcppExport SEXP _LaMa_forward_cpp_s(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP, SEXP agsizesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type agsizes(agsizesSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_s(allprobs, delta, Gamma, agsizes));
    return rcpp_result_gen;
END_RCPP
}
// forward_cpp_sp
double forward_cpp_sp(const arma::mat& allprobs, const arma::rowvec& delta, const arma::cube& Gamma, const IntegerVector& agsizes, const std::vector<int> tod);
RcppExport SEXP _LaMa_forward_cpp_sp(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP, SEXP agsizesSEXP, SEXP todSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type agsizes(agsizesSEXP);
    Rcpp::traits::input_parameter< const std::vector<int> >::type tod(todSEXP);
    rcpp_result_gen = Rcpp::wrap(forward_cpp_sp(allprobs, delta, Gamma, agsizes, tod));
    return rcpp_result_gen;
END_RCPP
}
// logalpha_cpp
arma::mat logalpha_cpp(const arma::mat& allprobs, const arma::rowvec& delta, const arma::cube& Gamma);
RcppExport SEXP _LaMa_logalpha_cpp(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    rcpp_result_gen = Rcpp::wrap(logalpha_cpp(allprobs, delta, Gamma));
    return rcpp_result_gen;
END_RCPP
}
// logbeta_cpp
arma::mat logbeta_cpp(const arma::mat& allprobs, const arma::cube& Gamma);
RcppExport SEXP _LaMa_logbeta_cpp(SEXP allprobsSEXP, SEXP GammaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    rcpp_result_gen = Rcpp::wrap(logbeta_cpp(allprobs, Gamma));
    return rcpp_result_gen;
END_RCPP
}
// viterbi_g_cpp
arma::colvec viterbi_g_cpp(const arma::mat& allprobs, const arma::rowvec& delta, const arma::cube& Gamma);
RcppExport SEXP _LaMa_viterbi_g_cpp(SEXP allprobsSEXP, SEXP deltaSEXP, SEXP GammaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type allprobs(allprobsSEXP);
    Rcpp::traits::input_parameter< const arma::rowvec& >::type delta(deltaSEXP);
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    rcpp_result_gen = Rcpp::wrap(viterbi_g_cpp(allprobs, delta, Gamma));
    return rcpp_result_gen;
END_RCPP
}
// rep_times
arma::rowvec rep_times(const arma::rowvec& x, const IntegerVector& times);
RcppExport SEXP _LaMa_rep_times(SEXP xSEXP, SEXP timesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::rowvec& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type times(timesSEXP);
    rcpp_result_gen = Rcpp::wrap(rep_times(x, times));
    return rcpp_result_gen;
END_RCPP
}
// tpm_g_cpp
arma::cube tpm_g_cpp(const arma::mat& Z, const arma::mat& beta, const arma::uword N, const bool byrow);
RcppExport SEXP _LaMa_tpm_g_cpp(SEXP ZSEXP, SEXP betaSEXP, SEXP NSEXP, SEXP byrowSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< const arma::uword >::type N(NSEXP);
    Rcpp::traits::input_parameter< const bool >::type byrow(byrowSEXP);
    rcpp_result_gen = Rcpp::wrap(tpm_g_cpp(Z, beta, N, byrow));
    return rcpp_result_gen;
END_RCPP
}
// tpm_g2_cpp
arma::cube tpm_g2_cpp(const arma::mat& Eta, const arma::uword N, const bool byrow, const arma::uvec& ref);
RcppExport SEXP _LaMa_tpm_g2_cpp(SEXP EtaSEXP, SEXP NSEXP, SEXP byrowSEXP, SEXP refSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type Eta(EtaSEXP);
    Rcpp::traits::input_parameter< const arma::uword >::type N(NSEXP);
    Rcpp::traits::input_parameter< const bool >::type byrow(byrowSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type ref(refSEXP);
    rcpp_result_gen = Rcpp::wrap(tpm_g2_cpp(Eta, N, byrow, ref));
    return rcpp_result_gen;
END_RCPP
}
// tpm_g3_cpp
arma::cube tpm_g3_cpp(const arma::mat& Eta, const arma::uword N, const arma::uvec& ref, const bool byrow);
RcppExport SEXP _LaMa_tpm_g3_cpp(SEXP EtaSEXP, SEXP NSEXP, SEXP refSEXP, SEXP byrowSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type Eta(EtaSEXP);
    Rcpp::traits::input_parameter< const arma::uword >::type N(NSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type ref(refSEXP);
    Rcpp::traits::input_parameter< const bool >::type byrow(byrowSEXP);
    rcpp_result_gen = Rcpp::wrap(tpm_g3_cpp(Eta, N, ref, byrow));
    return rcpp_result_gen;
END_RCPP
}
// semigroup_cpp
arma::cube semigroup_cpp(const arma::mat& Q, const std::vector<double>& times);
RcppExport SEXP _LaMa_semigroup_cpp(SEXP QSEXP, SEXP timesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type Q(QSEXP);
    Rcpp::traits::input_parameter< const std::vector<double>& >::type times(timesSEXP);
    rcpp_result_gen = Rcpp::wrap(semigroup_cpp(Q, times));
    return rcpp_result_gen;
END_RCPP
}
// semigroup_g_cpp
arma::cube semigroup_g_cpp(const arma::cube& Q, const std::vector<double>& times);
RcppExport SEXP _LaMa_semigroup_g_cpp(SEXP QSEXP, SEXP timesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::cube& >::type Q(QSEXP);
    Rcpp::traits::input_parameter< const std::vector<double>& >::type times(timesSEXP);
    rcpp_result_gen = Rcpp::wrap(semigroup_g_cpp(Q, times));
    return rcpp_result_gen;
END_RCPP
}
// tpm_thinned_t_cpp
arma::mat tpm_thinned_t_cpp(const arma::cube& Gamma, const int t);
RcppExport SEXP _LaMa_tpm_thinned_t_cpp(SEXP GammaSEXP, SEXP tSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::cube& >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< const int >::type t(tSEXP);
    rcpp_result_gen = Rcpp::wrap(tpm_thinned_t_cpp(Gamma, t));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_LaMa_forward_cpp_h", (DL_FUNC) &_LaMa_forward_cpp_h, 3},
    {"_LaMa_forward_cpp_g", (DL_FUNC) &_LaMa_forward_cpp_g, 3},
    {"_LaMa_forward_cpp_g_tracks", (DL_FUNC) &_LaMa_forward_cpp_g_tracks, 4},
    {"_LaMa_forward_cpp_h_tracks", (DL_FUNC) &_LaMa_forward_cpp_h_tracks, 4},
    {"_LaMa_forward_cpp_p", (DL_FUNC) &_LaMa_forward_cpp_p, 4},
    {"_LaMa_forward_cpp_s", (DL_FUNC) &_LaMa_forward_cpp_s, 4},
    {"_LaMa_forward_cpp_sp", (DL_FUNC) &_LaMa_forward_cpp_sp, 5},
    {"_LaMa_logalpha_cpp", (DL_FUNC) &_LaMa_logalpha_cpp, 3},
    {"_LaMa_logbeta_cpp", (DL_FUNC) &_LaMa_logbeta_cpp, 2},
    {"_LaMa_viterbi_g_cpp", (DL_FUNC) &_LaMa_viterbi_g_cpp, 3},
    {"_LaMa_rep_times", (DL_FUNC) &_LaMa_rep_times, 2},
    {"_LaMa_tpm_g_cpp", (DL_FUNC) &_LaMa_tpm_g_cpp, 4},
    {"_LaMa_tpm_g2_cpp", (DL_FUNC) &_LaMa_tpm_g2_cpp, 4},
    {"_LaMa_tpm_g3_cpp", (DL_FUNC) &_LaMa_tpm_g3_cpp, 4},
    {"_LaMa_semigroup_cpp", (DL_FUNC) &_LaMa_semigroup_cpp, 2},
    {"_LaMa_semigroup_g_cpp", (DL_FUNC) &_LaMa_semigroup_g_cpp, 2},
    {"_LaMa_tpm_thinned_t_cpp", (DL_FUNC) &_LaMa_tpm_thinned_t_cpp, 2},
    {NULL, NULL, 0}
};

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