On Sat, Nov 22, 2014 at 1:43 PM, Sokol Serguei <serguei.so...@gmail.com> wrote: > Let try to stick with regular rcpp code > (file: matrix_norm.cpp): > > //[[Rcpp::depends(RcppArmadillo)]] > #include <RcppArmadillo.h> > using namespace Rcpp; > using namespace arma; > > // [[Rcpp::export]] > double nmat(mat A) { > Function Matrix_norm_r_=Environment("package:Matrix")["norm"]; > double res=as<double>(Matrix_norm_r_(A, "1")); > return res; > } > > When called in R as: > > library(Rcpp) > library(Matrix) > sourceCpp("matrix_norm.cpp") > gctorture(TRUE) > nmat(as.matrix(pi)) > > it gives an error: > Erreur : 'getCharCE' doit être appelé sur un CHARSXP > (my English translation: Error: 'getCharCE' must be called on CHARSXP) > > Something was irregular on my side here? > Serguei.
Try replacing the line that sets res with: double res=as<double>(Matrix_norm_r_(NumericMatrix(wrap(A)), CharacterVector::create("1"))); Be sure to try it on a fresh session since errors from prior runs could have messed up R. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel