EstimateError.F
#include "parmdefines.h"
c**********************************************************************
#include "author.inc"
c* $Id: EstimateError.F,v 1.1 1996/04/28 20:14:54 turner Exp $
c*
c* Computes error estimate based on various norms.
c*
c* <PARAMETER LIST>
c*
c* Input:
c* anorm - norm of coefficient
c* xnorm - norm of unknown vector
c* bnorm - norm of right-hand-side
c* rnorm - norm of residual vector
c* rnormt0 - norm of initial residual vector
c*
c* Output:
c* err - error estimate
c* status - return status:
c* 0 ==> convergence was achieved
c*
#include "parmdesc.inc"
c*
#include "copyright.inc"
c**********************************************************************
subroutine JT_EstimateError (stop, anorm, xnorm, bnorm, rnorm,
& rnormt0, err, status)
implicit none
c
c ... Input:
integer stop
real anorm, xnorm, bnorm, rnorm, rnormt0
c
c ... Output:
integer status
real err
c
c ... Local:
real zero
c
parameter (zero=0.0d0)
c
if (stop .eq. _JT_stop_axb_) then
c
c Use || r || / ( || A ||*|| x || + || b || )
if (xnorm.eq.zero .and. bnorm.eq.zero) then
err = zero
else
err = rnorm / (anorm*xnorm + bnorm)
endif
elseif (stop .eq. _JT_stop_b_) then
c
c Use || r || / || b ||
err = rnorm/bnorm
elseif (stop .eq. _JT_stop_x_) then
c
c Use || r || / || x ||
err = rnorm
if (xnorm .ne. zero) err = err/xnorm
elseif (stop .eq. _JT_stop_r0_) then
c
c Use || r || / || b - Ax0 ||
err = rnorm/rnormt0
elseif (stop .eq. _JT_stop_r_) then
c
c Use || r ||
err = rnorm
endif
c
status = 0
return
end