Dear list, I'm probably missing something basic, but I expected the following to work,
library(RcppArmadillo) library(inline) fx <- cxxfunction(signature(x = "Rcomplex") , ' arma::cx_double y = as<arma::cx_double>(x); return wrap( y ) ; ', plugin = "RcppArmadillo" ) fx( 1+2i ) yet it fails to compile. I believe I need a conversion since arma does not know what to do with Rcomplex objects, e.g. multiplying x by i = arma::cx_double(0,1) yields error: no match for 'operator*' in 'x * i' I've successfully used cx_vec instead of cx_double, fx <- cxxfunction(signature(x = "Rcomplex") , ' arma::cx_vec y = as<arma::cx_vec>(x); const arma::cx_double i = arma::cx_double(0,1); return wrap( y * i ) ; ', plugin = "RcppArmadillo" ) fx( 1+2i ) Does this make sense? Best regards, baptiste _______________________________________________ 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