RViennaCL icon indicating copy to clipboard operation
RViennaCL copied to clipboard

Allow implementation of as() and wrap() functions

Open rstub opened this issue 6 years ago • 1 comments

This issue is motivated by https://stackoverflow.com/questions/49457018/using-rviennacl-for-matrix-multiplication/.

According to https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-extending.pdf one needs to add some forward declarations before loading Rcpp.h if one wants to extend Rcpp by custom as() and wrap() functions. That does not work for RViennaCL since the ViennaCL headers have been patched to already include Rcpp.h e.g. https://github.com/cdeterman/RViennaCL/blob/93527ef189b735e5b12a635d2c6f4df3f0914010/inst/include/viennacl/ocl/backend.hpp#L29. I think it would be sufficient to change all these includes to RcppCommon.h, but I have not tested it.

Alternatively, one could use a macro for defining the output stream, similar to what (Rcpp)Armadillo does. This macro could use std::cout by default but would be overwritten to Rcpp::Rcout in RViennaCL. This way this patch could be communicated upstream.

rstub avatar Mar 27 '18 09:03 rstub