sparse matrix overdetermined linear equation system c/c++ library

…衆ロ難τιáo~ 提交于 2020-01-03 20:43:10

问题


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?


回答1:


There are standard ways of treating overdetermined systems. For example Wikipedia says this:

A set of linear simultaneous equations can be written in matrix form as Ax = y. If there are more equations than variables, the system is called overdetermined, and has (in general) no solutions. The system can then be changed to (ATA)x = ATy. The new system has as many equations as variables (the matrix ATA is a square matrix) and can be solved in the usual way. The solution is a least-squares solution of the original, overdetermined system, minimizing the Euclidean norm ||Ax − y||, a measure of the discrepancy between the two sides in the original system.

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.




回答2:


It looks like ARPACK solves sparse nonsymetric matrix problems. There is a C++ version




回答3:


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).



来源:https://stackoverflow.com/questions/7939649/sparse-matrix-overdetermined-linear-equation-system-c-c-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!