最好的小C是什么?计算矩阵最大特征值的包?
我需要计算(稀疏)矩阵的最大特征值。我实现了幂迭代方法,但是收敛速度太慢,所以我想使用一个包来实现它。有人有推荐吗?
最好的 C++ 特征值计算包是什么?最好是小且易于编译的。
I need to compute the largest eigenvalue of a (sparse) matrix. I implemented the power iteration method, but it is too slow to converge, so I'd like to use a package for it. Does anyone have a recommendation?
What is the best C++ eigenvalue computation package? Preferably one that is small and easy to compile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法向您提供任何详细信息,因为我自己没有使用过它,但我认为 ARPACK 可能会有所帮助,尤其是 ARPACK++,它是 C++ 改编版本,因为原始包位于 Fortran77 中。我认为 MATLAB 函数 eigs() 使用它来查找最大特征值(和相应的特征向量)。据我所知 t 也应该能够与 STL 交互。
MATLAB 使用 Fortran77 例程 DSAUPD、DSEUPD、DNAUPD、DNEUPD、ZNAUPD 和 ZNEUPD。它们似乎是在 ARPACK++ 中寻找的对象。
在这里查看。
I can't offer you any details as I haven't used it myself, but I think ARPACK could be of help, and especially ARPACK++ which is a C++ adaption as the original package is in Fortran77. I think the MATLAB function eigs() uses this to find the greatest eigenvalue (and corresponding eigenvector). From what I hear t should be able to interface with STL as well.
MATLAB uses the Fortran77 routines DSAUPD, DSEUPD, DNAUPD, DNEUPD, ZNAUPD, and ZNEUPD. They seem like the ones to look for in ARPACK++.
Check it out here.
至少如果没记错的话,一种可能是
Boost::uBlas
。虽然 Boost 整体上相当大,但 uBlas 本身却更合理一些。此外,如果内存充足,它是一个仅标头的库,因此使用它非常容易(您不必先构建库,为链接器设置任何内容等)编辑:我应该添加计算特征值/向量一般来说,即使使用相当优化的代码,速度也相当慢。根据您正在做什么,通常值得研究一些方法(例如)让您仅计算矩阵子集的特征值(例如, 里程碑式的多维缩放)。
At least if memory serves, one possibility would be
Boost::uBlas
. While Boost as a whole is pretty big,uBlas
by itself is quite a bit more reasonable. Moreover, if memory serves it's a header-only library, so using it is pretty easy (you don't have to build the library first, set anything up for the linker, etc.)Edit: I should add that computing Eigenvalues/vectors in general is pretty slow, even with fairly optimized code. Depending on exactly what you're doing, it's often worthwhile to look into methods that (for one example) let you get by with computing the Eigenvalue of only a subset of the matrix (e.g., Landmark Multidimensional Scaling).