Skip to content

Sharing the C++ code to other packagesย #46

@Nowosad

Description

@Nowosad

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions