This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Why the error is so large while using CG solver

Tags: None
(comma "," separated)
yuhao
Registered Member
Posts
11
Karma
0
I have several linear equations, for one with about 1100 size, the error would be e+008 size, after the 1100 iteraitons, and for other size equation, e.g, 20000, 500000,etc., the error is almost the same big as 1100 size has with the default iterations, could you anyone let me know how could I let the CG converges
Dee33
Registered Member
Posts
54
Karma
0
OS
Make sure your matrices are SPD.
You can try BiCGSTAB, possibly with the ILUT preconditioner.
yuhao
Registered Member
Posts
11
Karma
0
Thanks!

My matrix is of the form, L = d1*A*d2*transpose(A)*d1, where d1,d2 are diagonal matrix with positive entry , and A has determinant greater than 0, so it is SPD matrix. But supprised, when I write a function to check if the L is symmetry, the result is not, it outputs i=5,j=7, L(i,j) != L(j,i), but value of A(i,j) and A(j,i) are exactly the same, from the values of L it outputs, I see that L is indeed symmetry, I don't know what the problem is ? Could anyone give me some help again?Thank you!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
If you can work on L that is not too large you check it is symmetric as follow:

MatrixXd l(L);
std::cout << (l-l.transpose()).cwiseAbs().maxCoeff()/l.cwiseAbs().maxCoeff() << std::endl;

Also, does the SimplicialLDLT solver work on your data? Have you checked the output of cg.info()? Have you tried to adjust the maximum number of iterations and the tolerance error?
yuhao
Registered Member
Posts
11
Karma
0
Thanks!

I am checking! I adopted the suggested and tried to use BGISTAB with ILUT preconditioner, and it really works for some small size problem, but if I choose size=20000, it will get bg.error()=-1.#IND, after 1 iteration, what does that mean? For small size it iteration very quickly .. And I do adjust maxIteration and Torelance to test , but I think that is not the critical here. Thanks if anyone can give any help again
yuhao
Registered Member
Posts
11
Karma
0
Hi,

I checked , the result is about e-20, e-17 small numbers?Is this symmetry? Thanks!


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]