[Rcpp-devel] RcppArmadillo and 'trunc' problem (fixed)

alexios ghalanos alexios at 4dscape.com
Wed May 30 14:11:39 CEST 2012


ok, I found the problem...somewhere in the package I had an # include 
Rmath.h which once I commented out, it builds without problems.

Sorry for the bother.

Regards,

Alexios


On 30/05/2012 12:38, Dirk Eddelbuettel wrote:
>
> Hi Alexios,
>
> On 30 May 2012 at 12:00, alexios ghalanos wrote:
> | Hi,
> |
> | While writing some extra functions into the rmgarch package (on r-forge)
> | which uses RcppArmadillo, I encountered the error relating to 'trunc'
> | and 'ftrunc' already discussed here:
> |
> | http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2010-September/001123.html
>
> That's a long time ago, a few things changed.  That old email was regarding
> OS X, your sessionInfo() shows Windows.
>
> | This occurred for the first time once I made use of Rf_exp and Rf_rchisq
> | in code mixed with RcppArmadillo.
>
> Can you provide a self-contained example, maybe via inline as we often do here?
>
> | While the workaround described in the previous discussion works (i.e.
> | undefine the two macros in sugar) for me, it will not work for my
> | package once I release the update on r-forge.
> |
> | Could you please suggest some solution or some mistake I am making which
> | gives rise to this problem?
>
> We will certainly try to help, but so far we have nothing reproducible -- the
> following works, and combines RcppArmadillo with rexp and rchisq:
>
> R>  library(inline)
> R>
> R>  f<- cxxfunction(signature(), plugin="RcppArmadillo", body='
> +   arma::colvec X(2);
> +   RNGScope scope;
> +   X(0) = Rf_rexp(1);
> +   X(1) = Rf_rchisq(1);
> +   return Rcpp::wrap(X);
> + ')
> R>  set.seed(42); f()
>           [,1]
> [1,] 0.198337
> [2,] 0.755413
> R>  set.seed(42); f()
>           [,1]
> [1,] 0.198337
> [2,] 0.755413
> R>  set.seed(42); f()
>           [,1]
> [1,] 0.198337
> [2,] 0.755413
> R>
>
> Dirk
>
> | sessionInfo ()
> | R version 2.15.0 (2012-03-30)
> | Platform: x86_64-pc-mingw32/x64 (64-bit)
> |
> | attached base packages:
> | [1] stats     graphics  grDevices utils     datasets  methods   base
> |
> | other attached packages:
> | [1] RcppArmadillo_0.3.2.0 Rcpp_0.9.10
> |
> | loaded via a namespace (and not attached):
> | [1] tools_2.15.0
> |
> |
> | Thanks and Regards,
> |
> | Alexios
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel at lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>



More information about the Rcpp-devel mailing list