如何查看 Eigen C++ 模板库的版本号?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21497064/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 23:40:11  来源:igfitidea点击:

How to check the version number of Eigen C++ template library?

c++eigen

提问by LCFactorization

I added several different versions of Eigen to default including directory of Visual C++. But I got collapse problem when using LDLT(Cholesky decomposition) for some of the testing numerical examples.

我默认添加了几个不同版本的 Eigen,包括 Visual C++ 目录。但是在LDLT对一些测试数值示例使用(Cholesky 分解)时,我遇到了崩溃问题。

So I want to determine which version is actually active when debugging the code.

所以我想在调试代码时确定哪个版本实际上处于活动状态。

Is there any function which can indicate the current active Eigen version number?

是否有任何功能可以指示当前活动的 Eigen 版本号?

回答by LCFactorization

This answer is only a summary from the comments above:

这个答案只是以上评论的总结:

  • At compile-time you have EIGEN_WORLD_VERSION, EIGEN_MAJOR_VERSIONand EIGEN_MINOR_VERSION, you can easily embed this information in your application.

  • 3.1.91sounds like a beta versionof 3.2.

  • The version number macros are defined in Macros.hlocated at \Eigen\src\Core\util\.

  • 在编译时,您拥有EIGEN_WORLD_VERSION,EIGEN_MAJOR_VERSIONEIGEN_MINOR_VERSION,您可以轻松地将此信息嵌入到您的应用程序中。

  • 3.1.91听起来像beta version3.2

  • 版本号宏在Macros.h位于 中定义\Eigen\src\Core\util\

回答by NAK

In order to check the version number of Eigen C++ template library, just type

为了检查 Eigen C++ 模板库的版本号,只需键入

dpkg -p libeigen3-dev

in the terminal. Or just type

在终端。或者只是输入

pkg-config --modversion eigen3

you will get the Eigen version.

您将获得 Eigen 版本。

回答by m7913d

Although it is not the goal of the OP, people finding this question may be interested in checking if the version is equal to are newer than a specific release for compatibility reasons with different versions of Eigen. This can be done more easily using the EIGEN_VERSION_AT_LEAST(x, y, z)macro as follows:

虽然这不是 OP 的目标,但发现此问题的人可能有兴趣检查版本是否等于由于与不同版本 Eigen 的兼容性原因而比特定版本更新。这可以使用EIGEN_VERSION_AT_LEAST(x, y, z)宏更轻松地完成,如下所示:

#if EIGEN_VERSION_AT_LEAST(3,3,0)
    // Implementation for Eigen 3.3.0 and newer
#else
    // Implementation for older Eigen versions
#endif 

This macro is also defined in Eigen/src/Core/util/Macros.hand uses EIGEN_WORLD_VERSION, EIGEN_MAJOR_VERSIONand EIGEN_MINOR_VERSIONinternally.

该宏还定义Eigen/src/Core/util/Macros.h和用途EIGEN_WORLD_VERSIONEIGEN_MAJOR_VERSIONEIGEN_MINOR_VERSION在内部。

回答by Filippo Grazioli

On Linux:

在 Linux 上:

grep "#define EIGEN_[^_]*_VERSION" /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h

You'll get something like:

你会得到类似的东西:

#define EIGEN_WORLD_VERSION 3
#define EIGEN_MAJOR_VERSION 3
#define EIGEN_MINOR_VERSION 7

It means version 3.3.7

这意味着版本 3.3.7