具有MKL右值的EIGEN库引用警告

时间:2017-05-23 16:39:10

标签: c++11 eigen intel-mkl eigen3

我正在尝试使用与MKL库(icc版本17.0.4)链接的EIGEN库和代码:

#define EIGEN_USE_MKL_ALL
#define lapack_complex_float std::complex<float>
#define lapack_complex_double std::complex<double>

#include <iostream>
#include <Eigen/Dense>
#include <Eigen/Eigenvalues>
#include <complex>
#include <Eigen/PardisoSupport>

using namespace Eigen;
using Eigen::MatrixXd;

int main()
{
    int size = 3;
    MatrixXd A(size,size);
    A(0,0)=1.0;        A(0,1)=-0.5;         A(0,2)=0.2;
    A(1,0)=0.7;        A(1,1)=-1.3;        A(1,2)=-2.0;
    A(2,0)=0.7;        A(2,1)=-1.3;        A(2,2)=-2.0;

    std::cout << A << std::endl;
    VectorXd vec(3);
    vec(0) = 2;        
    vec(1) = 3;        
    vec(2) = 4;

    std::cout << A*vec << "\n";

    std::cout << A.eigenvalues() << "\n";

}

我通过

编译
icc -I${MKLROOT}/include -L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib \
    -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl \
    -L/Users/user/eigen -I/Users/user/eigen

但是我收到错误消息:

/Users/user/eigen/Eigen/src/Core/DenseStorage.h(372): warning #3495: rvalue references 
are a C++11 feature DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT

如何解决此警告?

1 个答案:

答案 0 :(得分:0)

Eigen似乎检测到您的编译器支持右值引用。您可以通过命令行定义#define EIGEN_HAS_RVALUE_REFERENCES 0 或在源中包含Eigen之前禁用它:

-std=c++11

最好告诉icc它应该用C ++ 11支持编译(我假设$("#swapvalues_btn1").on('click', function() { var fromcurrency = $('#fromcurrency').val(); var tocurrency = $('#tocurrency').val(); $('#fromcurrency').val(tocurrency).trigger('change'); $('#tocurrency').val(fromcurrency).trigger('change'); }); 也适用于icc)。