[Rcpp-devel] SUGAR: Vector-Scalar operations

Cedric Ginestet c.ginestet05 at googlemail.com
Wed Dec 22 11:39:48 CET 2010


  Dear Rcpp experts,
> I've got another problem related to Rcpp Sugar. Basically, I would 
> like to have the same functionality that you get from R's vectors, 
> where binary operations with scalars are automatically interpreted as 
> elementwise operations. See the following code and error message:
>
> ###########################################
> VectorScalar <- cxxfunction(signature(x="numeric"), '
>    Rcpp::NumericVector xV(x);
>    xV = xV - 1;
>    return(xV);
> ',plugin="Rcpp")
> VectorScalar(rnorm(100))
>
> file3165a3be.cpp: In function 'SEXPREC* file3165a3be(SEXPREC*)':
> file3165a3be.cpp:32: warning: ISO C++ says that these are ambiguous, 
> even though the worst conversion for the first is better than the 
> worst conversion for the second:
> ##########################################
>
> Thank you very much for your help,
>
>
> -- 
> Cedric Ginestet
> Centre for Neuroimaging Sciences (L3.04)
> NIHR Biomedical Research Centre
> Department of Neuroimaging
> Institute of Psychiatry, Box P089
> King's College London
> De Crespigny Park
> London
> SE5 8AF
> Tel: (+44) 20-3228-3052
> Fax: (+44) 20-3228-2116
> Email: cedric.ginestet at kcl.ac.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20101222/07439103/attachment.htm>


More information about the Rcpp-devel mailing list