eddelbuettel / bh

R package providing Boost Header files
85 stars 33 forks source link

Include boost ublas? #79

Closed yimyom closed 2 years ago

yimyom commented 2 years ago

Hi,

in the list of libraries supported by BH, Boost.uBlas is missing. As it is a header-only library, I wonder why? If there is a blocker in ublas itself for supporting it in BH, which one is it? In this case, I can make a change in uBlas (i'm the maintainer).

-- DB

eddelbuettel commented 2 years ago

Thanks for the note.

Three things come to mind:

yimyom commented 2 years ago

Thanks Dirk for the answer. It makes sense. As we're working toward a full support of tensors in uBlas, I think there will be a use case soon for a support in R and therefore BH. For the time being we can wait to have it in BH.

eddelbuettel commented 2 years ago

@yimyom The issue really is not just to copy the header files into BH. We also need someone to write glue code so that we can do this directly from R:

> Rcpp::cppFunction("arma::mat outerProd(arma::colvec x) { return x * x.t(); }", depends="RcppArmadillo")
> outerProd(1:3)
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    2    4    6
[3,]    3    6    9
> 

where cppFunction() is just a convenience -- the real key is the TMP glue code to take the R data structure and seamlessly instantiate an Armadillo column vector from it, and the same on the way out where the Armadillo matrix becomes a standard R matrix. Both Armadillo and Eigen have that, to get real use out of uBlas we may need something similar.