Hello,
I'm trying to calculate principal component using 'princomp' function from
RcppArmadillo. Here's the cpp code:
#include <RcppArmadillo.h>
RcppExport SEXP pca(SEXP mats) {
try {
Rcpp::NumericMatrix matr(mats);
int n = matr.nrow(), k = matr.ncol();
arma::mat mat(matr.begin(), n, k, false);
arma::colvec pca;
pca = arma::princomp(mat);
return Rcpp::wrap(mat);
} catch(...) {
::Rf_error("c++ error");
}
}
However, when I "R CMD check" the package, I get the following error:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/home/tecto/cpp/Rcpp/amora.Rcheck/amora/libs/amora.so':
/home/tecto/cpp/Rcpp/amora.Rcheck/amora/libs/amora.so: undefined symbol:
dgesvd_
Error: loading failed
Execution halted
I've read the Armadillo documentation for that function (
http://arma.sourceforge.net/docs.html#princomp), however it was not clear
to me how to use it correctly.
Does my code have any mistake?
Cheers,
João Daniel
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel