简体   繁体   English

英特尔C ++编译器和Eigen

[英]Intel C++ Compiler and Eigen

I am trying to compile my code, which has matrix multiplication, with intel C++ compiler. 我正在尝试使用intel C ++编译器编译我的代码,该代码具有矩阵乘法。 For the matrix multiplication, I am using Eigen library. 对于矩阵乘法,我使用的是特征库。 This is the sample code. 这是示例代码。 I am using VS2013 with the latest version of Eigen library. 我正在使用VS2013和最新版本的Eigen库。

#define EIGEN_USE_MKL_ALL
#include <Eigen/Dense>
using namespace Eigen;

int main()
{
  Matrix<double, 1, 200, RowMajor> y_pred;
  y_pred.setRandom(); // Eigen library function
  double learning_rate = 0.5;
  cout << learning_rate * y_pred << endl;
  return 1;
}

When I am using intel C++ compiler I get the following error: 当我使用英特尔C ++编译器时,我收到以下错误:

1>error : more than one operator "*" matches these operands:
1>              function "Eigen::operator*(const double &, const Eigen::MatrixBase<Eigen::Matrix<double, 1, 200, 1, 1, 200>> &)"
1>              function "Eigen::operator*(const std::complex<double> &, const Eigen::MatrixBase<Eigen::Matrix<double, 1, 200, 1, 1, 200>> &)"
1>              function "Eigen::internal::operator*(const float &, const Eigen::Matrix<std::complex<float>, -1, -1, 0, -1, -1> &)"
1>              function "Eigen::internal::operator*(const float &, const Eigen::Matrix<std::complex<float>, -1, 1, 0, -1, 1> &)"
1>              function "Eigen::internal::operator*(const float &, const Eigen::Matrix<std::complex<float>, 1, -1, 1, 1, -1> &)"
1>              function "Eigen::internal::operator*(const float &, const Eigen::Matrix<Eigen::scomplex, -1, -1, 1, -1, -1> &)"
1>              operand types are: float * Eigen::Matrix<double, 1, 200, 1, 1, 200>
1>              y_pred = learning_rate * y_pred;

您可以显式执行标量计算:

cout << learning_rate * y_pred.array() << endl;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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