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

// cpp_set_num_threads
int cpp_set_num_threads(int threads);
RcppExport SEXP _visPedigree_cpp_set_num_threads(SEXP threadsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< int >::type threads(threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_set_num_threads(threads));
    return rcpp_result_gen;
END_RCPP
}
// cpp_openmp_available
bool cpp_openmp_available();
RcppExport SEXP _visPedigree_cpp_openmp_available() {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    rcpp_result_gen = Rcpp::wrap(cpp_openmp_available());
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_inbreeding
List cpp_calculate_inbreeding(IntegerVector sire, IntegerVector dam);
RcppExport SEXP _visPedigree_cpp_calculate_inbreeding(SEXP sireSEXP, SEXP damSEXP) {
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 dam(damSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_calculate_inbreeding(sire, dam));
    return rcpp_result_gen;
END_RCPP
}
// cpp_build_ainv_triplets
List cpp_build_ainv_triplets(IntegerVector sire, IntegerVector dam, NumericVector dii);
RcppExport SEXP _visPedigree_cpp_build_ainv_triplets(SEXP sireSEXP, SEXP damSEXP, SEXP diiSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type dii(diiSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_build_ainv_triplets(sire, dam, dii));
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_A
arma::mat cpp_calculate_A(IntegerVector sire, IntegerVector dam);
RcppExport SEXP _visPedigree_cpp_calculate_A(SEXP sireSEXP, SEXP damSEXP) {
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 dam(damSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_calculate_A(sire, dam));
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_D
arma::mat cpp_calculate_D(IntegerVector sire, IntegerVector dam, const arma::mat& A);
RcppExport SEXP _visPedigree_cpp_calculate_D(SEXP sireSEXP, SEXP damSEXP, SEXP ASEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type A(ASEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_calculate_D(sire, dam, A));
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_AA
arma::mat cpp_calculate_AA(const arma::mat& A);
RcppExport SEXP _visPedigree_cpp_calculate_AA(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(cpp_calculate_AA(A));
    return rcpp_result_gen;
END_RCPP
}
// cpp_invert_dense
arma::mat cpp_invert_dense(const arma::mat& M);
RcppExport SEXP _visPedigree_cpp_invert_dense(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(cpp_invert_dense(M));
    return rcpp_result_gen;
END_RCPP
}
// cpp_invert_sympd
arma::mat cpp_invert_sympd(const arma::mat& M);
RcppExport SEXP _visPedigree_cpp_invert_sympd(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(cpp_invert_sympd(M));
    return rcpp_result_gen;
END_RCPP
}
// cpp_invert_auto
arma::mat cpp_invert_auto(const arma::mat& M);
RcppExport SEXP _visPedigree_cpp_invert_auto(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(cpp_invert_auto(M));
    return rcpp_result_gen;
END_RCPP
}
// cpp_multiply_A
arma::mat cpp_multiply_A(IntegerVector sire, IntegerVector dam, NumericVector dii, const arma::mat& rhs);
RcppExport SEXP _visPedigree_cpp_multiply_A(SEXP sireSEXP, SEXP damSEXP, SEXP diiSEXP, SEXP rhsSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type dii(diiSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type rhs(rhsSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_multiply_A(sire, dam, dii, rhs));
    return rcpp_result_gen;
END_RCPP
}
// cpp_multiply_Ainv
arma::mat cpp_multiply_Ainv(IntegerVector sire, IntegerVector dam, NumericVector dii, const arma::mat& rhs);
RcppExport SEXP _visPedigree_cpp_multiply_Ainv(SEXP sireSEXP, SEXP damSEXP, SEXP diiSEXP, SEXP rhsSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type dii(diiSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type rhs(rhsSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_multiply_Ainv(sire, dam, dii, rhs));
    return rcpp_result_gen;
END_RCPP
}
// cpp_assign_generations_top
IntegerVector cpp_assign_generations_top(IntegerVector sire, IntegerVector dam, IntegerVector topo_order);
RcppExport SEXP _visPedigree_cpp_assign_generations_top(SEXP sireSEXP, SEXP damSEXP, SEXP topo_orderSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type topo_order(topo_orderSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_assign_generations_top(sire, dam, topo_order));
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_partial_inbreeding
NumericMatrix cpp_calculate_partial_inbreeding(IntegerVector sire, IntegerVector dam, NumericVector dii, IntegerVector ancestors);
RcppExport SEXP _visPedigree_cpp_calculate_partial_inbreeding(SEXP sireSEXP, SEXP damSEXP, SEXP diiSEXP, SEXP ancestorsSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type dii(diiSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type ancestors(ancestorsSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_calculate_partial_inbreeding(sire, dam, dii, ancestors));
    return rcpp_result_gen;
END_RCPP
}
// cpp_assign_generations_bottom
IntegerVector cpp_assign_generations_bottom(IntegerVector sire, IntegerVector dam, IntegerVector topo_order);
RcppExport SEXP _visPedigree_cpp_assign_generations_bottom(SEXP sireSEXP, SEXP damSEXP, SEXP topo_orderSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type topo_order(topo_orderSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_assign_generations_bottom(sire, dam, topo_order));
    return rcpp_result_gen;
END_RCPP
}
// cpp_pedcontrib
List cpp_pedcontrib(IntegerVector sire, IntegerVector dam, IntegerVector cohort_pos, int mode);
RcppExport SEXP _visPedigree_cpp_pedcontrib(SEXP sireSEXP, SEXP damSEXP, SEXP cohort_posSEXP, SEXP modeSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type cohort_pos(cohort_posSEXP);
    Rcpp::traits::input_parameter< int >::type mode(modeSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_pedcontrib(sire, dam, cohort_pos, mode));
    return rcpp_result_gen;
END_RCPP
}
// cpp_calculate_ancestry
NumericMatrix cpp_calculate_ancestry(IntegerVector sire, IntegerVector dam, NumericMatrix res_mat);
RcppExport SEXP _visPedigree_cpp_calculate_ancestry(SEXP sireSEXP, SEXP damSEXP, SEXP res_matSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< NumericMatrix >::type res_mat(res_matSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_calculate_ancestry(sire, dam, res_mat));
    return rcpp_result_gen;
END_RCPP
}
// cpp_trace_ancestors
IntegerVector cpp_trace_ancestors(IntegerVector sire, IntegerVector dam, IntegerVector targets, int max_gen);
RcppExport SEXP _visPedigree_cpp_trace_ancestors(SEXP sireSEXP, SEXP damSEXP, SEXP targetsSEXP, SEXP max_genSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type targets(targetsSEXP);
    Rcpp::traits::input_parameter< int >::type max_gen(max_genSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_trace_ancestors(sire, dam, targets, max_gen));
    return rcpp_result_gen;
END_RCPP
}
// cpp_trace_descendants
IntegerVector cpp_trace_descendants(IntegerVector sire, IntegerVector dam, IntegerVector targets, int max_gen);
RcppExport SEXP _visPedigree_cpp_trace_descendants(SEXP sireSEXP, SEXP damSEXP, SEXP targetsSEXP, SEXP max_genSEXP) {
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 dam(damSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type targets(targetsSEXP);
    Rcpp::traits::input_parameter< int >::type max_gen(max_genSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_trace_descendants(sire, dam, targets, max_gen));
    return rcpp_result_gen;
END_RCPP
}
// cpp_topo_order
IntegerVector cpp_topo_order(IntegerVector sire, IntegerVector dam);
RcppExport SEXP _visPedigree_cpp_topo_order(SEXP sireSEXP, SEXP damSEXP) {
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 dam(damSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_topo_order(sire, dam));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_visPedigree_cpp_set_num_threads", (DL_FUNC) &_visPedigree_cpp_set_num_threads, 1},
    {"_visPedigree_cpp_openmp_available", (DL_FUNC) &_visPedigree_cpp_openmp_available, 0},
    {"_visPedigree_cpp_calculate_inbreeding", (DL_FUNC) &_visPedigree_cpp_calculate_inbreeding, 2},
    {"_visPedigree_cpp_build_ainv_triplets", (DL_FUNC) &_visPedigree_cpp_build_ainv_triplets, 3},
    {"_visPedigree_cpp_calculate_A", (DL_FUNC) &_visPedigree_cpp_calculate_A, 2},
    {"_visPedigree_cpp_calculate_D", (DL_FUNC) &_visPedigree_cpp_calculate_D, 3},
    {"_visPedigree_cpp_calculate_AA", (DL_FUNC) &_visPedigree_cpp_calculate_AA, 1},
    {"_visPedigree_cpp_invert_dense", (DL_FUNC) &_visPedigree_cpp_invert_dense, 1},
    {"_visPedigree_cpp_invert_sympd", (DL_FUNC) &_visPedigree_cpp_invert_sympd, 1},
    {"_visPedigree_cpp_invert_auto", (DL_FUNC) &_visPedigree_cpp_invert_auto, 1},
    {"_visPedigree_cpp_multiply_A", (DL_FUNC) &_visPedigree_cpp_multiply_A, 4},
    {"_visPedigree_cpp_multiply_Ainv", (DL_FUNC) &_visPedigree_cpp_multiply_Ainv, 4},
    {"_visPedigree_cpp_assign_generations_top", (DL_FUNC) &_visPedigree_cpp_assign_generations_top, 3},
    {"_visPedigree_cpp_calculate_partial_inbreeding", (DL_FUNC) &_visPedigree_cpp_calculate_partial_inbreeding, 4},
    {"_visPedigree_cpp_assign_generations_bottom", (DL_FUNC) &_visPedigree_cpp_assign_generations_bottom, 3},
    {"_visPedigree_cpp_pedcontrib", (DL_FUNC) &_visPedigree_cpp_pedcontrib, 4},
    {"_visPedigree_cpp_calculate_ancestry", (DL_FUNC) &_visPedigree_cpp_calculate_ancestry, 3},
    {"_visPedigree_cpp_trace_ancestors", (DL_FUNC) &_visPedigree_cpp_trace_ancestors, 4},
    {"_visPedigree_cpp_trace_descendants", (DL_FUNC) &_visPedigree_cpp_trace_descendants, 4},
    {"_visPedigree_cpp_topo_order", (DL_FUNC) &_visPedigree_cpp_topo_order, 2},
    {NULL, NULL, 0}
};

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