Skip to content

Instantly share code, notes, and snippets.

@BerriJ
Created January 7, 2021 16:01
Show Gist options
  • Save BerriJ/55d48c59eb919047b8ccb28ba69e4d58 to your computer and use it in GitHub Desktop.
Save BerriJ/55d48c59eb919047b8ccb28ba69e4d58 to your computer and use it in GitHub Desktop.
Example Rcpp armadillo comparison double to vec
// [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
using namespace arma;
// [[Rcpp::export]]
vec testfun(const vec &x,
const double &y,
const double &z)
{
vec out = ((y < x) - z) % (x - y);
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment