-1

Someone had this type of error when is using Rcpp lib for decomposition into eigenvalues ​​and eigenvectors. If yes, how could I fix it? Thanks!

This is the code:

cppFunction('
Rcpp::List eigen_decomp_cpp(const arma::mat& A) {
   arma::vec eigval;
   arma::mat eigvec;
   arma::eig_sym(eigval, eigvec, A);
return Rcpp::List::create(Rcpp::Named("values") = eigval,
                          Rcpp::Named("vectors") = eigvec);
}', depends = "RcppArmadillo")    

This is the error:

Error in sourceCpp(code = code, env = env, rebuild = rebuild, 
cacheDir = cacheDir,  : 
Error 1 occurred building shared library.    

Now I'm reading the literature of this lib to understand the correct syntax, because I checked if there are invalid characters, Rtools is installed a restarted the RStudio.

New contributor
Henrique Carqueja is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
6
  • 3
    I cannot reproduce this error, the posted code compiles and works as is. Commented 7 hours ago
  • 1
    Same here. I can compile this with no issues.
    – M--
    Commented 7 hours ago
  • 1
    me three. What do you see if you run it with verbose = TRUE ?
    – Ben Bolker
    Commented 6 hours ago
  • 2
    Henrique Carqueja, that kind of error could be caused by a few things, not all of them clear based on the provided information here. It may or may not be specific to any of Rcpp, RcppArmadillo, or some other underlying dependency or compilation tool (OS level). The authors have historically (repeatedly) suggested that the best and primary place to ask questions about Rcpp integration is the mailing list. I suggest looking and asking there, though ...
    – r2evans
    Commented 6 hours ago
  • 1
    ... I suggest you add more context when you do so, including OS, output from sessionInfo(), and any more console output that may accompany that failure.
    – r2evans
    Commented 6 hours ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.