LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cgbt05.f
Go to the documentation of this file.
00001 *> \brief \b CGBT05
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       SUBROUTINE CGBT05( TRANS, N, KL, KU, NRHS, AB, LDAB, B, LDB, X,
00012 *                          LDX, XACT, LDXACT, FERR, BERR, RESLTS )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER          TRANS
00016 *       INTEGER            KL, KU, LDAB, LDB, LDX, LDXACT, N, NRHS
00017 *       ..
00018 *       .. Array Arguments ..
00019 *       REAL               BERR( * ), FERR( * ), RESLTS( * )
00020 *       COMPLEX            AB( LDAB, * ), B( LDB, * ), X( LDX, * ),
00021 *      $                   XACT( LDXACT, * )
00022 *       ..
00023 *  
00024 *
00025 *> \par Purpose:
00026 *  =============
00027 *>
00028 *> \verbatim
00029 *>
00030 *> CGBT05 tests the error bounds from iterative refinement for the
00031 *> computed solution to a system of equations op(A)*X = B, where A is a
00032 *> general band matrix of order n with kl subdiagonals and ku
00033 *> superdiagonals and op(A) = A or A**T, depending on TRANS.
00034 *>
00035 *> RESLTS(1) = test of the error bound
00036 *>           = norm(X - XACT) / ( norm(X) * FERR )
00037 *>
00038 *> A large value is returned if this ratio is not less than one.
00039 *>
00040 *> RESLTS(2) = residual from the iterative refinement routine
00041 *>           = the maximum of BERR / ( NZ*EPS + (*) ), where
00042 *>             (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
00043 *>             and NZ = max. number of nonzeros in any row of A, plus 1
00044 *> \endverbatim
00045 *
00046 *  Arguments:
00047 *  ==========
00048 *
00049 *> \param[in] TRANS
00050 *> \verbatim
00051 *>          TRANS is CHARACTER*1
00052 *>          Specifies the form of the system of equations.
00053 *>          = 'N':  A * X = B     (No transpose)
00054 *>          = 'T':  A**T * X = B  (Transpose)
00055 *>          = 'C':  A**H * X = B  (Conjugate transpose = Transpose)
00056 *> \endverbatim
00057 *>
00058 *> \param[in] N
00059 *> \verbatim
00060 *>          N is INTEGER
00061 *>          The number of rows of the matrices X, B, and XACT, and the
00062 *>          order of the matrix A.  N >= 0.
00063 *> \endverbatim
00064 *>
00065 *> \param[in] KL
00066 *> \verbatim
00067 *>          KL is INTEGER
00068 *>          The number of subdiagonals within the band of A.  KL >= 0.
00069 *> \endverbatim
00070 *>
00071 *> \param[in] KU
00072 *> \verbatim
00073 *>          KU is INTEGER
00074 *>          The number of superdiagonals within the band of A.  KU >= 0.
00075 *> \endverbatim
00076 *>
00077 *> \param[in] NRHS
00078 *> \verbatim
00079 *>          NRHS is INTEGER
00080 *>          The number of columns of the matrices X, B, and XACT.
00081 *>          NRHS >= 0.
00082 *> \endverbatim
00083 *>
00084 *> \param[in] AB
00085 *> \verbatim
00086 *>          AB is COMPLEX array, dimension (LDAB,N)
00087 *>          The original band matrix A, stored in rows 1 to KL+KU+1.
00088 *>          The j-th column of A is stored in the j-th column of the
00089 *>          array AB as follows:
00090 *>          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
00091 *> \endverbatim
00092 *>
00093 *> \param[in] LDAB
00094 *> \verbatim
00095 *>          LDAB is INTEGER
00096 *>          The leading dimension of the array AB.  LDAB >= KL+KU+1.
00097 *> \endverbatim
00098 *>
00099 *> \param[in] B
00100 *> \verbatim
00101 *>          B is COMPLEX array, dimension (LDB,NRHS)
00102 *>          The right hand side vectors for the system of linear
00103 *>          equations.
00104 *> \endverbatim
00105 *>
00106 *> \param[in] LDB
00107 *> \verbatim
00108 *>          LDB is INTEGER
00109 *>          The leading dimension of the array B.  LDB >= max(1,N).
00110 *> \endverbatim
00111 *>
00112 *> \param[in] X
00113 *> \verbatim
00114 *>          X is COMPLEX array, dimension (LDX,NRHS)
00115 *>          The computed solution vectors.  Each vector is stored as a
00116 *>          column of the matrix X.
00117 *> \endverbatim
00118 *>
00119 *> \param[in] LDX
00120 *> \verbatim
00121 *>          LDX is INTEGER
00122 *>          The leading dimension of the array X.  LDX >= max(1,N).
00123 *> \endverbatim
00124 *>
00125 *> \param[in] XACT
00126 *> \verbatim
00127 *>          XACT is COMPLEX array, dimension (LDX,NRHS)
00128 *>          The exact solution vectors.  Each vector is stored as a
00129 *>          column of the matrix XACT.
00130 *> \endverbatim
00131 *>
00132 *> \param[in] LDXACT
00133 *> \verbatim
00134 *>          LDXACT is INTEGER
00135 *>          The leading dimension of the array XACT.  LDXACT >= max(1,N).
00136 *> \endverbatim
00137 *>
00138 *> \param[in] FERR
00139 *> \verbatim
00140 *>          FERR is REAL array, dimension (NRHS)
00141 *>          The estimated forward error bounds for each solution vector
00142 *>          X.  If XTRUE is the true solution, FERR bounds the magnitude
00143 *>          of the largest entry in (X - XTRUE) divided by the magnitude
00144 *>          of the largest entry in X.
00145 *> \endverbatim
00146 *>
00147 *> \param[in] BERR
00148 *> \verbatim
00149 *>          BERR is REAL array, dimension (NRHS)
00150 *>          The componentwise relative backward error of each solution
00151 *>          vector (i.e., the smallest relative change in any entry of A
00152 *>          or B that makes X an exact solution).
00153 *> \endverbatim
00154 *>
00155 *> \param[out] RESLTS
00156 *> \verbatim
00157 *>          RESLTS is REAL array, dimension (2)
00158 *>          The maximum over the NRHS solution vectors of the ratios:
00159 *>          RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR )
00160 *>          RESLTS(2) = BERR / ( NZ*EPS + (*) )
00161 *> \endverbatim
00162 *
00163 *  Authors:
00164 *  ========
00165 *
00166 *> \author Univ. of Tennessee 
00167 *> \author Univ. of California Berkeley 
00168 *> \author Univ. of Colorado Denver 
00169 *> \author NAG Ltd. 
00170 *
00171 *> \date November 2011
00172 *
00173 *> \ingroup complex_lin
00174 *
00175 *  =====================================================================
00176       SUBROUTINE CGBT05( TRANS, N, KL, KU, NRHS, AB, LDAB, B, LDB, X,
00177      $                   LDX, XACT, LDXACT, FERR, BERR, RESLTS )
00178 *
00179 *  -- LAPACK test routine (version 3.4.0) --
00180 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00181 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00182 *     November 2011
00183 *
00184 *     .. Scalar Arguments ..
00185       CHARACTER          TRANS
00186       INTEGER            KL, KU, LDAB, LDB, LDX, LDXACT, N, NRHS
00187 *     ..
00188 *     .. Array Arguments ..
00189       REAL               BERR( * ), FERR( * ), RESLTS( * )
00190       COMPLEX            AB( LDAB, * ), B( LDB, * ), X( LDX, * ),
00191      $                   XACT( LDXACT, * )
00192 *     ..
00193 *
00194 *  =====================================================================
00195 *
00196 *     .. Parameters ..
00197       REAL               ZERO, ONE
00198       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00199 *     ..
00200 *     .. Local Scalars ..
00201       LOGICAL            NOTRAN
00202       INTEGER            I, IMAX, J, K, NZ
00203       REAL               AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM
00204       COMPLEX            ZDUM
00205 *     ..
00206 *     .. External Functions ..
00207       LOGICAL            LSAME
00208       INTEGER            ICAMAX
00209       REAL               SLAMCH
00210       EXTERNAL           LSAME, ICAMAX, SLAMCH
00211 *     ..
00212 *     .. Intrinsic Functions ..
00213       INTRINSIC          ABS, AIMAG, MAX, MIN, REAL
00214 *     ..
00215 *     .. Statement Functions ..
00216       REAL               CABS1
00217 *     ..
00218 *     .. Statement Function definitions ..
00219       CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
00220 *     ..
00221 *     .. Executable Statements ..
00222 *
00223 *     Quick exit if N = 0 or NRHS = 0.
00224 *
00225       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00226          RESLTS( 1 ) = ZERO
00227          RESLTS( 2 ) = ZERO
00228          RETURN
00229       END IF
00230 *
00231       EPS = SLAMCH( 'Epsilon' )
00232       UNFL = SLAMCH( 'Safe minimum' )
00233       OVFL = ONE / UNFL
00234       NOTRAN = LSAME( TRANS, 'N' )
00235       NZ = MIN( KL+KU+2, N+1 )
00236 *
00237 *     Test 1:  Compute the maximum of
00238 *        norm(X - XACT) / ( norm(X) * FERR )
00239 *     over all the vectors X and XACT using the infinity-norm.
00240 *
00241       ERRBND = ZERO
00242       DO 30 J = 1, NRHS
00243          IMAX = ICAMAX( N, X( 1, J ), 1 )
00244          XNORM = MAX( CABS1( X( IMAX, J ) ), UNFL )
00245          DIFF = ZERO
00246          DO 10 I = 1, N
00247             DIFF = MAX( DIFF, CABS1( X( I, J )-XACT( I, J ) ) )
00248    10    CONTINUE
00249 *
00250          IF( XNORM.GT.ONE ) THEN
00251             GO TO 20
00252          ELSE IF( DIFF.LE.OVFL*XNORM ) THEN
00253             GO TO 20
00254          ELSE
00255             ERRBND = ONE / EPS
00256             GO TO 30
00257          END IF
00258 *
00259    20    CONTINUE
00260          IF( DIFF / XNORM.LE.FERR( J ) ) THEN
00261             ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) )
00262          ELSE
00263             ERRBND = ONE / EPS
00264          END IF
00265    30 CONTINUE
00266       RESLTS( 1 ) = ERRBND
00267 *
00268 *     Test 2:  Compute the maximum of BERR / ( NZ*EPS + (*) ), where
00269 *     (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
00270 *
00271       DO 70 K = 1, NRHS
00272          DO 60 I = 1, N
00273             TMP = CABS1( B( I, K ) )
00274             IF( NOTRAN ) THEN
00275                DO 40 J = MAX( I-KL, 1 ), MIN( I+KU, N )
00276                   TMP = TMP + CABS1( AB( KU+1+I-J, J ) )*
00277      $                  CABS1( X( J, K ) )
00278    40          CONTINUE
00279             ELSE
00280                DO 50 J = MAX( I-KU, 1 ), MIN( I+KL, N )
00281                   TMP = TMP + CABS1( AB( KU+1+J-I, I ) )*
00282      $                  CABS1( X( J, K ) )
00283    50          CONTINUE
00284             END IF
00285             IF( I.EQ.1 ) THEN
00286                AXBI = TMP
00287             ELSE
00288                AXBI = MIN( AXBI, TMP )
00289             END IF
00290    60    CONTINUE
00291          TMP = BERR( K ) / ( NZ*EPS+NZ*UNFL / MAX( AXBI, NZ*UNFL ) )
00292          IF( K.EQ.1 ) THEN
00293             RESLTS( 2 ) = TMP
00294          ELSE
00295             RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP )
00296          END IF
00297    70 CONTINUE
00298 *
00299       RETURN
00300 *
00301 *     End of CGBT05
00302 *
00303       END
 All Files Functions