LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zla_lin_berr.f
Go to the documentation of this file.
00001 *> \brief \b ZLA_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 ZLA_LIN_BERR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zla_lin_berr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zla_lin_berr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zla_lin_berr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE ZLA_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 *       COMPLEX*16         RES( N, NRHS )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *>    ZLA_LIN_BERR computes componentwise 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 componentwise 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 zla_gerfsx_extended.f).
00081 *> \endverbatim
00082 *>     
00083 *> \param[out] BERR
00084 *> \verbatim
00085 *>          BERR is COMPLEX*16 array, dimension (NRHS)
00086 *>     The componentwise 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 complex16OTHERcomputational
00100 *
00101 *  =====================================================================
00102       SUBROUTINE ZLA_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       COMPLEX*16         RES( N, NRHS )
00115 *     ..
00116 *
00117 *  =====================================================================
00118 *
00119 *     .. Local Scalars ..
00120       DOUBLE PRECISION   TMP
00121       INTEGER            I, J
00122       COMPLEX*16         CDUM
00123 *     ..
00124 *     .. Intrinsic Functions ..
00125       INTRINSIC          ABS, REAL, DIMAG, MAX
00126 *     ..
00127 *     .. External Functions ..
00128       EXTERNAL           DLAMCH
00129       DOUBLE PRECISION   DLAMCH
00130       DOUBLE PRECISION   SAFE1
00131 *     ..
00132 *     .. Statement Functions ..
00133       COMPLEX*16         CABS1
00134 *     ..
00135 *     .. Statement Function Definitions ..
00136       CABS1( CDUM ) = ABS( DBLE( CDUM ) ) + ABS( DIMAG( CDUM ) )
00137 *     ..
00138 *     .. Executable Statements ..
00139 *
00140 *     Adding SAFE1 to the numerator guards against spuriously zero
00141 *     residuals.  A similar safeguard is in the CLA_yyAMV routine used
00142 *     to compute AYB.
00143 *
00144       SAFE1 = DLAMCH( 'Safe minimum' )
00145       SAFE1 = (NZ+1)*SAFE1
00146 
00147       DO J = 1, NRHS
00148          BERR(J) = 0.0D+0
00149          DO I = 1, N
00150             IF (AYB(I,J) .NE. 0.0D+0) THEN
00151                TMP = (SAFE1 + CABS1(RES(I,J)))/AYB(I,J)
00152                BERR(J) = MAX( BERR(J), TMP )
00153             END IF
00154 *
00155 *     If AYB is exactly 0.0 (and if computed by CLA_yyAMV), then we know
00156 *     the true residual also must be exactly 0.0.
00157 *
00158          END DO
00159       END DO
00160       END
 All Files Functions