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

Conjugate gradient always reaches max iteration number

Tags: None
(comma "," separated)
mgn
Registered Member
Posts
1
Karma
0
Hello,

I work on a particle system solver that uses conjugate gradient on large model cases. I wanted to try with Eigen's conjugate gradient to see if performances would be improved. The problem is that CG does not converge on a correct solution and always reaches the maximum number of iterations ( I tried with different limits ).

Is this a recurring problem ? I am probably doing something wrong... The Eigen version used is 3.3.2.

Here is how I proceed :
Code: Select all
SparseMatrix<double> A;
VectorXd b, x;

// A and b filled here

ConjugateGradient<SparseMatrix<double>, Lower|Upper> CGEigen;
CGEigen.setTolerance(tol); // tol = 1e-8
CGEigen.setMaxIterations(n); // I have tried multiple n values
CGEigen.compute(A);

x = CGEigen.solve(b);
Index iter = CGEigen.iterations();  // iter is always equal to n

Have a nice day!


Bookmarks



Who is online

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