// 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

// GS_NTU
arma::urowvec GS_NTU(arma::mat U, arma::mat V);
RcppExport SEXP _rpm_GS_NTU(SEXP USEXP, SEXP VSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type U(USEXP);
    Rcpp::traits::input_parameter< arma::mat >::type V(VSEXP);
    rcpp_result_gen = Rcpp::wrap(GS_NTU(U, V));
    return rcpp_result_gen;
END_RCPP
}
// GSi_NTU
arma::urowvec GSi_NTU(arma::imat U, arma::imat V, int nmax);
RcppExport SEXP _rpm_GSi_NTU(SEXP USEXP, SEXP VSEXP, SEXP nmaxSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::imat >::type U(USEXP);
    Rcpp::traits::input_parameter< arma::imat >::type V(VSEXP);
    Rcpp::traits::input_parameter< int >::type nmax(nmaxSEXP);
    rcpp_result_gen = Rcpp::wrap(GSi_NTU(U, V, nmax));
    return rcpp_result_gen;
END_RCPP
}
// GSi_NTU_O
arma::urowvec GSi_NTU_O(arma::imat U, arma::imat V, arma::imat O, arma::imat Ua, int nmax);
RcppExport SEXP _rpm_GSi_NTU_O(SEXP USEXP, SEXP VSEXP, SEXP OSEXP, SEXP UaSEXP, SEXP nmaxSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::imat >::type U(USEXP);
    Rcpp::traits::input_parameter< arma::imat >::type V(VSEXP);
    Rcpp::traits::input_parameter< arma::imat >::type O(OSEXP);
    Rcpp::traits::input_parameter< arma::imat >::type Ua(UaSEXP);
    Rcpp::traits::input_parameter< int >::type nmax(nmaxSEXP);
    rcpp_result_gen = Rcpp::wrap(GSi_NTU_O(U, V, O, Ua, nmax));
    return rcpp_result_gen;
END_RCPP
}
// PSeqcond
arma::vec PSeqcond(arma::vec beta, arma::vec Gamma, arma::cube S, arma::cube X, arma::cube Z, arma::vec pmfW, arma::vec pmfM, double gw, double gm);
RcppExport SEXP _rpm_PSeqcond(SEXP betaSEXP, SEXP GammaSEXP, SEXP SSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type X(XSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(PSeqcond(beta, Gamma, S, X, Z, pmfW, pmfM, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// PSgeqcond
arma::mat PSgeqcond(arma::vec beta, arma::vec Gamma, arma::cube S, arma::cube X, arma::cube Z, arma::vec pmfW, arma::vec pmfM, double gw, double gm);
RcppExport SEXP _rpm_PSgeqcond(SEXP betaSEXP, SEXP GammaSEXP, SEXP SSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type X(XSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(PSgeqcond(beta, Gamma, S, X, Z, pmfW, pmfM, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// PropMax
IntegerMatrix PropMax(const NumericMatrix& stat);
RcppExport SEXP _rpm_PropMax(SEXP statSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericMatrix& >::type stat(statSEXP);
    rcpp_result_gen = Rcpp::wrap(PropMax(stat));
    return rcpp_result_gen;
END_RCPP
}
// augpmf
NumericMatrix augpmf(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, double gw, double gm);
RcppExport SEXP _rpm_augpmf(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(augpmf(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// augpmfWM
NumericMatrix augpmfWM(NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, double gw, double gm, NumericVector pmfW_N, NumericVector pmfM_N, double gwN, double gmN);
RcppExport SEXP _rpm_augpmfWM(SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP pmfW_NSEXP, SEXP pmfM_NSEXP, SEXP gwNSEXP, SEXP gmNSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW_N(pmfW_NSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM_N(pmfM_NSEXP);
    Rcpp::traits::input_parameter< double >::type gwN(gwNSEXP);
    Rcpp::traits::input_parameter< double >::type gmN(gmNSEXP);
    rcpp_result_gen = Rcpp::wrap(augpmfWM(pmfW, pmfM, pmf, gw, gm, pmfW_N, pmfM_N, gwN, gmN));
    return rcpp_result_gen;
END_RCPP
}
// auxGamma
arma::vec auxGamma(arma::vec beta, arma::vec GammaW, arma::vec GammaM, arma::cube S, arma::cube X, arma::cube Z, arma::vec pmfW, arma::vec pmfM, double gw, double gm);
RcppExport SEXP _rpm_auxGamma(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type X(XSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(auxGamma(beta, GammaW, GammaM, S, X, Z, pmfW, pmfM, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// checkstable
int checkstable(const NumericMatrix& U, const NumericMatrix& V, const IntegerVector& m, const IntegerVector& w);
RcppExport SEXP _rpm_checkstable(SEXP USEXP, SEXP VSEXP, SEXP mSEXP, SEXP wSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericMatrix& >::type U(USEXP);
    Rcpp::traits::input_parameter< const NumericMatrix& >::type V(VSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type m(mSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type w(wSEXP);
    rcpp_result_gen = Rcpp::wrap(checkstable(U, V, m, w));
    return rcpp_result_gen;
END_RCPP
}
// colMax
NumericVector colMax(const NumericMatrix& stat);
RcppExport SEXP _rpm_colMax(SEXP statSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericMatrix& >::type stat(statSEXP);
    rcpp_result_gen = Rcpp::wrap(colMax(stat));
    return rcpp_result_gen;
END_RCPP
}
// eqcond
NumericVector eqcond(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm, int constraints);
RcppExport SEXP _rpm_eqcond(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP constraintsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< int >::type constraints(constraintsSEXP);
    rcpp_result_gen = Rcpp::wrap(eqcond(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm, constraints));
    return rcpp_result_gen;
END_RCPP
}
// gloglik
NumericVector gloglik(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm, int constraints);
RcppExport SEXP _rpm_gloglik(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP constraintsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< int >::type constraints(constraintsSEXP);
    rcpp_result_gen = Rcpp::wrap(gloglik(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm, constraints));
    return rcpp_result_gen;
END_RCPP
}
// hloglik
NumericMatrix hloglik(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm, int constraints);
RcppExport SEXP _rpm_hloglik(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP constraintsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< int >::type constraints(constraintsSEXP);
    rcpp_result_gen = Rcpp::wrap(hloglik(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm, constraints));
    return rcpp_result_gen;
END_RCPP
}
// jeqcond
NumericMatrix jeqcond(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm, int constraints);
RcppExport SEXP _rpm_jeqcond(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP constraintsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< int >::type constraints(constraintsSEXP);
    rcpp_result_gen = Rcpp::wrap(jeqcond(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm, constraints));
    return rcpp_result_gen;
END_RCPP
}
// loglik
double loglik(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm, int constraints);
RcppExport SEXP _rpm_loglik(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP, SEXP constraintsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    Rcpp::traits::input_parameter< int >::type constraints(constraintsSEXP);
    rcpp_result_gen = Rcpp::wrap(loglik(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm, constraints));
    return rcpp_result_gen;
END_RCPP
}
// logpmfest
arma::mat logpmfest(arma::vec beta, arma::vec GammaW, arma::vec GammaM, arma::cube S, arma::cube X, arma::cube Z, arma::vec pmfW, arma::vec pmfM, double gw, double gm);
RcppExport SEXP _rpm_logpmfest(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type X(XSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(logpmfest(beta, GammaW, GammaM, S, X, Z, pmfW, pmfM, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// probcounts
double probcounts(arma::vec beta, arma::vec Gamma, arma::cube S, arma::cube X, arma::cube Z, arma::vec pmfW, arma::vec pmfM, arma::mat counts, double gw, double gm);
RcppExport SEXP _rpm_probcounts(SEXP betaSEXP, SEXP GammaSEXP, SEXP SSEXP, SEXP XSEXP, SEXP ZSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type Gamma(GammaSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type S(SSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type X(XSEXP);
    Rcpp::traits::input_parameter< arma::cube >::type Z(ZSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< arma::mat >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(probcounts(beta, Gamma, S, X, Z, pmfW, pmfM, counts, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// qloglik
double qloglik(NumericVector beta, NumericVector GammaW, NumericVector GammaM, NumericVector Sd, NumericVector Xd, NumericVector Zd, IntegerVector Sdim, IntegerVector Xdim, IntegerVector Zdim, NumericVector pmfW, NumericVector pmfM, NumericMatrix pmf, NumericMatrix counts, double gw, double gm);
RcppExport SEXP _rpm_qloglik(SEXP betaSEXP, SEXP GammaWSEXP, SEXP GammaMSEXP, SEXP SdSEXP, SEXP XdSEXP, SEXP ZdSEXP, SEXP SdimSEXP, SEXP XdimSEXP, SEXP ZdimSEXP, SEXP pmfWSEXP, SEXP pmfMSEXP, SEXP pmfSEXP, SEXP countsSEXP, SEXP gwSEXP, SEXP gmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaW(GammaWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type GammaM(GammaMSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Sd(SdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Xd(XdSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type Zd(ZdSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Sdim(SdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Xdim(XdimSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type Zdim(ZdimSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfW(pmfWSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type pmfM(pmfMSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type pmf(pmfSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type counts(countsSEXP);
    Rcpp::traits::input_parameter< double >::type gw(gwSEXP);
    Rcpp::traits::input_parameter< double >::type gm(gmSEXP);
    rcpp_result_gen = Rcpp::wrap(qloglik(beta, GammaW, GammaM, Sd, Xd, Zd, Sdim, Xdim, Zdim, pmfW, pmfM, pmf, counts, gw, gm));
    return rcpp_result_gen;
END_RCPP
}
// rowMax
NumericVector rowMax(const NumericMatrix& stat);
RcppExport SEXP _rpm_rowMax(SEXP statSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericMatrix& >::type stat(statSEXP);
    rcpp_result_gen = Rcpp::wrap(rowMax(stat));
    return rcpp_result_gen;
END_RCPP
}
// rowwise_imax_idx
arma::urowvec rowwise_imax_idx(const arma::imat& A);
RcppExport SEXP _rpm_rowwise_imax_idx(SEXP ASEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::imat& >::type A(ASEXP);
    rcpp_result_gen = Rcpp::wrap(rowwise_imax_idx(A));
    return rcpp_result_gen;
END_RCPP
}
// rowwise_max_idx
arma::urowvec rowwise_max_idx(const arma::mat& A);
RcppExport SEXP _rpm_rowwise_max_idx(SEXP ASEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type A(ASEXP);
    rcpp_result_gen = Rcpp::wrap(rowwise_max_idx(A));
    return rcpp_result_gen;
END_RCPP
}
// stablearma
unsigned int stablearma(arma::mat U, arma::mat V, arma::ivec m, arma::ivec w);
RcppExport SEXP _rpm_stablearma(SEXP USEXP, SEXP VSEXP, SEXP mSEXP, SEXP wSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type U(USEXP);
    Rcpp::traits::input_parameter< arma::mat >::type V(VSEXP);
    Rcpp::traits::input_parameter< arma::ivec >::type m(mSEXP);
    Rcpp::traits::input_parameter< arma::ivec >::type w(wSEXP);
    rcpp_result_gen = Rcpp::wrap(stablearma(U, V, m, w));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_rpm_GS_NTU", (DL_FUNC) &_rpm_GS_NTU, 2},
    {"_rpm_GSi_NTU", (DL_FUNC) &_rpm_GSi_NTU, 3},
    {"_rpm_GSi_NTU_O", (DL_FUNC) &_rpm_GSi_NTU_O, 5},
    {"_rpm_PSeqcond", (DL_FUNC) &_rpm_PSeqcond, 9},
    {"_rpm_PSgeqcond", (DL_FUNC) &_rpm_PSgeqcond, 9},
    {"_rpm_PropMax", (DL_FUNC) &_rpm_PropMax, 1},
    {"_rpm_augpmf", (DL_FUNC) &_rpm_augpmf, 13},
    {"_rpm_augpmfWM", (DL_FUNC) &_rpm_augpmfWM, 9},
    {"_rpm_auxGamma", (DL_FUNC) &_rpm_auxGamma, 10},
    {"_rpm_checkstable", (DL_FUNC) &_rpm_checkstable, 4},
    {"_rpm_colMax", (DL_FUNC) &_rpm_colMax, 1},
    {"_rpm_eqcond", (DL_FUNC) &_rpm_eqcond, 16},
    {"_rpm_gloglik", (DL_FUNC) &_rpm_gloglik, 16},
    {"_rpm_hloglik", (DL_FUNC) &_rpm_hloglik, 16},
    {"_rpm_jeqcond", (DL_FUNC) &_rpm_jeqcond, 16},
    {"_rpm_loglik", (DL_FUNC) &_rpm_loglik, 16},
    {"_rpm_logpmfest", (DL_FUNC) &_rpm_logpmfest, 10},
    {"_rpm_probcounts", (DL_FUNC) &_rpm_probcounts, 10},
    {"_rpm_qloglik", (DL_FUNC) &_rpm_qloglik, 15},
    {"_rpm_rowMax", (DL_FUNC) &_rpm_rowMax, 1},
    {"_rpm_rowwise_imax_idx", (DL_FUNC) &_rpm_rowwise_imax_idx, 1},
    {"_rpm_rowwise_max_idx", (DL_FUNC) &_rpm_rowwise_max_idx, 1},
    {"_rpm_stablearma", (DL_FUNC) &_rpm_stablearma, 4},
    {NULL, NULL, 0}
};

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