2016-05-18 14 views
0

私は、インテルC++コンパイラで、行列の乗算を持っている私のコードをコンパイルしようとしています。行列の乗算のために、私はEigenライブラリを使用しています。これはサンプルコードです。私はEigenライブラリの最新バージョンでVS2013を使用しています。インテルC++コンパイラーと固有

#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; 
+0

は、私にはコンパイラのバグのように見えます。 'operand型は:float * Eigen :: Matrix 'です。なぜそれがフロートについて考えるのですか? –

+0

同意します!私はオペランドを交換し、今は動作します(y_pred * learning_rate)。奇妙じゃない? –

+0

インテル®コンパイラーのどのバージョンを使用していますか?私は16.0で試してみましたが、このエラーは見られませんでした。 –

答えて

0

あなたは明示的にスカラー計算を実行することができます。

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

お返事ありがとうございます。しかし、主な問題は、C++コンパイラがどのように動作するか(エラーを発生させることなく)ですが、インテル®コンパイラはそれを処理できません。 –

関連する問題