特征缩减示例未构建错误C2100非法间接

时间:2017-08-04 16:47:09

标签: eigen

我正在尝试使用

中的示例
  

缩小尺寸

<{3}}

部分

此:

// Create a tensor of 2 dimensions
Eigen::Tensor<int, 2> a(2, 3);
a.setValues({{1, 2, 3}, {6, 5, 4}});
// Reduce it along the second dimension (1)...
Eigen::array<int, 1> dims({1 /* dimension to reduce */});
// ...using the "maximum" operator.
// The result is a tensor with one dimension.  The size of
// that dimension is the same as the first (non-reduced) dimension of a.
Eigen::Tensor<int, 1> b = a.maximum(dims);
cout << "a" << endl << a << endl << endl;
cout << "b" << endl << b << endl << endl;

该部分的其他示例给出了Error C2100 illegal indirection编译错误。在VS 2015中。其他所有工作和编译都很好。任何想法该代码的问题是什么?

1 个答案:

答案 0 :(得分:1)

Eigen::array<int, 1> dims({1 /* dimension to reduce */});

应改为:

const std::array<DenseIndex, 1> action_cards_dims = { 1 };