[Rcpp-devel] C++ issue only spotted by CRAN and not locally or via rhub

Dirk Eddelbuettel edd at debian.org
Mon Dec 5 14:37:09 CET 2022


On 5 December 2022 at 11:32, Sokol Serguei wrote:
| I don't know what the exact source of this problem is but I can suggest 
| to use Armadillo which has a reputation to be better suited for 
| matrix/vector operation than plain Rcpp.

I second that. Rcpp is great for what it does (easy integration from/to,
extensibility, ...) but the NumericVector / NumericMatrix class are (on
purposes) not built up for fancier higher-level operations such as linear
algebra etc as other packages already do this 'best in class'. RcppArmadillo
is very good and easy to use for all things linear algebra, RcppEigen also
has its fans for related and possibly somewhat broader use.

The other issue is ASAN. This can be tedious to set, so I once created Docker
containers for it (that still exist) but other jumped in and maintain(ed)
daily builds of those. Gabor has some via r-hub, and Winston built a
composite container with several such debug variants:
   https://github.com/wch/r-debug

Make sure you call the various RD* variants of R, and use them to install
your dependencies / test your package. Docker looks a little insurmountable
at first but it is not so bad.  E.g. running

   docker run --rm -ti -v $PWD:/mnt -w /mnt wch/r-debug bash

call this container in your current working directory (say: your repo) and
lets you work with your code and the *SAN debug builds of R. It's worth it!

Hth, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list