当我尝试在Windows上使用Eigen 3.3.3且定义了__ARM_NEON__时,我得到以下编译错误(后跟一堆类似错误):
eigen\src/Core/arch/NEON/PacketMath.h(109): error C2766: explicit specialization; 'Eigen::internal::unpacket_traits<Eigen::internal::Packet4f>' has already been defined
此错误的代码如下所示:
template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; };
template<> struct unpacket_traits<Packet4i> { typedef int32_t type; enum {size=4, alignment=Aligned16}; typedef Packet4i half; };
Packet4f和Packet4i在(在PacketMath.h中)定义为:
typedef float32x4_t Packet4f;
typedef int32x4_t Packet4i;
float32x4_t和int32x4_t被定义为(在MSVC的arm_neon.h中):
typedef __n128 float32x4_t;
typedef __n128 int32x4_t;
所以编译错误是有道理的,但这应该以某种方式与Eigen 3.3.3一起工作,还是这个bug?任何建议的解决方法,除了禁用矢量化(通过EIGEN_DONT_VECTORIZE)?