使用CWiseNullaryOp扩展Eigen:无法重现示例

时间:2017-05-03 01:31:27

标签: c++ c++11 eigen

我试图在Eigen文档的this page上重现第二个例子,但是无法编译我的最小程序。我正在使用Eigen 3.3~beta1-2。

使用以下参数feedback[gradework_attributes]运行g ++时,出现此错误:

feedback[gradework]

我的最小程序包含以下内容(基本上是从文档中的示例中复制并粘贴):

example.h文件

-std=c++11 -Wall -pipe -O3 -ffast-math -funsafe-math-optimizations -march=native -mtune=native -pedantic -Wno-unused-variable -I/usr/local/include/eigen3 -I/usr/include/eigen3 -c example.cpp

example.cpp

example.cpp:8:41 ("Eigen::MatrixXi B = indexing(A, ri, ci)" in program below)  
/usr/include/eigen3/Eigen/src/Core/CoreEvaluators.h:348:27: error: no match for call to '(const indexing_functor<Eigen::Matrix<int, -1, -1>, Eigen::Array<int, 3, 1>, Eigen::Array<int, -1, 1> >) (Eigen::Index&)
      return m_functor(index);

我是否遗漏了有关模板如何在C ++中运行的基本信息?

1 个答案:

答案 0 :(得分:1)

我已经确定,对于Eigen 3.3~beta1-2的Ubuntu release必须有一个突破性的变化,或者在某种程度上缺乏对此扩展的支持。该程序在使用最新标题时有效。