[Rcpp-devel] Inf to NA.
romain at r-enthusiasts.com
romain at r-enthusiasts.com
Tue Dec 21 18:44:46 CET 2010
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
>
>
>
More information about the Rcpp-devel
mailing list