簡體   English   中英

英特爾C ++編譯器和Eigen

[英]Intel C++ Compiler and Eigen

我正在嘗試使用intel C ++編譯器編譯我的代碼,該代碼具有矩陣乘法。 對於矩陣乘法,我使用的是特征庫。 這是示例代碼。 我正在使用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;
}

當我使用英特爾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