[Rcpp-devel] file name changed in package

Chaomei Lo chaomeilo at gmail.com
Fri May 23 00:38:26 CEST 2014


Hi, Dirk,

I have created R packages using Makevars and it works pretty good for me.
I am able to convert from a Rcpp::NumericVector to std::vector as in below.




*NumericVector col_cts = buildMatrix(Xr);vector<long unsigned int>
col_counts = Rcpp::as<vector<long unsigned int>>(col_cts);  *
Now I am having a problem with an application involves the Trilinos
library. Here below I am trying to convert a Rcpp::NumericVector to
Teuchos::ArrayRCP<size_t> in the following line, it gave me errors as shown
below in red.  Would you please help me with this ?

*Teuchos::ArrayRCP<size_t>
col_counts=Rcpp::as<Teuchos::ArrayRCP<size_t>>(col_cts);*

Thanks a lot.

In file included from
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/as.h:25:0,
                 from
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/RcppCommon.h:169,
                 from
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp.h:27,
                 from buildMatrix.cpp:4:
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/internal/Exporter.h:
In constructor 'Rcpp::traits::Exporter<T>::Exporter(SEXP) [with T =
Teuchos::Array
RCP<long unsigned int>, SEXP = SEXPREC*]':
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/as.h:79:51:
instantiated from 'T Rcpp::internal::as(SEXP,
Rcpp::traits::r_type_generic_tag) [with T =
 Teuchos::ArrayRCP<long unsigned int>, SEXP = SEXPREC*]'
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/as.h:144:84:
instantiated from 'T Rcpp::as(SEXP) [with T = Teuchos::ArrayRCP<long
unsigned int>, SEXP
 = SEXPREC*]'
buildMatrix.cpp:84:87:   instantiated from here
/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31:
error: invalid conversion from 'SEXP' to 'long int' [-fpermissive]
/people/d3j508/trilinos-11.6.1/trilinos-11.6.1_Install/include/Teuchos_ArrayRCP.hpp:129:1:
error:   initializing argument 1 of 'Teuchos::ArrayRCP<T>::ArrayRC
P(Teuchos::ArrayRCP<T>::size_type, const T&) [with T = long unsigned int,
Teuchos::ArrayRCP<T>::size_type = long int]' [-fpermissive]
make: *** [buildMatrix.o] Error 1
ERROR: compilation failed for package 'Tpkg'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140522/bd8e2d86/attachment.html>


More information about the Rcpp-devel mailing list