LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dpbt02.f
Go to the documentation of this file.
00001 *> \brief \b DPBT02
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 DPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB,
00012 *                          RWORK, RESID )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER          UPLO
00016 *       INTEGER            KD, LDA, LDB, LDX, N, NRHS
00017 *       DOUBLE PRECISION   RESID
00018 *       ..
00019 *       .. Array Arguments ..
00020 *       DOUBLE PRECISION   A( LDA, * ), B( LDB, * ), RWORK( * ),
00021 *      $                   X( LDX, * )
00022 *       ..
00023 *  
00024 *
00025 *> \par Purpose:
00026 *  =============
00027 *>
00028 *> \verbatim
00029 *>
00030 *> DPBT02 computes the residual for a solution of a symmetric banded
00031 *> system of equations  A*x = b:
00032 *>    RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS)
00033 *> where EPS is the machine precision.
00034 *> \endverbatim
00035 *
00036 *  Arguments:
00037 *  ==========
00038 *
00039 *> \param[in] UPLO
00040 *> \verbatim
00041 *>          UPLO is CHARACTER*1
00042 *>          Specifies whether the upper or lower triangular part of the
00043 *>          symmetric matrix A is stored:
00044 *>          = 'U':  Upper triangular
00045 *>          = 'L':  Lower triangular
00046 *> \endverbatim
00047 *>
00048 *> \param[in] N
00049 *> \verbatim
00050 *>          N is INTEGER
00051 *>          The number of rows and columns of the matrix A.  N >= 0.
00052 *> \endverbatim
00053 *>
00054 *> \param[in] KD
00055 *> \verbatim
00056 *>          KD is INTEGER
00057 *>          The number of super-diagonals of the matrix A if UPLO = 'U',
00058 *>          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0.
00059 *> \endverbatim
00060 *>
00061 *> \param[in] NRHS
00062 *> \verbatim
00063 *>          NRHS is INTEGER
00064 *>          The number of right hand sides. NRHS >= 0.
00065 *> \endverbatim
00066 *>
00067 *> \param[in] A
00068 *> \verbatim
00069 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00070 *>          The original symmetric band matrix A.  If UPLO = 'U', the
00071 *>          upper triangular part of A is stored as a band matrix; if
00072 *>          UPLO = 'L', the lower triangular part of A is stored.  The
00073 *>          columns of the appropriate triangle are stored in the columns
00074 *>          of A and the diagonals of the triangle are stored in the rows
00075 *>          of A.  See DPBTRF for further details.
00076 *> \endverbatim
00077 *>
00078 *> \param[in] LDA
00079 *> \verbatim
00080 *>          LDA is INTEGER.
00081 *>          The leading dimension of the array A.  LDA >= max(1,KD+1).
00082 *> \endverbatim
00083 *>
00084 *> \param[in] X
00085 *> \verbatim
00086 *>          X is DOUBLE PRECISION array, dimension (LDX,NRHS)
00087 *>          The computed solution vectors for the system of linear
00088 *>          equations.
00089 *> \endverbatim
00090 *>
00091 *> \param[in] LDX
00092 *> \verbatim
00093 *>          LDX is INTEGER
00094 *>          The leading dimension of the array X.   LDX >= max(1,N).
00095 *> \endverbatim
00096 *>
00097 *> \param[in,out] B
00098 *> \verbatim
00099 *>          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
00100 *>          On entry, the right hand side vectors for the system of
00101 *>          linear equations.
00102 *>          On exit, B is overwritten with the difference B - A*X.
00103 *> \endverbatim
00104 *>
00105 *> \param[in] LDB
00106 *> \verbatim
00107 *>          LDB is INTEGER
00108 *>          The leading dimension of the array B.  LDB >= max(1,N).
00109 *> \endverbatim
00110 *>
00111 *> \param[out] RWORK
00112 *> \verbatim
00113 *>          RWORK is DOUBLE PRECISION array, dimension (N)
00114 *> \endverbatim
00115 *>
00116 *> \param[out] RESID
00117 *> \verbatim
00118 *>          RESID is DOUBLE PRECISION
00119 *>          The maximum over the number of right hand sides of
00120 *>          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
00121 *> \endverbatim
00122 *
00123 *  Authors:
00124 *  ========
00125 *
00126 *> \author Univ. of Tennessee 
00127 *> \author Univ. of California Berkeley 
00128 *> \author Univ. of Colorado Denver 
00129 *> \author NAG Ltd. 
00130 *
00131 *> \date November 2011
00132 *
00133 *> \ingroup double_lin
00134 *
00135 *  =====================================================================
00136       SUBROUTINE DPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB,
00137      $                   RWORK, RESID )
00138 *
00139 *  -- LAPACK test routine (version 3.4.0) --
00140 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00141 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00142 *     November 2011
00143 *
00144 *     .. Scalar Arguments ..
00145       CHARACTER          UPLO
00146       INTEGER            KD, LDA, LDB, LDX, N, NRHS
00147       DOUBLE PRECISION   RESID
00148 *     ..
00149 *     .. Array Arguments ..
00150       DOUBLE PRECISION   A( LDA, * ), B( LDB, * ), RWORK( * ),
00151      $                   X( LDX, * )
00152 *     ..
00153 *
00154 *  =====================================================================
00155 *
00156 *     .. Parameters ..
00157       DOUBLE PRECISION   ZERO, ONE
00158       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00159 *     ..
00160 *     .. Local Scalars ..
00161       INTEGER            J
00162       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00163 *     ..
00164 *     .. External Functions ..
00165       DOUBLE PRECISION   DASUM, DLAMCH, DLANSB
00166       EXTERNAL           DASUM, DLAMCH, DLANSB
00167 *     ..
00168 *     .. External Subroutines ..
00169       EXTERNAL           DSBMV
00170 *     ..
00171 *     .. Intrinsic Functions ..
00172       INTRINSIC          MAX
00173 *     ..
00174 *     .. Executable Statements ..
00175 *
00176 *     Quick exit if N = 0 or NRHS = 0.
00177 *
00178       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00179          RESID = ZERO
00180          RETURN
00181       END IF
00182 *
00183 *     Exit with RESID = 1/EPS if ANORM = 0.
00184 *
00185       EPS = DLAMCH( 'Epsilon' )
00186       ANORM = DLANSB( '1', UPLO, N, KD, A, LDA, RWORK )
00187       IF( ANORM.LE.ZERO ) THEN
00188          RESID = ONE / EPS
00189          RETURN
00190       END IF
00191 *
00192 *     Compute  B - A*X
00193 *
00194       DO 10 J = 1, NRHS
00195          CALL DSBMV( UPLO, N, KD, -ONE, A, LDA, X( 1, J ), 1, ONE,
00196      $               B( 1, J ), 1 )
00197    10 CONTINUE
00198 *
00199 *     Compute the maximum over the number of right hand sides of
00200 *          norm( B - A*X ) / ( norm(A) * norm(X) * EPS )
00201 *
00202       RESID = ZERO
00203       DO 20 J = 1, NRHS
00204          BNORM = DASUM( N, B( 1, J ), 1 )
00205          XNORM = DASUM( N, X( 1, J ), 1 )
00206          IF( XNORM.LE.ZERO ) THEN
00207             RESID = ONE / EPS
00208          ELSE
00209             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00210          END IF
00211    20 CONTINUE
00212 *
00213       RETURN
00214 *
00215 *     End of DPBT02
00216 *
00217       END
 All Files Functions