什么是Eigen :: array不是Eigen :: Array

问题描述

我正在使用本征张量库,在我看来shuffle()方法希望将对象Eigen :: array 作为输入。

在我的实现中,我需要传递一个int的std :: list来随机播放(当然,我只在运行时知道第二个int参数(排名)!)

解决方法

不久前,Eigen的Tensor模块与C ++ 03兼容。这意味着std::array不可用。因此,Tensor模块定义了自己的Eigen::array类,如果C ++ 11可用,则实际上是std::array的typedef。

文件unsupported/Eigen/CXX11/src/util/EmulateArray.h包含一些归结为(伪代码)的内容

#if C++11 not available
  // Define a custom std::array like Eigen::array class
#else
  template <typename T,std::size_t N> using array = std::array<T,N>;
#endif

Tensor模块已经失去了C ++ 03的兼容性,并且可能会删除部分代码。