[Rcpp-devel] Inf to NA.

Cedric Ginestet c.ginestet05 at googlemail.com
Tue Dec 21 18:56:56 CET 2010


Dirk and Romain,
Spot on. I will stick to float for the foreseeable future.
Thanks a lot,

Dirk,
I still couldn't find information for the *Rcpp:List* class from here:
http://dirk.eddelbuettel.com/code/rcpp/html/namespaceRcpp.html
More generally, where is the best place to look for information about a 
particular class?

Cheers,
Cedric



On 21/12/10 17:44, romain at r-enthusiasts.com wrote:
>   Le mar 21/12/10 17:24, "Cedric Ginestet" c.ginestet05 at googlemail.com a écrit:
>> Dear Rcpp experts,
>>
>> When passing a vector/argument with infinite values to a C++
>> function, the R wrapper returns NA's. [See the code below] Is there a
>> way around this to ensure that infinite values are preserved from R to
>> C++ and then from C++ to R again?
> There is no such thing as an infinite value for integers in R.
>
>> as.integer(Inf)
> [1] NA
> Message d'avis :
> NAs introduits lors de la conversion automatique
>
> The D matrix you build is a numeric matrix, when you use the IntegerMatrix constructor, there is coercion to an integer matrix.
>
> Hope this helps,
>
> Romain
>
>> ######################################
>> D  src3  IntegerMatrix xD(D);
>> IntegerVector Drow(xD.ncol());
>> for(int i=0; i return xD;
>> '
>> rowExtraction  cxxfunction(signature(D="matrix"),body=src3,plugin="Rcpp",verbose=TRUE)
>> rowExtraction(D)
>> ######################################
>>
>> Thank you very much,
>> Cedric
>>
>> -- 
>> 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/20101221/fd15efd8/attachment.htm>


More information about the Rcpp-devel mailing list