简体   繁体   中英

R CHECK issue on CRAN related to C++ complex numbers

I'm doing a package using 'Rcpp' and it contains this function:

Eigen::MatrixXcd matricesToMatrixXcd(const Eigen::MatrixXd& Re,
                                     const Eigen::MatrixXd& Im) {
  return Re.cast<std::complex<double>>() + 1i * Im.cast<std::complex<double>>();
}

Here, 1i is the unit imaginary number.

I submitted the package to CRAN but the R CHECK on Debian generates this warning:

* checking whether package ‘EigenR’ can be installed ... [297s/297s] WARNING
Found the following significant warnings:
  EigenR.cpp:10:44: warning: imaginary constants are a GCC extension

Would you know what should I do?

Yeah, this has worked:

Eigen::MatrixXcd matricesToMatrixXcd(const Eigen::MatrixXd& Re,
                                     const Eigen::MatrixXd& Im) {
  const std::complex<double> I_ {0.0, 1.0};
  return Re.cast<std::complex<double>>() + I_ * Im.cast<std::complex<double>>();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM