LAPACK 3.3.1
Linear Algebra PACKage

zpbt05.f

Go to the documentation of this file.
00001       SUBROUTINE ZPBT05( UPLO, N, KD, NRHS, AB, LDAB, B, LDB, X, LDX,
00002      $                   XACT, LDXACT, FERR, BERR, RESLTS )
00003 *
00004 *  -- LAPACK test routine (version 3.1) --
00005 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            KD, LDAB, LDB, LDX, LDXACT, N, NRHS
00011 *     ..
00012 *     .. Array Arguments ..
00013       DOUBLE PRECISION   BERR( * ), FERR( * ), RESLTS( * )
00014       COMPLEX*16         AB( LDAB, * ), B( LDB, * ), X( LDX, * ),
00015      $                   XACT( LDXACT, * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  ZPBT05 tests the error bounds from iterative refinement for the
00022 *  computed solution to a system of equations A*X = B, where A is a
00023 *  Hermitian band matrix.
00024 *
00025 *  RESLTS(1) = test of the error bound
00026 *            = norm(X - XACT) / ( norm(X) * FERR )
00027 *
00028 *  A large value is returned if this ratio is not less than one.
00029 *
00030 *  RESLTS(2) = residual from the iterative refinement routine
00031 *            = the maximum of BERR / ( NZ*EPS + (*) ), where
00032 *              (*) = NZ*UNFL / (min_i (abs(A)*abs(X) +abs(b))_i )
00033 *              and NZ = max. number of nonzeros in any row of A, plus 1
00034 *
00035 *  Arguments
00036 *  =========
00037 *
00038 *  UPLO    (input) CHARACTER*1
00039 *          Specifies whether the upper or lower triangular part of the
00040 *          Hermitian matrix A is stored.
00041 *          = 'U':  Upper triangular
00042 *          = 'L':  Lower triangular
00043 *
00044 *  N       (input) INTEGER
00045 *          The number of rows of the matrices X, B, and XACT, and the
00046 *          order of the matrix A.  N >= 0.
00047 *
00048 *  KD      (input) INTEGER
00049 *          The number of super-diagonals of the matrix A if UPLO = 'U',
00050 *          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0.
00051 *
00052 *  NRHS    (input) INTEGER
00053 *          The number of columns of the matrices X, B, and XACT.
00054 *          NRHS >= 0.
00055 *
00056 *  AB      (input) COMPLEX*16 array, dimension (LDAB,N)
00057 *          The upper or lower triangle of the Hermitian band matrix A,
00058 *          stored in the first KD+1 rows of the array.  The j-th column
00059 *          of A is stored in the j-th column of the array AB as follows:
00060 *          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00061 *          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00062 *
00063 *  LDAB    (input) INTEGER
00064 *          The leading dimension of the array AB.  LDAB >= KD+1.
00065 *
00066 *  B       (input) COMPLEX*16 array, dimension (LDB,NRHS)
00067 *          The right hand side vectors for the system of linear
00068 *          equations.
00069 *
00070 *  LDB     (input) INTEGER
00071 *          The leading dimension of the array B.  LDB >= max(1,N).
00072 *
00073 *  X       (input) COMPLEX*16 array, dimension (LDX,NRHS)
00074 *          The computed solution vectors.  Each vector is stored as a
00075 *          column of the matrix X.
00076 *
00077 *  LDX     (input) INTEGER
00078 *          The leading dimension of the array X.  LDX >= max(1,N).
00079 *
00080 *  XACT    (input) COMPLEX*16 array, dimension (LDX,NRHS)
00081 *          The exact solution vectors.  Each vector is stored as a
00082 *          column of the matrix XACT.
00083 *
00084 *  LDXACT  (input) INTEGER
00085 *          The leading dimension of the array XACT.  LDXACT >= max(1,N).
00086 *
00087 *  FERR    (input) DOUBLE PRECISION array, dimension (NRHS)
00088 *          The estimated forward error bounds for each solution vector
00089 *          X.  If XTRUE is the true solution, FERR bounds the magnitude
00090 *          of the largest entry in (X - XTRUE) divided by the magnitude
00091 *          of the largest entry in X.
00092 *
00093 *  BERR    (input) DOUBLE PRECISION array, dimension (NRHS)
00094 *          The componentwise relative backward error of each solution
00095 *          vector (i.e., the smallest relative change in any entry of A
00096 *          or B that makes X an exact solution).
00097 *
00098 *  RESLTS  (output) DOUBLE PRECISION array, dimension (2)
00099 *          The maximum over the NRHS solution vectors of the ratios:
00100 *          RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR )
00101 *          RESLTS(2) = BERR / ( NZ*EPS + (*) )
00102 *
00103 *  =====================================================================
00104 *
00105 *     .. Parameters ..
00106       DOUBLE PRECISION   ZERO, ONE
00107       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00108 *     ..
00109 *     .. Local Scalars ..
00110       LOGICAL            UPPER
00111       INTEGER            I, IMAX, J, K, NZ
00112       DOUBLE PRECISION   AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM
00113       COMPLEX*16         ZDUM
00114 *     ..
00115 *     .. External Functions ..
00116       LOGICAL            LSAME
00117       INTEGER            IZAMAX
00118       DOUBLE PRECISION   DLAMCH
00119       EXTERNAL           LSAME, IZAMAX, DLAMCH
00120 *     ..
00121 *     .. Intrinsic Functions ..
00122       INTRINSIC          ABS, DBLE, DIMAG, MAX, MIN
00123 *     ..
00124 *     .. Statement Functions ..
00125       DOUBLE PRECISION   CABS1
00126 *     ..
00127 *     .. Statement Function definitions ..
00128       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00129 *     ..
00130 *     .. Executable Statements ..
00131 *
00132 *     Quick exit if N = 0 or NRHS = 0.
00133 *
00134       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00135          RESLTS( 1 ) = ZERO
00136          RESLTS( 2 ) = ZERO
00137          RETURN
00138       END IF
00139 *
00140       EPS = DLAMCH( 'Epsilon' )
00141       UNFL = DLAMCH( 'Safe minimum' )
00142       OVFL = ONE / UNFL
00143       UPPER = LSAME( UPLO, 'U' )
00144       NZ = 2*MAX( KD, N-1 ) + 1
00145 *
00146 *     Test 1:  Compute the maximum of
00147 *        norm(X - XACT) / ( norm(X) * FERR )
00148 *     over all the vectors X and XACT using the infinity-norm.
00149 *
00150       ERRBND = ZERO
00151       DO 30 J = 1, NRHS
00152          IMAX = IZAMAX( N, X( 1, J ), 1 )
00153          XNORM = MAX( CABS1( X( IMAX, J ) ), UNFL )
00154          DIFF = ZERO
00155          DO 10 I = 1, N
00156             DIFF = MAX( DIFF, CABS1( X( I, J )-XACT( I, J ) ) )
00157    10    CONTINUE
00158 *
00159          IF( XNORM.GT.ONE ) THEN
00160             GO TO 20
00161          ELSE IF( DIFF.LE.OVFL*XNORM ) THEN
00162             GO TO 20
00163          ELSE
00164             ERRBND = ONE / EPS
00165             GO TO 30
00166          END IF
00167 *
00168    20    CONTINUE
00169          IF( DIFF / XNORM.LE.FERR( J ) ) THEN
00170             ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) )
00171          ELSE
00172             ERRBND = ONE / EPS
00173          END IF
00174    30 CONTINUE
00175       RESLTS( 1 ) = ERRBND
00176 *
00177 *     Test 2:  Compute the maximum of BERR / ( NZ*EPS + (*) ), where
00178 *     (*) = NZ*UNFL / (min_i (abs(A)*abs(X) +abs(b))_i )
00179 *
00180       DO 90 K = 1, NRHS
00181          DO 80 I = 1, N
00182             TMP = CABS1( B( I, K ) )
00183             IF( UPPER ) THEN
00184                DO 40 J = MAX( I-KD, 1 ), I - 1
00185                   TMP = TMP + CABS1( AB( KD+1-I+J, I ) )*
00186      $                  CABS1( X( J, K ) )
00187    40          CONTINUE
00188                TMP = TMP + ABS( DBLE( AB( KD+1, I ) ) )*
00189      $               CABS1( X( I, K ) )
00190                DO 50 J = I + 1, MIN( I+KD, N )
00191                   TMP = TMP + CABS1( AB( KD+1+I-J, J ) )*
00192      $                  CABS1( X( J, K ) )
00193    50          CONTINUE
00194             ELSE
00195                DO 60 J = MAX( I-KD, 1 ), I - 1
00196                   TMP = TMP + CABS1( AB( 1+I-J, J ) )*CABS1( X( J, K ) )
00197    60          CONTINUE
00198                TMP = TMP + ABS( DBLE( AB( 1, I ) ) )*CABS1( X( I, K ) )
00199                DO 70 J = I + 1, MIN( I+KD, N )
00200                   TMP = TMP + CABS1( AB( 1+J-I, I ) )*CABS1( X( J, K ) )
00201    70          CONTINUE
00202             END IF
00203             IF( I.EQ.1 ) THEN
00204                AXBI = TMP
00205             ELSE
00206                AXBI = MIN( AXBI, TMP )
00207             END IF
00208    80    CONTINUE
00209          TMP = BERR( K ) / ( NZ*EPS+NZ*UNFL / MAX( AXBI, NZ*UNFL ) )
00210          IF( K.EQ.1 ) THEN
00211             RESLTS( 2 ) = TMP
00212          ELSE
00213             RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP )
00214          END IF
00215    90 CONTINUE
00216 *
00217       RETURN
00218 *
00219 *     End of ZPBT05
00220 *
00221       END
 All Files Functions