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

#include "../inst/include/MatchIt.h"
#include <Rcpp.h>
#include <string>
#include <set>

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

// dist_to_matrixC
NumericMatrix dist_to_matrixC(const NumericVector& d);
RcppExport SEXP _MatchIt_dist_to_matrixC(SEXP dSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericVector& >::type d(dSEXP);
    rcpp_result_gen = Rcpp::wrap(dist_to_matrixC(d));
    return rcpp_result_gen;
END_RCPP
}
// nn_matchC
IntegerMatrix nn_matchC(const IntegerVector& treat_, const IntegerVector& ord_, const IntegerVector& ratio, const LogicalVector& discarded, const int& reuse_max, const Nullable<NumericVector>& distance_, const Nullable<NumericMatrix>& distance_mat_, const Nullable<IntegerVector>& exact_, const Nullable<double>& caliper_dist_, const Nullable<NumericVector>& caliper_covs_, const Nullable<NumericMatrix>& caliper_covs_mat_, const Nullable<NumericMatrix>& mah_covs_, const Nullable<IntegerMatrix>& antiexact_covs_, const Nullable<IntegerVector>& unit_id_, const bool& disl_prog);
RcppExport SEXP _MatchIt_nn_matchC(SEXP treat_SEXP, SEXP ord_SEXP, SEXP ratioSEXP, SEXP discardedSEXP, SEXP reuse_maxSEXP, SEXP distance_SEXP, SEXP distance_mat_SEXP, SEXP exact_SEXP, SEXP caliper_dist_SEXP, SEXP caliper_covs_SEXP, SEXP caliper_covs_mat_SEXP, SEXP mah_covs_SEXP, SEXP antiexact_covs_SEXP, SEXP unit_id_SEXP, SEXP disl_progSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const IntegerVector& >::type treat_(treat_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type ord_(ord_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type ratio(ratioSEXP);
    Rcpp::traits::input_parameter< const LogicalVector& >::type discarded(discardedSEXP);
    Rcpp::traits::input_parameter< const int& >::type reuse_max(reuse_maxSEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericVector>& >::type distance_(distance_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericMatrix>& >::type distance_mat_(distance_mat_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerVector>& >::type exact_(exact_SEXP);
    Rcpp::traits::input_parameter< const Nullable<double>& >::type caliper_dist_(caliper_dist_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericVector>& >::type caliper_covs_(caliper_covs_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericMatrix>& >::type caliper_covs_mat_(caliper_covs_mat_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericMatrix>& >::type mah_covs_(mah_covs_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerMatrix>& >::type antiexact_covs_(antiexact_covs_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerVector>& >::type unit_id_(unit_id_SEXP);
    Rcpp::traits::input_parameter< const bool& >::type disl_prog(disl_progSEXP);
    rcpp_result_gen = Rcpp::wrap(nn_matchC(treat_, ord_, ratio, discarded, reuse_max, distance_, distance_mat_, exact_, caliper_dist_, caliper_covs_, caliper_covs_mat_, mah_covs_, antiexact_covs_, unit_id_, disl_prog));
    return rcpp_result_gen;
END_RCPP
}
// nn_matchC_vec
IntegerMatrix nn_matchC_vec(const IntegerVector& treat_, const IntegerVector& ord_, const IntegerVector& ratio_, const LogicalVector& discarded_, const int& reuse_max, const NumericVector& distance_, const Nullable<IntegerMatrix>& exact_, const Nullable<double>& caliper_dist_, const Nullable<NumericVector>& caliper_covs_, const Nullable<NumericMatrix>& caliper_covs_mat_, const Nullable<IntegerMatrix>& antiexact_covs_, const Nullable<IntegerVector>& unit_id_, const bool& disl_prog);
RcppExport SEXP _MatchIt_nn_matchC_vec(SEXP treat_SEXP, SEXP ord_SEXP, SEXP ratio_SEXP, SEXP discarded_SEXP, SEXP reuse_maxSEXP, SEXP distance_SEXP, SEXP exact_SEXP, SEXP caliper_dist_SEXP, SEXP caliper_covs_SEXP, SEXP caliper_covs_mat_SEXP, SEXP antiexact_covs_SEXP, SEXP unit_id_SEXP, SEXP disl_progSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const IntegerVector& >::type treat_(treat_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type ord_(ord_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type ratio_(ratio_SEXP);
    Rcpp::traits::input_parameter< const LogicalVector& >::type discarded_(discarded_SEXP);
    Rcpp::traits::input_parameter< const int& >::type reuse_max(reuse_maxSEXP);
    Rcpp::traits::input_parameter< const NumericVector& >::type distance_(distance_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerMatrix>& >::type exact_(exact_SEXP);
    Rcpp::traits::input_parameter< const Nullable<double>& >::type caliper_dist_(caliper_dist_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericVector>& >::type caliper_covs_(caliper_covs_SEXP);
    Rcpp::traits::input_parameter< const Nullable<NumericMatrix>& >::type caliper_covs_mat_(caliper_covs_mat_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerMatrix>& >::type antiexact_covs_(antiexact_covs_SEXP);
    Rcpp::traits::input_parameter< const Nullable<IntegerVector>& >::type unit_id_(unit_id_SEXP);
    Rcpp::traits::input_parameter< const bool& >::type disl_prog(disl_progSEXP);
    rcpp_result_gen = Rcpp::wrap(nn_matchC_vec(treat_, ord_, ratio_, discarded_, reuse_max, distance_, exact_, caliper_dist_, caliper_covs_, caliper_covs_mat_, antiexact_covs_, unit_id_, disl_prog));
    return rcpp_result_gen;
END_RCPP
}
// pairdistsubC
double pairdistsubC(const NumericVector& x_, const IntegerVector& t_, const IntegerVector& s_, const int& num_sub);
RcppExport SEXP _MatchIt_pairdistsubC(SEXP x_SEXP, SEXP t_SEXP, SEXP s_SEXP, SEXP num_subSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const NumericVector& >::type x_(x_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type t_(t_SEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type s_(s_SEXP);
    Rcpp::traits::input_parameter< const int& >::type num_sub(num_subSEXP);
    rcpp_result_gen = Rcpp::wrap(pairdistsubC(x_, t_, s_, num_sub));
    return rcpp_result_gen;
END_RCPP
}
// subclass2mmC
IntegerMatrix subclass2mmC(const IntegerVector& subclass, const IntegerVector& treat, const int& focal);
RcppExport SEXP _MatchIt_subclass2mmC(SEXP subclassSEXP, SEXP treatSEXP, SEXP focalSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const IntegerVector& >::type subclass(subclassSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type treat(treatSEXP);
    Rcpp::traits::input_parameter< const int& >::type focal(focalSEXP);
    rcpp_result_gen = Rcpp::wrap(subclass2mmC(subclass, treat, focal));
    return rcpp_result_gen;
END_RCPP
}
// tabulateC
IntegerVector tabulateC(const IntegerVector& bins, const Nullable<int>& nbins);
RcppExport SEXP _MatchIt_tabulateC(SEXP binsSEXP, SEXP nbinsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const IntegerVector& >::type bins(binsSEXP);
    Rcpp::traits::input_parameter< const Nullable<int>& >::type nbins(nbinsSEXP);
    rcpp_result_gen = Rcpp::wrap(tabulateC(bins, nbins));
    return rcpp_result_gen;
END_RCPP
}
// weights_matrixC
NumericVector weights_matrixC(const IntegerMatrix& mm, const IntegerVector& treat);
RcppExport SEXP _MatchIt_weights_matrixC(SEXP mmSEXP, SEXP treatSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const IntegerMatrix& >::type mm(mmSEXP);
    Rcpp::traits::input_parameter< const IntegerVector& >::type treat(treatSEXP);
    rcpp_result_gen = Rcpp::wrap(weights_matrixC(mm, treat));
    return rcpp_result_gen;
END_RCPP
}

// validate (ensure exported C++ functions exist before calling them)
static int _MatchIt_RcppExport_validate(const char* sig) { 
    static std::set<std::string> signatures;
    if (signatures.empty()) {
    }
    return signatures.find(sig) != signatures.end();
}

// registerCCallable (register entry points for exported C++ functions)
RcppExport SEXP _MatchIt_RcppExport_registerCCallable() { 
    R_RegisterCCallable("MatchIt", "_MatchIt_RcppExport_validate", (DL_FUNC)_MatchIt_RcppExport_validate);
    return R_NilValue;
}

static const R_CallMethodDef CallEntries[] = {
    {"_MatchIt_dist_to_matrixC", (DL_FUNC) &_MatchIt_dist_to_matrixC, 1},
    {"_MatchIt_nn_matchC", (DL_FUNC) &_MatchIt_nn_matchC, 15},
    {"_MatchIt_nn_matchC_vec", (DL_FUNC) &_MatchIt_nn_matchC_vec, 13},
    {"_MatchIt_pairdistsubC", (DL_FUNC) &_MatchIt_pairdistsubC, 4},
    {"_MatchIt_subclass2mmC", (DL_FUNC) &_MatchIt_subclass2mmC, 3},
    {"_MatchIt_tabulateC", (DL_FUNC) &_MatchIt_tabulateC, 2},
    {"_MatchIt_weights_matrixC", (DL_FUNC) &_MatchIt_weights_matrixC, 2},
    {"_MatchIt_RcppExport_registerCCallable", (DL_FUNC) &_MatchIt_RcppExport_registerCCallable, 0},
    {NULL, NULL, 0}
};

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