why convergence is not happening in pcg function ?

25 views (last 30 days)
fahim GH
fahim GH on 20 Oct 2016
Answered: Josh Meyer on 23 Sep 2019
Hi I used the pcg function for gradient conjugate, but convergence did not happened and I the following text is displaying in the Command Window? I would really appreciate if somebody help me to fix it.
"pcg converged at iteration 1 to a solution with relative residual 1.6e-16.
pcg stopped at iteration 100 without converging to the desired tolerance 1e-10
because the maximum number of iterations was reached.
The iterate returned (number 100) has relative residual NaN."

Answers (1)

Josh Meyer
Josh Meyer on 23 Sep 2019
There are two things to notice here:
  1. In the first message you printed where PCG converges after 1 iteration, this is an indication that the preconditioner matrix being used is a complete factorization. The problem is solved after 1 iteration because performing a complete LU factorization on the coefficient matrix is the same as solving the problem.
  2. It's not surprising to see PCG not converge after 100 iterations, but it is surprising to see a relative residual of NaN. This suggests that one of the values in the solution vector blew up to Inf at some point (or, less likely, that you provided an initial guess or coefficient matrix that had a NaN or Inf in it). The best advice for this case is to use a better preconditioner matrix since that helps with the condition of the coefficient matrix.
That said, I would expect these two messages to be returned by PCG for two separate function calls. If, as advertised, both of these messages were printed by PCG for a single function call, then I recommend calling Technical Support. That could potentially be a bug that needs to be fixed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!