0
爲什麼下面的代碼不能編譯?Rcpp特徵映射與MatrixXf錯誤
library(Rcpp)
cppFunction('
int rows(const NumericMatrix& X) {
using Eigen::MatrixXf;
typedef Eigen::Map<MatrixXf> MapMat;
MapMat X1(as<MapMat>(X));
return X1.rows();
}', depends = "RcppEigen")
它引發以下錯誤:當我用MatrixXd代替
error: no matching function for call to 'Eigen::Map<Eigen::Matrix<float, -1, -1> >::Map(Rcpp::Vector<14, Rcpp::PreserveStorage>::iterator, int&, int&)'
OUT get() {return OUT(vec.begin(), d_nrow, d_ncol);}
相同的代碼工作正常。
謝謝。
我們不支持在R的接口上使用'float',因爲R只有'double'。 –
謝謝,我沒有意識到這一點。 – user3294195