The following basic KMeans implementation using RcppMLPACK (v. 1 on CRAN) fails to compile and build with RcppAttributes under Windows R 3.4.1 using the gcc 4.9.3 RTools chain .
using namespace Rcpp;
using namespace arma;
using namespace mlpack::kmeans;
// [[Rcpp::export]]
List cppKmeans(const mat& data, const int& clusters) {
// data is R x N matrix where the columns index multivariate observations
Col assignments;
KMeans<> k; // Initialize with the default arguments.
k.Cluster(data, clusters, assignments);
return List::create(Named(”clusters”) = clusters,
Named(”s”) = assignments
);
} / end function cppKmeans() /
with lots of error messages like this (relating to mp_thread_limit not declared):
The following basic KMeans implementation using RcppMLPACK (v. 1 on CRAN) fails to compile and build with RcppAttributes under Windows R 3.4.1 using the gcc 4.9.3 RTools chain .
// [[Rcpp::depends(RcppMLPACK)]] // [[Rcpp::plugins(cpp11)]]
include "RcppMLPACK.h"
using namespace Rcpp; using namespace arma; using namespace mlpack::kmeans;
// [[Rcpp::export]] List cppKmeans(const mat& data, const int& clusters) { // data is R x N matrix where the columns index multivariate observations Col assignments;
KMeans<> k; // Initialize with the default arguments.
k.Cluster(data, clusters, assignments);
return List::create(Named(”clusters”) = clusters,
Named(”s”) = assignments
); } / end function cppKmeans() /
with lots of error messages like this (relating to mp_thread_limit not declared):
C:/R/R-devel/library/RcppArmadillo/include/armadillo_bits/fn_accu.hpp:180:7: error: invalid controlling predicate for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) ^ C:/R/R-devel/library/RcppArmadillo/include/armadillo_bits/fn_accu.hpp:205:7: error: invalid controlling predicate for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) ^