Solving a complex sparse linear system #1689
-
Hi together, I'm trying to solve a complex sparse linear system using the following code using Ginkgo 1.8.0:
My problem is, that the solution diverges when I use complex matrices. Testing it with real-valued matrices worked just fine.
The output for real valued matrices:
I attached the mtx files I used for testing. Does anyone know what is the problem here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @marco-butz, I tried running your complex matrix with our solver benchmark and it also didn't converge with CG. It did converge however when I used GMRES. Did you check if your complex matrix is supposed to be solvable with CG, e.g. in matlab or similar. For CG with complex matrices it's not enough if the matrix is symmetric, it has to be hermitian. |
Beta Was this translation helpful? Give feedback.
-
I have checked with python scipy cg on 4x4 complex matrix.
could you share the solution from your CG with MKL? |
Beta Was this translation helpful? Give feedback.
Hi @marco-butz, I noticed you are using Ginkgo 1.8.0. We recently fixed a bug for complex numbers in GMRES (#1678). If I solve your problem with a Ginkgo version older than that PR, I see output similar to what you posted:
But if I add the commit from the PR:
You can cherry-pick that one commit (aa09fbd), or make the change manually -- it's just one line of code. Hopefully that will fix your problem. You could also update to the latest
develop
branch of Ginkgo and get other improvements, too, but Ginkgo is planning a 1.9.0 release soon, if you want to wait for that.