稀疏矩阵超线性方程组c/c ++库 [英] sparse matrix overdetermined linear equation system c/c++ library

查看:189
本文介绍了稀疏矩阵超线性方程组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?

推荐答案

有处理超定系统的标准方法.例如,维基百科这样说:

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

一组线性联立方程可以矩阵形式表示为Ax = y.如果方程比变量多,则称该系统为超定的,(通常)没有解.然后可以将系统更改为(A T A)x = A T y.新系统具有与变量一样多的方程(矩阵A T A是方矩阵),可以用通常的方法求解.该解决方案是原始超定系统的最小二乘解,它使欧几里得范数|| Ax-y ||最小化,该度量是原始系统两侧之间的差异的度量.

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.

我个人使用Tim Davis的 CSparse 中的直接求解器.蒂姆写了许多出色的直接稀疏求解器.实际上,他的 UMFPACK 是另一个很好的选择,例如,MATLAB已将其使用. .请注意,这两个求解器均提供C接口.如果您正在寻找具有本机C ++接口的功能,那么我无能为力.

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.

这篇关于稀疏矩阵超线性方程组c/c ++库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆