![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DPOT06 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 DPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, 00012 * RWORK, RESID ) 00013 * 00014 * .. Scalar Arguments .. 00015 * CHARACTER UPLO 00016 * INTEGER 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 *> DPOT06 computes the residual for a solution of a system of linear 00031 *> equations A*x = b : 00032 *> RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ), 00033 *> where EPS is the machine epsilon. 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] NRHS 00055 *> \verbatim 00056 *> NRHS is INTEGER 00057 *> The number of columns of B, the matrix of right hand sides. 00058 *> NRHS >= 0. 00059 *> \endverbatim 00060 *> 00061 *> \param[in] A 00062 *> \verbatim 00063 *> A is DOUBLE PRECISION array, dimension (LDA,N) 00064 *> The original M x N matrix A. 00065 *> \endverbatim 00066 *> 00067 *> \param[in] LDA 00068 *> \verbatim 00069 *> LDA is INTEGER 00070 *> The leading dimension of the array A. LDA >= max(1,N). 00071 *> \endverbatim 00072 *> 00073 *> \param[in] X 00074 *> \verbatim 00075 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS) 00076 *> The computed solution vectors for the system of linear 00077 *> equations. 00078 *> \endverbatim 00079 *> 00080 *> \param[in] LDX 00081 *> \verbatim 00082 *> LDX is INTEGER 00083 *> The leading dimension of the array X. If TRANS = 'N', 00084 *> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N). 00085 *> \endverbatim 00086 *> 00087 *> \param[in,out] B 00088 *> \verbatim 00089 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS) 00090 *> On entry, the right hand side vectors for the system of 00091 *> linear equations. 00092 *> On exit, B is overwritten with the difference B - A*X. 00093 *> \endverbatim 00094 *> 00095 *> \param[in] LDB 00096 *> \verbatim 00097 *> LDB is INTEGER 00098 *> The leading dimension of the array B. IF TRANS = 'N', 00099 *> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N). 00100 *> \endverbatim 00101 *> 00102 *> \param[out] RWORK 00103 *> \verbatim 00104 *> RWORK is DOUBLE PRECISION array, dimension (N) 00105 *> \endverbatim 00106 *> 00107 *> \param[out] RESID 00108 *> \verbatim 00109 *> RESID is DOUBLE PRECISION 00110 *> The maximum over the number of right hand sides of 00111 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ). 00112 *> \endverbatim 00113 * 00114 * Authors: 00115 * ======== 00116 * 00117 *> \author Univ. of Tennessee 00118 *> \author Univ. of California Berkeley 00119 *> \author Univ. of Colorado Denver 00120 *> \author NAG Ltd. 00121 * 00122 *> \date November 2011 00123 * 00124 *> \ingroup double_lin 00125 * 00126 * ===================================================================== 00127 SUBROUTINE DPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, 00128 $ RWORK, RESID ) 00129 * 00130 * -- LAPACK test routine (version 3.4.0) -- 00131 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00133 * November 2011 00134 * 00135 * .. Scalar Arguments .. 00136 CHARACTER UPLO 00137 INTEGER LDA, LDB, LDX, N, NRHS 00138 DOUBLE PRECISION RESID 00139 * .. 00140 * .. Array Arguments .. 00141 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), RWORK( * ), 00142 $ X( LDX, * ) 00143 * .. 00144 * 00145 * ===================================================================== 00146 * 00147 * .. Parameters .. 00148 DOUBLE PRECISION ZERO, ONE, NEGONE 00149 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00150 PARAMETER ( NEGONE = -1.0D+0 ) 00151 * .. 00152 * .. Local Scalars .. 00153 INTEGER IFAIL, J 00154 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM 00155 * .. 00156 * .. External Functions .. 00157 INTEGER IDAMAX 00158 DOUBLE PRECISION DLAMCH, DLANSY 00159 EXTERNAL IDAMAX, DLAMCH, DLANSY 00160 * .. 00161 * .. External Subroutines .. 00162 EXTERNAL DSYMM 00163 * .. 00164 * .. Intrinsic Functions .. 00165 INTRINSIC MAX, ABS 00166 * .. 00167 * .. Executable Statements .. 00168 * 00169 * Quick exit if N = 0 or NRHS = 0 00170 * 00171 IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN 00172 RESID = ZERO 00173 RETURN 00174 END IF 00175 * 00176 * Exit with RESID = 1/EPS if ANORM = 0. 00177 * 00178 EPS = DLAMCH( 'Epsilon' ) 00179 ANORM = DLANSY( 'I', UPLO, N, A, LDA, RWORK ) 00180 IF( ANORM.LE.ZERO ) THEN 00181 RESID = ONE / EPS 00182 RETURN 00183 END IF 00184 * 00185 * Compute B - A*X and store in B. 00186 IFAIL=0 00187 * 00188 CALL DSYMM( 'Left', UPLO, N, NRHS, NEGONE, A, LDA, X, 00189 $ LDX, ONE, B, LDB ) 00190 * 00191 * Compute the maximum over the number of right hand sides of 00192 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) . 00193 * 00194 RESID = ZERO 00195 DO 10 J = 1, NRHS 00196 BNORM = ABS(B(IDAMAX( N, B( 1, J ), 1 ),J)) 00197 XNORM = ABS(X(IDAMAX( N, X( 1, J ), 1 ),J)) 00198 IF( XNORM.LE.ZERO ) THEN 00199 RESID = ONE / EPS 00200 ELSE 00201 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS ) 00202 END IF 00203 10 CONTINUE 00204 * 00205 RETURN 00206 * 00207 * End of DPOT06 00208 * 00209 END