Hi @HajkD,
I am currently working on various improvements and extensions to the https://github.com/Nowosad/supercells package. Details are probably not important, but one idea in that package is that a user can call one of a few built-in distance functions (written in C++) or any distance function from the philentropy package. However, in the second case, the computations are much slower -- the values from C++ need to be sent to R, then philentropy does its magic (in C++), and then they are sent back to the C++ supercells. This makes a large overhead.
One possible improvement would be for the philentropy package to share its C++ code for linking with other R packages (e.g., see https://epiverse-trace.github.io/posts/share-cpp/index.html). To make it happen, the line // [[Rcpp::interfaces(cpp)]] needs to be added in C++, which forces Rcpp to autogenerate header files usable in C++ by other R packages.
Actually, the philentropy package already provides a few of its utility functions -- see
|
// [[Rcpp::interfaces(r, cpp)]] |
and then
https://github.com/drostlab/philentropy/blob/master/inst/include/philentropy_RcppExports.h.
What do you think about exporting philentropy C++ functions to other R packages?
CC: @brownag -- I am also interested in your opinion on this.
Hi @HajkD,
I am currently working on various improvements and extensions to the https://github.com/Nowosad/supercells package. Details are probably not important, but one idea in that package is that a user can call one of a few built-in distance functions (written in C++) or any distance function from the philentropy package. However, in the second case, the computations are much slower -- the values from C++ need to be sent to R, then philentropy does its magic (in C++), and then they are sent back to the C++ supercells. This makes a large overhead.
One possible improvement would be for the philentropy package to share its C++ code for linking with other R packages (e.g., see https://epiverse-trace.github.io/posts/share-cpp/index.html). To make it happen, the line
// [[Rcpp::interfaces(cpp)]]needs to be added in C++, which forces Rcpp to autogenerate header files usable in C++ by other R packages.Actually, the philentropy package already provides a few of its utility functions -- see
philentropy/src/utils.h
Line 7 in 9e171b2
What do you think about exporting philentropy C++ functions to other R packages?
CC: @brownag -- I am also interested in your opinion on this.