是否应该避免 Eigen 不支持的模块?

Should the Eigen-unsupported modules be avoided?

流行的线性代数库 Eigen comes with a long list of so-called "unsupported" modules,例如用于 FFT、数值微分或欧拉角的模块。

在Eigen文档中,明确指出:

These modules are contributions from various users. They are provided "as is", without any support.

遗憾的是,文档中没有关于可能停用不受支持的模块、对实施质量的要求、测试级别等的声明。

这给我留下了以下问题:

(只是为了完整性:我正在考虑的特定不受支持的模块是 EulerAngles 模块)。

Unfortunately, there is no statement in the documentation about potential discontinuation of unsupported modules, requirements to the quality of implementation, level of testing, and so on.

由于提供了不受支持的模块"as is",它们的测试范围甚至质量可能会有很大差异。所有模块,无论是否支持,都是 tested。但是,有些模块使用频率很高,而有些模块可能不经常使用。这导致社区对不同的不受支持的模块有各种各样的体验。非常受欢迎的模块很可能会得到很好的测试,因为有人在使用它时很有可能会遇到一些极端情况。

Are there any experiences or opinions out there regarding the stability and availability of the unsupported modules?

一个被广泛采用的模块的例子是不受支持的 Tensor module,它被用于 Google 的 Tensorflow 的核心部分。

但是,不保证 ABI 或 API 不受支持模块的稳定性。例如,不受支持的模块可能会合并到受支持的部分中,这可能会导致(至少)API 更改。

Should I be using Eigen unsupported modules at all, if I want my software to be stable for a few years (and at least to be compatible with future major/minor Eigen releases).

很难回答这个有点宽泛的问题。如果你真的依赖稳定性多年,你可能应该避免使用不受支持的模块。然而,这绝不是一般性建议,取决于您的具体需求和您计划使用的模块。

如果您打算使用不受支持的模块作为应用程序的关键部分,您可能应该留意更新(例如检查 Eigen 的 changelog or watch pull requests)。

一般来说,我建议试用不受支持的模块 并就它们的实用性、错误、对 API-changes 的建议等提供反馈。这是最有可能的方式当前不受支持的模块最终将移至标准模块。

如果 API 发生变化或模块变得稳定(理想情况下,这只需要更改 #include),您需要准备好更改部分源代码——当然这可以如果你想兼容新旧 Eigen 版本,那就更复杂了。


我想说 EulerAngles 模块非常稳定 well-tested 并且已经很好地集成到 Geometry 模块中——但它可能用得不多(我们没有关于使用情况的统计数据个别模块)。

相比之下,Tensor 模块(@datell 提到)被大量使用(例如,TensorFlow),但在我看来 well-integrated 尚未进入 Eigen 的其余部分(例如,文档主要是单个 .md 与当前 API 不完全 in-sync:http://eigen.tuxfamily.org/dox-devel/unsupported/eigen_tensors.html

N.B.: 我是 Eigen 维护者之一。