Created
February 24, 2023 06:21
-
-
Save abikoushi/9b5fa94dda405241ac69e3ee26d43c0c to your computer and use it in GitHub Desktop.
An exaple of calling R function in RcppArmadillo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <RcppArmadillo.h> | |
// [[Rcpp::depends(RcppArmadillo)]] | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
arma::vec rpg_call(const arma::vec & h, const arma::vec & z){ | |
Environment pkg = Environment::namespace_env("BayesLogit"); | |
Function f = pkg["rpg"]; | |
NumericVector out = f(Rcpp::Named("num", h.n_elem), | |
Rcpp::Named("h",h), | |
Rcpp::Named("z",z)); | |
return as<arma::vec>(out); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment