[Rcpp-devel] Rcpp / RcppArmadillo storage

Gregor Kastner gregor.kastner at wu.ac.at
Wed Feb 19 09:17:31 CET 2014

Thanks, Dirk, for your reply.

> 'data + data' may work for Armadillo because Armadillo generally has
> much better support for math operations. We know of some shortcomings
> in our code there (see TODO and/or Issue list on Github, help is welcome).

OK, thanks for the hint, that's certainly good to know.

> NumericMatrix tmp = results.slice(i);  // even wrap as neeed

"auto-wrapping" doesn't seem to work (compile time error: conversion
from ‘arma::Mat<double>’ to non-scalar type ‘Rcpp::NumericMatrix {aka
Rcpp::Matrix<14>}’ requested). However,

NumericMatrix tmp = wrap(results.slice(i));  // even wrap as neeed

compiles complaintlessly. But then, memory is not reused:

tmp(0,0) = 666.;
Rprintf("%f / %f\n", tmp(0,0), results(0,0,i));


666.000000 / 0.000000


I guess I will end up rewriting myfun and all code depending on in to use old
school arrays (but only after three cups of coffee...).


More information about the Rcpp-devel mailing list