Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

Usage Example

Kazuki Fukui edited this page Apr 23, 2015 · 1 revision

Suppose we have a c++ source like below.

// test.cpp
#include <RcppFire.h>
// [[Rcpp::plugins("cpp11")]]                                                                                                                                                               
// [[Rcpp::depends("RcppFire")]]

// [[Rcpp::export]]                                                                                                                    
af::array testaf_64(const RcppFire::typed_array<f64> & data)
{
  // Note that RcppFire::typed_array is derived from af::array                                                                 
  return data * 2;                                                                                                                   
}        

Then, open a R console and invoke following commands.

library(Rcpp)
sourceCpp('test.cpp')
x <- matrix(rnorm(15), 3, 5)
testaf_64(x)

Clone this wiki locally