ell1 norm convergence test
Ryan Yan
vyan2000 at gmail.com
Mon Sep 21 15:00:56 CDT 2009
I agree that reformulate 1-norm is going to be a pain. Actually, I just want
to see the history of true residual 1_norm. If using the 2_norm as stop
criteria and I still can see the history of 1-norm, than I am happy. But I
guess there has to be a price for visiting the 1_norm. I will try to use
KSPBuildResidual() to make a visit.
The reason of checking L_1 norm is that our customer has a existing linear
solver which uses the true residual 1_norm as the stopping criteria, and the
1_Norm or 2_Norm has a great difference. Imagine one has a huge vector with
all small values but various magnitude. The 1_norm of that vector is going
to be much larger than the 2_norm. That's what exactly happens in my case.
Thank you very much for the suggestion,
Yan
On Mon, Sep 21, 2009 at 3:29 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Likely it is too expensive to use the 1-norm for stopping criteria for
> fgmres unless you can reformulate fgmres to give you back the residual
> efficiently.
>
> Barry
>
>
> On Sep 21, 2009, at 2:04 PM, Ryan Yan wrote:
>
> Hi Barry,
>> Thanks for the suggestion.
>>
>> I am using FGMRES as the krylov solver. Is there a direct access to the
>> residual vector for FGMRES. I guess the answer is yes, since that's the
>> Krylov method which supports right preconditioning and provides the true
>> residual 2_Norm monitor, right?
>>
>> If so, which header should I include to fetch the residual directly from
>> KSP_FGMRES?
>>
>> Yan
>>
>>
>>
>> On Mon, Sep 21, 2009 at 2:43 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>> Yan,
>>
>> This depends on the Krylov method being used. For example with GMRES the
>> residual vector is NOT available at each iteration (the 2-norm of the
>> residual is approximated via a recurrence relationship).
>>
>> You can call KSPBuildResidual() to have the true residual computed for
>> you. Note: it is expensive because it actually builds the current solution
>> and computes r = b - A*x
>>
>> What we intended is that if you want the residual efficiently for example
>> for the CG method, you determine what Krylov method you want to use the
>> include the appropriate private include file and access the residual
>> directly from the data structure. This would be efficient. (but like I said
>> does not work for all methods). For cg include src/ksp/ksp/impls/cg/cgctx.h
>>
>>
>> Barry
>>
>>
>> On Sep 21, 2009, at 12:44 PM, Ryan Yan wrote:
>>
>> Hi All,
>> The following question is only for test and comparison reason.
>>
>> Is there a command line option to set up using 1-Norm(sum of absolute
>> value of residuals) as convergence monitor and test.
>>
>> Alternatively, if I can get the residual "r" out at the end of each
>> iteration, then it is going to be much simpler, since I can just call
>> VecNorm(r, NORM_1, &r_ell1) and pass the r_ell1 into the convergence monitor
>> and test. Can anyone inform me if PETSc has an interface for the resuidual
>> r?
>>
>> Or one has to call the convergence test:
>> MyKSPConverged(ksp,n,rnorm,flag,dummy);
>> and following the steps:
>> 1. fetch the exact solution:
>>
>> KSPBuildSolution(ksp,PETSC_NULL_OBJECT,x,ierr)
>>
>> 2. calculate the residual:
>>
>> pass the Right Hand side and the Matrix in to calculate the 1-Norm. But
>> this step is *not* obvious, since the matrix and rhs is already distributed
>> over each processes.
>>
>> 3. set up the convergence test based on the 1_Norm residual.
>>
>>
>> Thank you very much,
>>
>>
>> Yan
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090921/0664e3f8/attachment.htm>
More information about the petsc-users
mailing list