英文:
LAPACK different outputs when using solvers for banded matricies
问题
I've been stuck at this for hours and hoping someone can figure out what I am missing. I am solving Ax=B firstly using DGESV which I am 99% sure is correct. Then I am putting A into a banded form and using DGBSV and getting a different output.
Here is my expected inputs and outputs where A is the first 9x9 matrix B is -r 1x9 and x is sk 1x9.
And this is what my usage of DGBSV looks like A=JBtemp, B=-r, x=SK:
[](https://i.stack.imgur.com/hiVTJ.png)
We can see that the x values don't match, and here is my code usage of the two functions.
call dgesv(n, 1, J0, n, ipiv, r, n, info)
call dgbsv(n, KL, KU, 1, JBtemp, KU+1+KL+KL, ipiv, r, n, info)
英文:
I've been stuck at this for hours and hoping someone can figure out what I am missing. I am solving Ax=B firstly using DGESV which I am 99% sure is correct. Then I am puting A into a banded form and using DGBSV and getting a different output.
Here is my expected inputs and outputs where A is the first 9x9 matrix B is -r 1x9 and x is sk 1x9.
And this is what my usage of DGBSV looks like A=JBtemp,B=-r,x=SK:
[(https://i.stack.imgur.com/hiVTJ.png)
We can see that the x values dont match and here is my code usage of the two functions.
call dgesv(n,1,J0,n,ipiv,r,n,info)
call dgbsv(n,KL,KU,1,JBtemp,KU+1+KL+KL,ipiv,r,n,info)
答案1
得分: 2
这是一个无需担忧的问题。
两个结果都是正确的 - 是的,真的! - 对于你提供的数据。 我用高斯消元法来验证了这一点。
在你的B向量(你标记为 -r)的第一个示例中,它以
50.1899...
70.9...
50.19...
但在第二个示例中,它以
50.1899...
-70.9...
-50.19...
请注意B的最后两个条目从正变为负。
英文:
This is a non-problem.
Both results are correct - yes, really! - for the data that you have given them. I checked that with Gaussian elimination.
In your B vector (what you label -r) in the first example it ends
50.1899...
70.9...
50.19...
but in the second example it ends
50.1899...
-70.9...
-50.19...
Note the change from positive to negative for the last two entries of B.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论