alexeckert / parallelDist

R Package: Parallel Distance Matrix Computation using Multiple Threads
GNU General Public License v2.0
49 stars 9 forks source link

Possible extension to allow using distance functions within other packages? #16

Open peekxc opened 5 years ago

peekxc commented 5 years ago

There are a growing number of packages that include header-only C++ libraries in the inst/ folder to allow methods to be linked and used on the C++ side of a package (for example: the progress package )

It would be nice to be able to do that with this package to access the distance functions. Something like (pseudo-code)

#include "Rcpp.h"

// [[Rcpp::depends(parallelDist)]]
#include "parallelDist.h"

void my_rcpp_func(std::string method){
    std::shared_ptr<IDistance> distanceFunction = choose_distance(method);
    // ...
}

Alternatively, the ability to capture a given distance function in R and pass as a SEXP similar to the custom distance example might do the trick.

alexeckert commented 5 years ago

Thanks peekxc, will consider it.