[Rcpp-devel] problem with devel code (solved)

Kaveh Vakili Kaveh.Vakili at ulb.ac.be
Sun Oct 31 23:23:16 CET 2010


Thanks for the link Dirk. Actually, your link induced me to try to reproduce the error on a different computer and i could not. 

For some reason, the code bugs (repeatedly) on a small atom-based net-book i use to program but not on my other computers (although they all run ubuntu 10.04& R2.12). Since i do not intend to actually run the code on the netbook, i don't consider this an issue.

Thanks again,

PS: For full reference i post below the error message i get on the netbook

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! file4279b57c.cpp: In function ‘SEXPREC* file4279b57c(SEXPREC*)’:
file4279b57c.cpp:36: error: no match for ‘operator+’ in ‘tmp + Rcpp::Matrix<RTYPE>::column(int) [with int RTYPE = 14](i)’
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/sugar/operators/plus.h:209: note: candidates are: Rcpp::sugar::Plus_Vector_Primitive<RTYPE, NA, T> operator+(const Rcpp::VectorBase<RTYPE, LHS_NA, LHS_T>&, typename Rcpp::traits::storage_type<RTYPE>::type) [with int RTYPE = 14, bool NA = true, T = Rcpp::Vector<14>]
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/complex.h:26: note:                 Rcomplex operator+(const Rcomplex&, const Rcomplex&)
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/string_proxy.h:228: note:                 std::string Rcpp::internal::operator+(const std::string&, const Rcpp::internal::string_proxy<16>&)
make: *** [file4279b57c.o] Error 1


require( Rcpp )
require( inline )

f.Rcpp <- cxxfunction( signature( x = "matrix" ), '

     NumericMatrix input( x ) ;
     NumericMatrix output  = clone<NumericMatrix>( input ) ;

     int nr = input.nrow(), nc = input.ncol() ;
     NumericVector tmp( nr );
     for( int i=0; i<nc; i++){
         tmp = tmp + input.column(i) ;
         NumericMatrix::Column target( output, i ) ;
         std::copy( tmp.begin(), tmp.end(), target.begin() ) ;
     }
     return output ;

', plugin = "Rcpp" )

f.R <- function( x ){
     t(apply(probs, 1, cumsum)) #SLOOOW!
}



>
>On 31 October 2010 at 20:03, Kaveh Vakili wrote:
>| Hi,
>| 
>| i tried to inline the code for f.Rcpp found here:
>| 
>| http://article.gmane.org/gmane.comp.lang.r.rcpp/851/match=matrix+inline
>| 
>| I get a mysterious bug. I'l not sure what's wrong with the code, can anyone comment ?
>
>May I suggest that you read something like
>
>       http://www.catb.org/esr/faqs/smart-questions.html
>
>as you 
>
>  - did not show what commands you executed did, 
>
>  - did not say what you expected, 
>
>  - did not detail what you got instead, 
>
>  - and generally did not offer anything here, in particular no information
>    on which operating system, g++ version, R version, Rcpp version, etc pp.
>
>Thanks, Dirk
>
>-- 
>Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>
>




More information about the Rcpp-devel mailing list