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

// buildA_kerr_cpp
NumericMatrix buildA_kerr_cpp(IntegerVector s, IntegerVector d, double w, int v);
RcppExport SEXP _AGHmatrix_buildA_kerr_cpp(SEXP sSEXP, SEXP dSEXP, SEXP wSEXP, SEXP vSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< IntegerVector >::type s(sSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type d(dSEXP);
    Rcpp::traits::input_parameter< double >::type w(wSEXP);
    Rcpp::traits::input_parameter< int >::type v(vSEXP);
    rcpp_result_gen = Rcpp::wrap(buildA_kerr_cpp(s, d, w, v));
    return rcpp_result_gen;
END_RCPP
}
// buildA_ploidy2_cpp
NumericMatrix buildA_ploidy2_cpp(IntegerVector sire, IntegerVector dire, int n);
RcppExport SEXP _AGHmatrix_buildA_ploidy2_cpp(SEXP sireSEXP, SEXP direSEXP, SEXP nSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< IntegerVector >::type sire(sireSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type dire(direSEXP);
    Rcpp::traits::input_parameter< int >::type n(nSEXP);
    rcpp_result_gen = Rcpp::wrap(buildA_ploidy2_cpp(sire, dire, n));
    return rcpp_result_gen;
END_RCPP
}
// buildA_slater_cpp
NumericMatrix buildA_slater_cpp(IntegerVector s, IntegerVector d, double w);
RcppExport SEXP _AGHmatrix_buildA_slater_cpp(SEXP sSEXP, SEXP dSEXP, SEXP wSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< IntegerVector >::type s(sSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type d(dSEXP);
    Rcpp::traits::input_parameter< double >::type w(wSEXP);
    rcpp_result_gen = Rcpp::wrap(buildA_slater_cpp(s, d, w));
    return rcpp_result_gen;
END_RCPP
}
// ascii_to_number
List ascii_to_number(CharacterMatrix pedigree_data, std::string unk);
RcppExport SEXP _AGHmatrix_ascii_to_number(SEXP pedigree_dataSEXP, SEXP unkSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< CharacterMatrix >::type pedigree_data(pedigree_dataSEXP);
    Rcpp::traits::input_parameter< std::string >::type unk(unkSEXP);
    rcpp_result_gen = Rcpp::wrap(ascii_to_number(pedigree_data, unk));
    return rcpp_result_gen;
END_RCPP
}
// check_matrix
void check_matrix(SEXP obj);
RcppExport SEXP _AGHmatrix_check_matrix(SEXP objSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< SEXP >::type obj(objSEXP);
    check_matrix(obj);
    return R_NilValue;
END_RCPP
}
// datatreat_cpp
List datatreat_cpp(CharacterMatrix data, int n_max, std::string unk, bool save);
RcppExport SEXP _AGHmatrix_datatreat_cpp(SEXP dataSEXP, SEXP n_maxSEXP, SEXP unkSEXP, SEXP saveSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< CharacterMatrix >::type data(dataSEXP);
    Rcpp::traits::input_parameter< int >::type n_max(n_maxSEXP);
    Rcpp::traits::input_parameter< std::string >::type unk(unkSEXP);
    Rcpp::traits::input_parameter< bool >::type save(saveSEXP);
    rcpp_result_gen = Rcpp::wrap(datatreat_cpp(data, n_max, unk, save));
    return rcpp_result_gen;
END_RCPP
}
// diploid_p0p2_TwoPQ_cpp
Rcpp::List diploid_p0p2_TwoPQ_cpp(const arma::mat& M);
RcppExport SEXP _AGHmatrix_diploid_p0p2_TwoPQ_cpp(SEXP MSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    rcpp_result_gen = Rcpp::wrap(diploid_p0p2_TwoPQ_cpp(M));
    return rcpp_result_gen;
END_RCPP
}
// buildDominanceMatrix_cpp
NumericMatrix buildDominanceMatrix_cpp(NumericMatrix A, IntegerVector s, IntegerVector d);
RcppExport SEXP _AGHmatrix_buildDominanceMatrix_cpp(SEXP ASEXP, SEXP sSEXP, SEXP dSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericMatrix >::type A(ASEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type s(sSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type d(dSEXP);
    rcpp_result_gen = Rcpp::wrap(buildDominanceMatrix_cpp(A, s, d));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_Endelman
arma::mat Gmatrix_Endelman(const arma::mat& M, int ploidy);
RcppExport SEXP _AGHmatrix_Gmatrix_Endelman(SEXP MSEXP, SEXP ploidySEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    Rcpp::traits::input_parameter< int >::type ploidy(ploidySEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_Endelman(M, ploidy));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_MarkersMask
arma::mat Gmatrix_MarkersMask(const arma::mat& M);
RcppExport SEXP _AGHmatrix_Gmatrix_MarkersMask(SEXP MSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_MarkersMask(M));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_Slater
arma::mat Gmatrix_Slater(const arma::mat& M, const arma::vec& Frequency, const arma::mat& FreqP, const int NumberMarkers);
RcppExport SEXP _AGHmatrix_Gmatrix_Slater(SEXP MSEXP, SEXP FrequencySEXP, SEXP FreqPSEXP, SEXP NumberMarkersSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type Frequency(FrequencySEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type FreqP(FreqPSEXP);
    Rcpp::traits::input_parameter< const int >::type NumberMarkers(NumberMarkersSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_Slater(M, Frequency, FreqP, NumberMarkers));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_Su
arma::mat Gmatrix_Su(const arma::mat& M);
RcppExport SEXP _AGHmatrix_Gmatrix_Su(SEXP MSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_Su(M));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_vanraden
arma::mat Gmatrix_vanraden(const arma::mat& M, const arma::vec& FreqP, const double denom);
RcppExport SEXP _AGHmatrix_Gmatrix_vanraden(SEXP MSEXP, SEXP FreqPSEXP, SEXP denomSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type FreqP(FreqPSEXP);
    Rcpp::traits::input_parameter< const double >::type denom(denomSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_vanraden(M, FreqP, denom));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_VanRaden_weighted
arma::mat Gmatrix_VanRaden_weighted(const arma::mat& M, const arma::vec& weights, const arma::vec& FreqP, const double denom);
RcppExport SEXP _AGHmatrix_Gmatrix_VanRaden_weighted(SEXP MSEXP, SEXP weightsSEXP, SEXP FreqPSEXP, SEXP denomSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type M(MSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type weights(weightsSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type FreqP(FreqPSEXP);
    Rcpp::traits::input_parameter< const double >::type denom(denomSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_VanRaden_weighted(M, weights, FreqP, denom));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_vanraden_poly_unweighted
arma::mat Gmatrix_vanraden_poly_unweighted(const arma::mat& X, const unsigned int ploidy, const bool ratio, const bool ploidy_correction);
RcppExport SEXP _AGHmatrix_Gmatrix_vanraden_poly_unweighted(SEXP XSEXP, SEXP ploidySEXP, SEXP ratioSEXP, SEXP ploidy_correctionSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type ploidy(ploidySEXP);
    Rcpp::traits::input_parameter< const bool >::type ratio(ratioSEXP);
    Rcpp::traits::input_parameter< const bool >::type ploidy_correction(ploidy_correctionSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_vanraden_poly_unweighted(X, ploidy, ratio, ploidy_correction));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_vanraden_poly_weighted
arma::mat Gmatrix_vanraden_poly_weighted(const arma::mat& X, const arma::vec& w, const unsigned int ploidy, const bool ratio, const bool ploidy_correction);
RcppExport SEXP _AGHmatrix_Gmatrix_vanraden_poly_weighted(SEXP XSEXP, SEXP wSEXP, SEXP ploidySEXP, SEXP ratioSEXP, SEXP ploidy_correctionSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type w(wSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type ploidy(ploidySEXP);
    Rcpp::traits::input_parameter< const bool >::type ratio(ratioSEXP);
    Rcpp::traits::input_parameter< const bool >::type ploidy_correction(ploidy_correctionSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_vanraden_poly_weighted(X, w, ploidy, ratio, ploidy_correction));
    return rcpp_result_gen;
END_RCPP
}
// Gmatrix_Vitezica
arma::mat Gmatrix_Vitezica(arma::mat M, const arma::mat& FreqP);
RcppExport SEXP _AGHmatrix_Gmatrix_Vitezica(SEXP MSEXP, SEXP FreqPSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type M(MSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type FreqP(FreqPSEXP);
    rcpp_result_gen = Rcpp::wrap(Gmatrix_Vitezica(M, FreqP));
    return rcpp_result_gen;
END_RCPP
}
// H_martini_blocks
Rcpp::List H_martini_blocks(const arma::mat& A12, const arma::mat& A22, const arma::mat& G22, const double tau, const double omega);
RcppExport SEXP _AGHmatrix_H_martini_blocks(SEXP A12SEXP, SEXP A22SEXP, SEXP G22SEXP, SEXP tauSEXP, SEXP omegaSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type A12(A12SEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type A22(A22SEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type G22(G22SEXP);
    Rcpp::traits::input_parameter< const double >::type tau(tauSEXP);
    Rcpp::traits::input_parameter< const double >::type omega(omegaSEXP);
    rcpp_result_gen = Rcpp::wrap(H_martini_blocks(A12, A22, G22, tau, omega));
    return rcpp_result_gen;
END_RCPP
}
// munoz_var_mean_by_Aclass
Rcpp::List munoz_var_mean_by_Aclass(const arma::mat& G, const arma::mat& A, const int round_digits);
RcppExport SEXP _AGHmatrix_munoz_var_mean_by_Aclass(SEXP GSEXP, SEXP ASEXP, SEXP round_digitsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type G(GSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type A(ASEXP);
    Rcpp::traits::input_parameter< const int >::type round_digits(round_digitsSEXP);
    rcpp_result_gen = Rcpp::wrap(munoz_var_mean_by_Aclass(G, A, round_digits));
    return rcpp_result_gen;
END_RCPP
}
// slater_par_cpp
arma::mat slater_par_cpp(const arma::mat& X, const unsigned int ploidy);
RcppExport SEXP _AGHmatrix_slater_par_cpp(SEXP XSEXP, SEXP ploidySEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type ploidy(ploidySEXP);
    rcpp_result_gen = Rcpp::wrap(slater_par_cpp(X, ploidy));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_AGHmatrix_buildA_kerr_cpp", (DL_FUNC) &_AGHmatrix_buildA_kerr_cpp, 4},
    {"_AGHmatrix_buildA_ploidy2_cpp", (DL_FUNC) &_AGHmatrix_buildA_ploidy2_cpp, 3},
    {"_AGHmatrix_buildA_slater_cpp", (DL_FUNC) &_AGHmatrix_buildA_slater_cpp, 3},
    {"_AGHmatrix_ascii_to_number", (DL_FUNC) &_AGHmatrix_ascii_to_number, 2},
    {"_AGHmatrix_check_matrix", (DL_FUNC) &_AGHmatrix_check_matrix, 1},
    {"_AGHmatrix_datatreat_cpp", (DL_FUNC) &_AGHmatrix_datatreat_cpp, 4},
    {"_AGHmatrix_diploid_p0p2_TwoPQ_cpp", (DL_FUNC) &_AGHmatrix_diploid_p0p2_TwoPQ_cpp, 1},
    {"_AGHmatrix_buildDominanceMatrix_cpp", (DL_FUNC) &_AGHmatrix_buildDominanceMatrix_cpp, 3},
    {"_AGHmatrix_Gmatrix_Endelman", (DL_FUNC) &_AGHmatrix_Gmatrix_Endelman, 2},
    {"_AGHmatrix_Gmatrix_MarkersMask", (DL_FUNC) &_AGHmatrix_Gmatrix_MarkersMask, 1},
    {"_AGHmatrix_Gmatrix_Slater", (DL_FUNC) &_AGHmatrix_Gmatrix_Slater, 4},
    {"_AGHmatrix_Gmatrix_Su", (DL_FUNC) &_AGHmatrix_Gmatrix_Su, 1},
    {"_AGHmatrix_Gmatrix_vanraden", (DL_FUNC) &_AGHmatrix_Gmatrix_vanraden, 3},
    {"_AGHmatrix_Gmatrix_VanRaden_weighted", (DL_FUNC) &_AGHmatrix_Gmatrix_VanRaden_weighted, 4},
    {"_AGHmatrix_Gmatrix_vanraden_poly_unweighted", (DL_FUNC) &_AGHmatrix_Gmatrix_vanraden_poly_unweighted, 4},
    {"_AGHmatrix_Gmatrix_vanraden_poly_weighted", (DL_FUNC) &_AGHmatrix_Gmatrix_vanraden_poly_weighted, 5},
    {"_AGHmatrix_Gmatrix_Vitezica", (DL_FUNC) &_AGHmatrix_Gmatrix_Vitezica, 2},
    {"_AGHmatrix_H_martini_blocks", (DL_FUNC) &_AGHmatrix_H_martini_blocks, 5},
    {"_AGHmatrix_munoz_var_mean_by_Aclass", (DL_FUNC) &_AGHmatrix_munoz_var_mean_by_Aclass, 3},
    {"_AGHmatrix_slater_par_cpp", (DL_FUNC) &_AGHmatrix_slater_par_cpp, 2},
    {NULL, NULL, 0}
};

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