Skip to content

Commit

Permalink
src i386
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindhebbali committed May 28, 2020
1 parent 6f459b7 commit 2e27512
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src-i386/RcppExports.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include <Rcpp.h>

using namespace Rcpp;

// blr_pairs_cpp
DataFrame blr_pairs_cpp(NumericVector x, NumericVector y);
RcppExport SEXP _blorr_blr_pairs_cpp(SEXP xSEXP, SEXP ySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< NumericVector >::type x(xSEXP);
Rcpp::traits::input_parameter< NumericVector >::type y(ySEXP);
rcpp_result_gen = Rcpp::wrap(blr_pairs_cpp(x, y));
return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"_blorr_blr_pairs_cpp", (DL_FUNC) &_blorr_blr_pairs_cpp, 2},
{NULL, NULL, 0}
};

RcppExport void R_init_blorr(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
Binary file added src-i386/RcppExports.o
Binary file not shown.
43 changes: 43 additions & 0 deletions src-i386/blr-pairs-cpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::plugins("cpp11")]]
// [[Rcpp::export]]
DataFrame blr_pairs_cpp(NumericVector x, NumericVector y) {

// loop counters
int n1 = x.size();
int n2 = y.size();

// count pairs
int pairs_count = 0;
int concordant = 0;
int discordant = 0;
int ties = 0;

// compute
for(int i = 0; i < n1; i++) {
for(int j = 0; j < n2; j++) {

pairs_count++;

if (x[i] > y[j]) {
concordant++;
} else if (x[i] == y[j]) {
ties++;
} else {
discordant++;
}

}
}

DataFrame df = DataFrame::create(Named("pairs") = pairs_count,
Named("concordant") = concordant,
Named("discordant") = discordant,
Named("ties") = ties);

return df;

}

Binary file added src-i386/blr-pairs-cpp.o
Binary file not shown.

0 comments on commit 2e27512

Please sign in to comment.