LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dla_lin_berr.f
Go to the documentation of this file.
00001 *> \brief \b DLA_LIN_BERR
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DLA_LIN_BERR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_lin_berr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_lin_berr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_lin_berr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DLA_LIN_BERR ( N, NZ, NRHS, RES, AYB, BERR )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            N, NZ, NRHS
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       DOUBLE PRECISION   AYB( N, NRHS ), BERR( NRHS )
00028 *       DOUBLE PRECISION   RES( N, NRHS )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *>    DLA_LIN_BERR computes component-wise relative backward error from
00038 *>    the formula
00039 *>        max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00040 *>    where abs(Z) is the component-wise absolute value of the matrix
00041 *>    or vector Z.
00042 *> \endverbatim
00043 *
00044 *  Arguments:
00045 *  ==========
00046 *
00047 *> \param[in] N
00048 *> \verbatim
00049 *>          N is INTEGER
00050 *>     The number of linear equations, i.e., the order of the
00051 *>     matrix A.  N >= 0.
00052 *> \endverbatim
00053 *>
00054 *> \param[in] NZ
00055 *> \verbatim
00056 *>          NZ is INTEGER
00057 *>     We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to
00058 *>     guard against spuriously zero residuals. Default value is N.
00059 *> \endverbatim
00060 *>
00061 *> \param[in] NRHS
00062 *> \verbatim
00063 *>          NRHS is INTEGER
00064 *>     The number of right hand sides, i.e., the number of columns
00065 *>     of the matrices AYB, RES, and BERR.  NRHS >= 0.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] RES
00069 *> \verbatim
00070 *>          RES is DOUBLE PRECISION array, dimension (N,NRHS)
00071 *>     The residual matrix, i.e., the matrix R in the relative backward
00072 *>     error formula above.
00073 *> \endverbatim
00074 *>
00075 *> \param[in] AYB
00076 *> \verbatim
00077 *>          AYB is DOUBLE PRECISION array, dimension (N, NRHS)
00078 *>     The denominator in the relative backward error formula above, i.e.,
00079 *>     the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B
00080 *>     are from iterative refinement (see dla_gerfsx_extended.f).
00081 *> \endverbatim
00082 *>     
00083 *> \param[out] BERR
00084 *> \verbatim
00085 *>          BERR is DOUBLE PRECISION array, dimension (NRHS)
00086 *>     The component-wise relative backward error from the formula above.
00087 *> \endverbatim
00088 *
00089 *  Authors:
00090 *  ========
00091 *
00092 *> \author Univ. of Tennessee 
00093 *> \author Univ. of California Berkeley 
00094 *> \author Univ. of Colorado Denver 
00095 *> \author NAG Ltd. 
00096 *
00097 *> \date November 2011
00098 *
00099 *> \ingroup doubleOTHERcomputational
00100 *
00101 *  =====================================================================
00102       SUBROUTINE DLA_LIN_BERR ( N, NZ, NRHS, RES, AYB, BERR )
00103 *
00104 *  -- LAPACK computational routine (version 3.4.0) --
00105 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00106 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00107 *     November 2011
00108 *
00109 *     .. Scalar Arguments ..
00110       INTEGER            N, NZ, NRHS
00111 *     ..
00112 *     .. Array Arguments ..
00113       DOUBLE PRECISION   AYB( N, NRHS ), BERR( NRHS )
00114       DOUBLE PRECISION   RES( N, NRHS )
00115 *     ..
00116 *
00117 *  =====================================================================
00118 *
00119 *     .. Local Scalars ..
00120       DOUBLE PRECISION   TMP
00121       INTEGER            I, J
00122 *     ..
00123 *     .. Intrinsic Functions ..
00124       INTRINSIC          ABS, MAX
00125 *     ..
00126 *     .. External Functions ..
00127       EXTERNAL           DLAMCH
00128       DOUBLE PRECISION   DLAMCH
00129       DOUBLE PRECISION   SAFE1
00130 *     ..
00131 *     .. Executable Statements ..
00132 *
00133 *     Adding SAFE1 to the numerator guards against spuriously zero
00134 *     residuals.  A similar safeguard is in the SLA_yyAMV routine used
00135 *     to compute AYB.
00136 *
00137       SAFE1 = DLAMCH( 'Safe minimum' )
00138       SAFE1 = (NZ+1)*SAFE1
00139 
00140       DO J = 1, NRHS
00141          BERR(J) = 0.0D+0
00142          DO I = 1, N
00143             IF (AYB(I,J) .NE. 0.0D+0) THEN
00144                TMP = (SAFE1+ABS(RES(I,J)))/AYB(I,J)
00145                BERR(J) = MAX( BERR(J), TMP )
00146             END IF
00147 *
00148 *     If AYB is exactly 0.0 (and if computed by SLA_yyAMV), then we know
00149 *     the true residual also must be exactly 0.0.
00150 *
00151          END DO
00152       END DO
00153       END
 All Files Functions