稀疏矩阵超定线性方程组 c/c++图书馆
我需要一个库来解决 Ax=b 系统,其中 A 是一个非对称稀疏矩阵,每行有 8 个条目(而且可能很大)。我认为实现双共轭梯度的库应该没问题,但我找不到一个有效的库(我尝试过 iml++,但 iml++/sparselib++ 包中缺少一些标头)。有什么建议吗?
I need a library to solve Ax=b systems, where A is a non-symmetric sparse matrix, with 8 entry per row (and it might be quite big). I think a library that implements biconjugate gradient should be fine, but i can't find one that works (i've tried iml++, but there are some headers missing in the iml++/sparselib++ packages). Any tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有处理超定系统的标准方法。例如维基百科这样说:
因此,您可以使用任何标准方阵稀疏求解器。
就我个人而言,我使用 Tim Davis 的 CSparse 的直接求解器。 Tim 编写了许多优秀的直接稀疏求解器。事实上,他的 UMFPACK 是另一个很好的选择,例如 MATLAB 使用。请注意,这两个求解器都提供 C 接口。如果您正在寻找具有本机 C++ 接口的东西,那么我没有什么可以提供的。
我对迭代求解器有一些经验。然而,我发现对于我正在研究的问题,迭代方法对于大型矩阵变得不稳定。我在直接求解器方面取得了更大的成功。当然,根据问题提出的矩阵类型,您完全有可能获得相反的体验。
There are standard ways of treating overdetermined systems. For example Wikipedia says this:
Therefore you can use any standard square matrix sparse solver.
Personally I use a direct solver from CSparse by Tim Davis. Tim has written a number of excellent direct sparse solvers. Indeed, his UMFPACK is another excellent option and is used by MATLAB, for example. Note that both of these solvers offer C interfaces. If you are looking for something with a native C++ interface then I have nothing to offer.
I have had some experience with iterative solvers. However, I have found that for the problems I was looking at, the iterative methods became unstable for large matrices. I have had much more success with direct solvers. Of course, it's perfectly plausible that you could have the reverse experience depending on the type of matrix your problem throws up.
看起来 ARPACK 解决了稀疏非对称矩阵问题。有一个C++版本
It looks like ARPACK solves sparse nonsymetric matrix problems. There is a C++ version
对于 David Heffernan 的回答:不要忘记一件重要的事情:必须检查/证明矩阵 A 具有线性独立的列,否则可能会发生 (A^TA) 是奇异的(然后它当然不起作用)。
To David Heffernan's answer: Do not forget one important thing: matrix A must be checked/proved to have linearly independent columns, otherwise it could happen that (A^T A) is singular (and then it would not work, of course).