I write a code in C using mkl FGMRES to solve a Ax=b linear system. I follow the example code given in mkl handbook here: http://sepwww.stanford.edu/sep/claudio/Research/Prst_ExpRefl/ShtPSPI/intel/mkl/10.0.3.020/examples/solver/source/dcsrilu0_exampl1.c, which use ILU0 as the preconditioner. The structure of the code is almost the same as the example code so I don't put it here. Now I met a problem. For some problems, my code can solve the problem successfully; but sometimes it can not.
For example, today it happens like this: I put A, b and initial guess solution into the code, when it run after calling dfgmres function, depending on the value of RCI_request parameter, it will do different operations (for example if RCI_request = 0, then we get the answer; if RCI_request = 1, we should do what what). This example will keep repeat RCI_request = 1 and RCI_request = 3, and the while loop in the code will not stop and I can not get the answer. My guess is that the matrix A doesn't have a good property (for example condition number is too large,etc) and the solver can not deal with it. But I am not sure about this. My question is in what condition the RCI_request can repeat between 1 and 3? How can I make sure this is because of the bad property of the input matrix A? If this is ture, does it mean FGMRES can not solve this problem?
Another question is about the preconditioner. In the example code, it used ilu0 as the preconditioner. If the solver can not deal with one problem well, if I change to a different preconditioner (like LU), will it help or not?
Also, which parameter, the number of rows N in the matrix, or the number of non-zeros M in matrix A will determine the scalibility of this FGMERES solver?
Can anyone help?
About this fgmres solver, I have another question. Now my input matrix A is a M-matrix, which has all the diagonal elements to be 1 and all off diagonal elements are negtive and much smaller than 1. A is pretty sparse matrix. For this kind of matrix, it should be a good matrix (small condition number). But in my solver sometimes it will not get converged. Size of A is about 100K by 100K, non-zeros is about 10 million. I want to check the condition number of A but it means I will write another code to realize this and it self will be time consuming...
Any suggestion for my problem? Thanks!