LAPACK 3.3.0

zpbt02.f

Go to the documentation of this file.
00001       SUBROUTINE ZPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB,
00002      $                   RWORK, RESID )
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, LDA, LDB, LDX, N, NRHS
00011       DOUBLE PRECISION   RESID
00012 *     ..
00013 *     .. Array Arguments ..
00014       DOUBLE PRECISION   RWORK( * )
00015       COMPLEX*16         A( LDA, * ), B( LDB, * ), X( LDX, * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  ZPBT02 computes the residual for a solution of a Hermitian banded
00022 *  system of equations  A*x = b:
00023 *     RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS)
00024 *  where EPS is the machine precision.
00025 *
00026 *  Arguments
00027 *  =========
00028 *
00029 *  UPLO    (input) CHARACTER*1
00030 *          Specifies whether the upper or lower triangular part of the
00031 *          Hermitian matrix A is stored:
00032 *          = 'U':  Upper triangular
00033 *          = 'L':  Lower triangular
00034 *
00035 *  N       (input) INTEGER
00036 *          The number of rows and columns of the matrix A.  N >= 0.
00037 *
00038 *  KD      (input) INTEGER
00039 *          The number of super-diagonals of the matrix A if UPLO = 'U',
00040 *          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0.
00041 *
00042 *  A       (input) COMPLEX*16 array, dimension (LDA,N)
00043 *          The original Hermitian band matrix A.  If UPLO = 'U', the
00044 *          upper triangular part of A is stored as a band matrix; if
00045 *          UPLO = 'L', the lower triangular part of A is stored.  The
00046 *          columns of the appropriate triangle are stored in the columns
00047 *          of A and the diagonals of the triangle are stored in the rows
00048 *          of A.  See ZPBTRF for further details.
00049 *
00050 *  LDA     (input) INTEGER.
00051 *          The leading dimension of the array A.  LDA >= max(1,KD+1).
00052 *
00053 *  X       (input) COMPLEX*16 array, dimension (LDX,NRHS)
00054 *          The computed solution vectors for the system of linear
00055 *          equations.
00056 *
00057 *  LDX     (input) INTEGER
00058 *          The leading dimension of the array X.   LDX >= max(1,N).
00059 *
00060 *  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
00061 *          On entry, the right hand side vectors for the system of
00062 *          linear equations.
00063 *          On exit, B is overwritten with the difference B - A*X.
00064 *
00065 *  LDB     (input) INTEGER
00066 *          The leading dimension of the array B.  LDB >= max(1,N).
00067 *
00068 *  RWORK   (workspace) DOUBLE PRECISION array, dimension (N)
00069 *
00070 *  RESID   (output) DOUBLE PRECISION
00071 *          The maximum over the number of right hand sides of
00072 *          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
00073 *
00074 *  =====================================================================
00075 *
00076 *     .. Parameters ..
00077       DOUBLE PRECISION   ZERO, ONE
00078       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00079       COMPLEX*16         CONE
00080       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
00081 *     ..
00082 *     .. Local Scalars ..
00083       INTEGER            J
00084       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00085 *     ..
00086 *     .. External Functions ..
00087       DOUBLE PRECISION   DLAMCH, DZASUM, ZLANHB
00088       EXTERNAL           DLAMCH, DZASUM, ZLANHB
00089 *     ..
00090 *     .. External Subroutines ..
00091       EXTERNAL           ZHBMV
00092 *     ..
00093 *     .. Intrinsic Functions ..
00094       INTRINSIC          MAX
00095 *     ..
00096 *     .. Executable Statements ..
00097 *
00098 *     Quick exit if N = 0 or NRHS = 0.
00099 *
00100       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00101          RESID = ZERO
00102          RETURN
00103       END IF
00104 *
00105 *     Exit with RESID = 1/EPS if ANORM = 0.
00106 *
00107       EPS = DLAMCH( 'Epsilon' )
00108       ANORM = ZLANHB( '1', UPLO, N, KD, A, LDA, RWORK )
00109       IF( ANORM.LE.ZERO ) THEN
00110          RESID = ONE / EPS
00111          RETURN
00112       END IF
00113 *
00114 *     Compute  B - A*X
00115 *
00116       DO 10 J = 1, NRHS
00117          CALL ZHBMV( UPLO, N, KD, -CONE, A, LDA, X( 1, J ), 1, CONE,
00118      $               B( 1, J ), 1 )
00119    10 CONTINUE
00120 *
00121 *     Compute the maximum over the number of right hand sides of
00122 *          norm( B - A*X ) / ( norm(A) * norm(X) * EPS )
00123 *
00124       RESID = ZERO
00125       DO 20 J = 1, NRHS
00126          BNORM = DZASUM( N, B( 1, J ), 1 )
00127          XNORM = DZASUM( N, X( 1, J ), 1 )
00128          IF( XNORM.LE.ZERO ) THEN
00129             RESID = ONE / EPS
00130          ELSE
00131             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00132          END IF
00133    20 CONTINUE
00134 *
00135       RETURN
00136 *
00137 *     End of ZPBT02
00138 *
00139       END
 All Files Functions