[petsc-users] KSPLSQR convergence criterion

Barry Smith bsmith at mcs.anl.gov
Fri Aug 6 22:25:02 CDT 2010


> Chetan,

   We don't currently have a convergence test for this case (hence it keeps iterating). I am working on it now and will add the convergence test in this case.

   Barry


On Aug 6, 2010, at 11:40 AM, Chetan Jhurani wrote:

> Hello!
> 
> Could someone help me figure out the correct way to
> to use KSPLSQR?  Maybe I'm missing something simple.
> 
> I'm trying to use it to solve an over-determined set
> of equations.  It seems like the KSP iterations keep on
> going because the residual is not small enough.  But
> since the system is over-determined, in general, the
> exact residual Ax - b will not be zero.
> 
> For example, to solve the system
> 
> min_x ||Ax - b||, with A = [1;2], b = [3;4],
> 
> x must be inv(A'A)A'b = 2.2.  Relative residual is 0.17888.
> See the Matlab code below too, which gives the correct
> value in 1 iteration.
> 
> KSPLSQR, however, stagnates after 1 iteration.  At that
> point, the relative residual and true residual norm
> match the correct values exactly.
> 
> Is there an assumption in KSPLSQR that the system is always
> invertible or under-determined?  This is petsc-3.1p2 if
> it matters.
> 
> Thanks,
> 
> Chetan
> 
> ----------------------------------------------------
> KSPLSQR:
> 
>  0 KSP preconditioned resid norm 5.000000000000e+000 true resid norm 5.000000000000e+000 ||Ae||/||Ax|| 1.000000000000e+000
>  1 KSP preconditioned resid norm 8.944271909999e-001 true resid norm 8.944271909999e-001 ||Ae||/||Ax|| 1.788854382000e-001
>  2 KSP preconditioned resid norm 8.944271909999e-001 true resid norm 8.944271909999e-001 ||Ae||/||Ax|| 1.788854382000e-001
>  3 KSP preconditioned resid norm 8.944271909999e-001 true resid norm 8.944271909999e-001 ||Ae||/||Ax|| 1.788854382000e-001
>  4 KSP preconditioned resid norm 8.944271909999e-001 true resid norm 8.944271909999e-001 ||Ae||/||Ax|| 1.788854382000e-001
>  5 KSP preconditioned resid norm 8.944271909999e-001 true resid norm 8.944271909999e-001 ||Ae||/||Ax|| 1.788854382000e-001
> 
> Matlab:
> 
>>> a = [1;2];
>>> b = [3;4];
>>> [x,FLAG,RELRES,ITER] = lsqr(a,b, 1e-10, 10)
> x =
>   2.200000000000000
> FLAG =
>     1
> RELRES =
>   0.178885438199983
> ITER =
>     1
>>> norm(a*x-b)
> ans =
>   0.894427190999916
> 
> ----------------------------------------------------
> 
> 



More information about the petsc-users mailing list