LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ztbt02.f
Go to the documentation of this file.
00001 *> \brief \b ZTBT02
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 ZTBT02( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X,
00012 *                          LDX, B, LDB, WORK, RWORK, RESID )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER          DIAG, TRANS, UPLO
00016 *       INTEGER            KD, LDAB, LDB, LDX, N, NRHS
00017 *       DOUBLE PRECISION   RESID
00018 *       ..
00019 *       .. Array Arguments ..
00020 *       DOUBLE PRECISION   RWORK( * )
00021 *       COMPLEX*16         AB( LDAB, * ), B( LDB, * ), WORK( * ),
00022 *      $                   X( LDX, * )
00023 *       ..
00024 *  
00025 *
00026 *> \par Purpose:
00027 *  =============
00028 *>
00029 *> \verbatim
00030 *>
00031 *> ZTBT02 computes the residual for the computed solution to a
00032 *> triangular system of linear equations  A*x = b,  A**T *x = b,  or
00033 *> A**H *x = b  when A is a triangular band matrix.  Here A**T denotes
00034 *> the transpose of A, A**H denotes the conjugate transpose of A, and
00035 *> x and b are N by NRHS matrices.  The test ratio is the maximum over
00036 *> the number of right hand sides of
00037 *>    norm(b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ),
00038 *> where op(A) denotes A, A**T, or A**H, and EPS is the machine epsilon.
00039 *> \endverbatim
00040 *
00041 *  Arguments:
00042 *  ==========
00043 *
00044 *> \param[in] UPLO
00045 *> \verbatim
00046 *>          UPLO is CHARACTER*1
00047 *>          Specifies whether the matrix A is upper or lower triangular.
00048 *>          = 'U':  Upper triangular
00049 *>          = 'L':  Lower triangular
00050 *> \endverbatim
00051 *>
00052 *> \param[in] TRANS
00053 *> \verbatim
00054 *>          TRANS is CHARACTER*1
00055 *>          Specifies the operation applied to A.
00056 *>          = 'N':  A *x = b     (No transpose)
00057 *>          = 'T':  A**T *x = b  (Transpose)
00058 *>          = 'C':  A**H *x = b  (Conjugate transpose)
00059 *> \endverbatim
00060 *>
00061 *> \param[in] DIAG
00062 *> \verbatim
00063 *>          DIAG is CHARACTER*1
00064 *>          Specifies whether or not the matrix A is unit triangular.
00065 *>          = 'N':  Non-unit triangular
00066 *>          = 'U':  Unit triangular
00067 *> \endverbatim
00068 *>
00069 *> \param[in] N
00070 *> \verbatim
00071 *>          N is INTEGER
00072 *>          The order of the matrix A.  N >= 0.
00073 *> \endverbatim
00074 *>
00075 *> \param[in] KD
00076 *> \verbatim
00077 *>          KD is INTEGER
00078 *>          The number of superdiagonals or subdiagonals of the
00079 *>          triangular band matrix A.  KD >= 0.
00080 *> \endverbatim
00081 *>
00082 *> \param[in] NRHS
00083 *> \verbatim
00084 *>          NRHS is INTEGER
00085 *>          The number of right hand sides, i.e., the number of columns
00086 *>          of the matrices X and B.  NRHS >= 0.
00087 *> \endverbatim
00088 *>
00089 *> \param[in] AB
00090 *> \verbatim
00091 *>          AB is COMPLEX*16 array, dimension (LDA,N)
00092 *>          The upper or lower triangular band matrix A, stored in the
00093 *>          first kd+1 rows of the array. The j-th column of A is stored
00094 *>          in the j-th column of the array AB as follows:
00095 *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00096 *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00097 *> \endverbatim
00098 *>
00099 *> \param[in] LDAB
00100 *> \verbatim
00101 *>          LDAB is INTEGER
00102 *>          The leading dimension of the array AB.  LDAB >= max(1,KD+1).
00103 *> \endverbatim
00104 *>
00105 *> \param[in] X
00106 *> \verbatim
00107 *>          X is COMPLEX*16 array, dimension (LDX,NRHS)
00108 *>          The computed solution vectors for the system of linear
00109 *>          equations.
00110 *> \endverbatim
00111 *>
00112 *> \param[in] LDX
00113 *> \verbatim
00114 *>          LDX is INTEGER
00115 *>          The leading dimension of the array X.  LDX >= max(1,N).
00116 *> \endverbatim
00117 *>
00118 *> \param[in] B
00119 *> \verbatim
00120 *>          B is COMPLEX*16 array, dimension (LDB,NRHS)
00121 *>          The right hand side vectors for the system of linear
00122 *>          equations.
00123 *> \endverbatim
00124 *>
00125 *> \param[in] LDB
00126 *> \verbatim
00127 *>          LDB is INTEGER
00128 *>          The leading dimension of the array B.  LDB >= max(1,N).
00129 *> \endverbatim
00130 *>
00131 *> \param[out] WORK
00132 *> \verbatim
00133 *>          WORK is COMPLEX*16 array, dimension (N)
00134 *> \endverbatim
00135 *>
00136 *> \param[out] RWORK
00137 *> \verbatim
00138 *>          RWORK is DOUBLE PRECISION array, dimension (N)
00139 *> \endverbatim
00140 *>
00141 *> \param[out] RESID
00142 *> \verbatim
00143 *>          RESID is DOUBLE PRECISION
00144 *>          The maximum over the number of right hand sides of
00145 *>          norm(op(A)*x - b) / ( norm(op(A)) * norm(x) * EPS ).
00146 *> \endverbatim
00147 *
00148 *  Authors:
00149 *  ========
00150 *
00151 *> \author Univ. of Tennessee 
00152 *> \author Univ. of California Berkeley 
00153 *> \author Univ. of Colorado Denver 
00154 *> \author NAG Ltd. 
00155 *
00156 *> \date November 2011
00157 *
00158 *> \ingroup complex16_lin
00159 *
00160 *  =====================================================================
00161       SUBROUTINE ZTBT02( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X,
00162      $                   LDX, B, LDB, WORK, RWORK, RESID )
00163 *
00164 *  -- LAPACK test routine (version 3.4.0) --
00165 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00166 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00167 *     November 2011
00168 *
00169 *     .. Scalar Arguments ..
00170       CHARACTER          DIAG, TRANS, UPLO
00171       INTEGER            KD, LDAB, LDB, LDX, N, NRHS
00172       DOUBLE PRECISION   RESID
00173 *     ..
00174 *     .. Array Arguments ..
00175       DOUBLE PRECISION   RWORK( * )
00176       COMPLEX*16         AB( LDAB, * ), B( LDB, * ), WORK( * ),
00177      $                   X( LDX, * )
00178 *     ..
00179 *
00180 *  =====================================================================
00181 *
00182 *     .. Parameters ..
00183       DOUBLE PRECISION   ZERO, ONE
00184       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00185 *     ..
00186 *     .. Local Scalars ..
00187       INTEGER            J
00188       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00189 *     ..
00190 *     .. External Functions ..
00191       LOGICAL            LSAME
00192       DOUBLE PRECISION   DLAMCH, DZASUM, ZLANTB
00193       EXTERNAL           LSAME, DLAMCH, DZASUM, ZLANTB
00194 *     ..
00195 *     .. External Subroutines ..
00196       EXTERNAL           ZAXPY, ZCOPY, ZTBMV
00197 *     ..
00198 *     .. Intrinsic Functions ..
00199       INTRINSIC          DCMPLX, MAX
00200 *     ..
00201 *     .. Executable Statements ..
00202 *
00203 *     Quick exit if N = 0 or NRHS = 0
00204 *
00205       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00206          RESID = ZERO
00207          RETURN
00208       END IF
00209 *
00210 *     Compute the 1-norm of A or A'.
00211 *
00212       IF( LSAME( TRANS, 'N' ) ) THEN
00213          ANORM = ZLANTB( '1', UPLO, DIAG, N, KD, AB, LDAB, RWORK )
00214       ELSE
00215          ANORM = ZLANTB( 'I', UPLO, DIAG, N, KD, AB, LDAB, RWORK )
00216       END IF
00217 *
00218 *     Exit with RESID = 1/EPS if ANORM = 0.
00219 *
00220       EPS = DLAMCH( 'Epsilon' )
00221       IF( ANORM.LE.ZERO ) THEN
00222          RESID = ONE / EPS
00223          RETURN
00224       END IF
00225 *
00226 *     Compute the maximum over the number of right hand sides of
00227 *        norm(op(A)*x - b) / ( norm(op(A)) * norm(x) * EPS ).
00228 *
00229       RESID = ZERO
00230       DO 10 J = 1, NRHS
00231          CALL ZCOPY( N, X( 1, J ), 1, WORK, 1 )
00232          CALL ZTBMV( UPLO, TRANS, DIAG, N, KD, AB, LDAB, WORK, 1 )
00233          CALL ZAXPY( N, DCMPLX( -ONE ), B( 1, J ), 1, WORK, 1 )
00234          BNORM = DZASUM( N, WORK, 1 )
00235          XNORM = DZASUM( N, X( 1, J ), 1 )
00236          IF( XNORM.LE.ZERO ) THEN
00237             RESID = ONE / EPS
00238          ELSE
00239             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00240          END IF
00241    10 CONTINUE
00242 *
00243       RETURN
00244 *
00245 *     End of ZTBT02
00246 *
00247       END
 All Files Functions