![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DPOT02 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 DPOT02( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, 00012 * 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 *> DPOT02 computes the residual for the solution of a symmetric system 00031 *> of linear equations A*x = b: 00032 *> 00033 *> RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS ), 00034 *> 00035 *> where EPS is the machine epsilon. 00036 *> \endverbatim 00037 * 00038 * Arguments: 00039 * ========== 00040 * 00041 *> \param[in] UPLO 00042 *> \verbatim 00043 *> UPLO is CHARACTER*1 00044 *> Specifies whether the upper or lower triangular part of the 00045 *> symmetric matrix A is stored: 00046 *> = 'U': Upper triangular 00047 *> = 'L': Lower triangular 00048 *> \endverbatim 00049 *> 00050 *> \param[in] N 00051 *> \verbatim 00052 *> N is INTEGER 00053 *> The number of rows and columns of the matrix A. N >= 0. 00054 *> \endverbatim 00055 *> 00056 *> \param[in] NRHS 00057 *> \verbatim 00058 *> NRHS is INTEGER 00059 *> The number of columns of B, the matrix of right hand sides. 00060 *> NRHS >= 0. 00061 *> \endverbatim 00062 *> 00063 *> \param[in] A 00064 *> \verbatim 00065 *> A is DOUBLE PRECISION array, dimension (LDA,N) 00066 *> The original symmetric matrix A. 00067 *> \endverbatim 00068 *> 00069 *> \param[in] LDA 00070 *> \verbatim 00071 *> LDA is INTEGER 00072 *> The leading dimension of the array A. LDA >= max(1,N) 00073 *> \endverbatim 00074 *> 00075 *> \param[in] X 00076 *> \verbatim 00077 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS) 00078 *> The computed solution vectors for the system of linear 00079 *> equations. 00080 *> \endverbatim 00081 *> 00082 *> \param[in] LDX 00083 *> \verbatim 00084 *> LDX is INTEGER 00085 *> The leading dimension of the array X. LDX >= max(1,N). 00086 *> \endverbatim 00087 *> 00088 *> \param[in,out] B 00089 *> \verbatim 00090 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS) 00091 *> On entry, the right hand side vectors for the system of 00092 *> linear equations. 00093 *> On exit, B is overwritten with the difference B - A*X. 00094 *> \endverbatim 00095 *> 00096 *> \param[in] LDB 00097 *> \verbatim 00098 *> LDB is INTEGER 00099 *> The leading dimension of the array B. 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 DPOT02( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, 00128 $ 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 00149 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00150 * .. 00151 * .. Local Scalars .. 00152 INTEGER J 00153 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM 00154 * .. 00155 * .. External Functions .. 00156 DOUBLE PRECISION DASUM, DLAMCH, DLANSY 00157 EXTERNAL DASUM, DLAMCH, DLANSY 00158 * .. 00159 * .. External Subroutines .. 00160 EXTERNAL DSYMM 00161 * .. 00162 * .. Intrinsic Functions .. 00163 INTRINSIC MAX 00164 * .. 00165 * .. Executable Statements .. 00166 * 00167 * Quick exit if N = 0 or NRHS = 0. 00168 * 00169 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 00170 RESID = ZERO 00171 RETURN 00172 END IF 00173 * 00174 * Exit with RESID = 1/EPS if ANORM = 0. 00175 * 00176 EPS = DLAMCH( 'Epsilon' ) 00177 ANORM = DLANSY( '1', UPLO, N, A, LDA, RWORK ) 00178 IF( ANORM.LE.ZERO ) THEN 00179 RESID = ONE / EPS 00180 RETURN 00181 END IF 00182 * 00183 * Compute B - A*X 00184 * 00185 CALL DSYMM( 'Left', UPLO, N, NRHS, -ONE, A, LDA, X, LDX, ONE, B, 00186 $ LDB ) 00187 * 00188 * Compute the maximum over the number of right hand sides of 00189 * norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) . 00190 * 00191 RESID = ZERO 00192 DO 10 J = 1, NRHS 00193 BNORM = DASUM( N, B( 1, J ), 1 ) 00194 XNORM = DASUM( N, X( 1, J ), 1 ) 00195 IF( XNORM.LE.ZERO ) THEN 00196 RESID = ONE / EPS 00197 ELSE 00198 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS ) 00199 END IF 00200 10 CONTINUE 00201 * 00202 RETURN 00203 * 00204 * End of DPOT02 00205 * 00206 END