You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dpot06.f 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. *> \brief \b DPOT06
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * SUBROUTINE DPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
  12. * RWORK, RESID )
  13. *
  14. * .. Scalar Arguments ..
  15. * CHARACTER UPLO
  16. * INTEGER LDA, LDB, LDX, N, NRHS
  17. * DOUBLE PRECISION RESID
  18. * ..
  19. * .. Array Arguments ..
  20. * DOUBLE PRECISION A( LDA, * ), B( LDB, * ), RWORK( * ),
  21. * $ X( LDX, * )
  22. * ..
  23. *
  24. *
  25. *> \par Purpose:
  26. * =============
  27. *>
  28. *> \verbatim
  29. *>
  30. *> DPOT06 computes the residual for a solution of a system of linear
  31. *> equations A*x = b :
  32. *> RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ),
  33. *> where EPS is the machine epsilon.
  34. *> \endverbatim
  35. *
  36. * Arguments:
  37. * ==========
  38. *
  39. *> \param[in] UPLO
  40. *> \verbatim
  41. *> UPLO is CHARACTER*1
  42. *> Specifies whether the upper or lower triangular part of the
  43. *> symmetric matrix A is stored:
  44. *> = 'U': Upper triangular
  45. *> = 'L': Lower triangular
  46. *> \endverbatim
  47. *>
  48. *> \param[in] N
  49. *> \verbatim
  50. *> N is INTEGER
  51. *> The number of rows and columns of the matrix A. N >= 0.
  52. *> \endverbatim
  53. *>
  54. *> \param[in] NRHS
  55. *> \verbatim
  56. *> NRHS is INTEGER
  57. *> The number of columns of B, the matrix of right hand sides.
  58. *> NRHS >= 0.
  59. *> \endverbatim
  60. *>
  61. *> \param[in] A
  62. *> \verbatim
  63. *> A is DOUBLE PRECISION array, dimension (LDA,N)
  64. *> The original M x N matrix A.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] LDA
  68. *> \verbatim
  69. *> LDA is INTEGER
  70. *> The leading dimension of the array A. LDA >= max(1,N).
  71. *> \endverbatim
  72. *>
  73. *> \param[in] X
  74. *> \verbatim
  75. *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
  76. *> The computed solution vectors for the system of linear
  77. *> equations.
  78. *> \endverbatim
  79. *>
  80. *> \param[in] LDX
  81. *> \verbatim
  82. *> LDX is INTEGER
  83. *> The leading dimension of the array X. If TRANS = 'N',
  84. *> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N).
  85. *> \endverbatim
  86. *>
  87. *> \param[in,out] B
  88. *> \verbatim
  89. *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
  90. *> On entry, the right hand side vectors for the system of
  91. *> linear equations.
  92. *> On exit, B is overwritten with the difference B - A*X.
  93. *> \endverbatim
  94. *>
  95. *> \param[in] LDB
  96. *> \verbatim
  97. *> LDB is INTEGER
  98. *> The leading dimension of the array B. IF TRANS = 'N',
  99. *> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
  100. *> \endverbatim
  101. *>
  102. *> \param[out] RWORK
  103. *> \verbatim
  104. *> RWORK is DOUBLE PRECISION array, dimension (N)
  105. *> \endverbatim
  106. *>
  107. *> \param[out] RESID
  108. *> \verbatim
  109. *> RESID is DOUBLE PRECISION
  110. *> The maximum over the number of right hand sides of
  111. *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
  112. *> \endverbatim
  113. *
  114. * Authors:
  115. * ========
  116. *
  117. *> \author Univ. of Tennessee
  118. *> \author Univ. of California Berkeley
  119. *> \author Univ. of Colorado Denver
  120. *> \author NAG Ltd.
  121. *
  122. *> \ingroup double_lin
  123. *
  124. * =====================================================================
  125. SUBROUTINE DPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
  126. $ RWORK, RESID )
  127. *
  128. * -- LAPACK test routine --
  129. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  130. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  131. *
  132. * .. Scalar Arguments ..
  133. CHARACTER UPLO
  134. INTEGER LDA, LDB, LDX, N, NRHS
  135. DOUBLE PRECISION RESID
  136. * ..
  137. * .. Array Arguments ..
  138. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), RWORK( * ),
  139. $ X( LDX, * )
  140. * ..
  141. *
  142. * =====================================================================
  143. *
  144. * .. Parameters ..
  145. DOUBLE PRECISION ZERO, ONE, NEGONE
  146. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  147. PARAMETER ( NEGONE = -1.0D+0 )
  148. * ..
  149. * .. Local Scalars ..
  150. INTEGER IFAIL, J
  151. DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
  152. * ..
  153. * .. External Functions ..
  154. INTEGER IDAMAX
  155. DOUBLE PRECISION DLAMCH, DLANSY
  156. EXTERNAL IDAMAX, DLAMCH, DLANSY
  157. * ..
  158. * .. External Subroutines ..
  159. EXTERNAL DSYMM
  160. * ..
  161. * .. Intrinsic Functions ..
  162. INTRINSIC MAX, ABS
  163. * ..
  164. * .. Executable Statements ..
  165. *
  166. * Quick exit if N = 0 or NRHS = 0
  167. *
  168. IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
  169. RESID = ZERO
  170. RETURN
  171. END IF
  172. *
  173. * Exit with RESID = 1/EPS if ANORM = 0.
  174. *
  175. EPS = DLAMCH( 'Epsilon' )
  176. ANORM = DLANSY( 'I', UPLO, N, A, LDA, RWORK )
  177. IF( ANORM.LE.ZERO ) THEN
  178. RESID = ONE / EPS
  179. RETURN
  180. END IF
  181. *
  182. * Compute B - A*X and store in B.
  183. IFAIL=0
  184. *
  185. CALL DSYMM( 'Left', UPLO, N, NRHS, NEGONE, A, LDA, X,
  186. $ LDX, ONE, B, LDB )
  187. *
  188. * Compute the maximum over the number of right hand sides of
  189. * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
  190. *
  191. RESID = ZERO
  192. DO 10 J = 1, NRHS
  193. BNORM = ABS(B(IDAMAX( N, B( 1, J ), 1 ),J))
  194. XNORM = ABS(X(IDAMAX( N, X( 1, J ), 1 ),J))
  195. IF( XNORM.LE.ZERO ) THEN
  196. RESID = ONE / EPS
  197. ELSE
  198. RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
  199. END IF
  200. 10 CONTINUE
  201. *
  202. RETURN
  203. *
  204. * End of DPOT06
  205. *
  206. END