【发布时间】:2018-04-03 17:25:24
【问题描述】:
我正在尝试Eigen::Tensor,但我无法理解为什么最基本的示例会失败。为什么这段代码
#include <unsupported/Eigen/CXX11/Tensor>
int main()
{
Eigen::Tensor<int, 2> a(4, 4);
Eigen::Tensor<int, 2> b(4, 4);
a.setRandom();
b.setRandom();
a += b;
return 0;
}
导致错误:
In file included from eigen.cpp:2:
In file included from /usr/local/include/eigen3/unsupported/Eigen/CXX11/Tensor:142:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:39:7: error: class template partial specialization is not
more specialized than the primary template [-Winvalid-partial-specialization]
class TensorStorage<T, FixedDimensions, Options_>
^
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:34:63: note: template is declared here
template<typename T, typename Dimensions, int Options_> class TensorStorage;
【问题讨论】:
-
似乎 compile fine 使用任何最新版本的 Eigen。
-
我已经在 Homebrew (3.3.4) 和 Ubuntu 17.10 (也是 3.3.4) 附带的版本上进行了测试。