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.

sla_porpvgrw.f 6.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. *> \brief \b SLA_PORPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric or Hermitian positive-definite matrix.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download SLA_PORPVGRW + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sla_porpvgrw.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_porpvgrw.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_porpvgrw.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * REAL FUNCTION SLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF, LDAF, WORK )
  22. *
  23. * .. Scalar Arguments ..
  24. * CHARACTER*1 UPLO
  25. * INTEGER NCOLS, LDA, LDAF
  26. * ..
  27. * .. Array Arguments ..
  28. * REAL A( LDA, * ), AF( LDAF, * ), WORK( * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *>
  38. *> SLA_PORPVGRW computes the reciprocal pivot growth factor
  39. *> norm(A)/norm(U). The "max absolute element" norm is used. If this is
  40. *> much less than 1, the stability of the LU factorization of the
  41. *> (equilibrated) matrix A could be poor. This also means that the
  42. *> solution X, estimated condition numbers, and error bounds could be
  43. *> unreliable.
  44. *> \endverbatim
  45. *
  46. * Arguments:
  47. * ==========
  48. *
  49. *> \param[in] UPLO
  50. *> \verbatim
  51. *> UPLO is CHARACTER*1
  52. *> = 'U': Upper triangle of A is stored;
  53. *> = 'L': Lower triangle of A is stored.
  54. *> \endverbatim
  55. *>
  56. *> \param[in] NCOLS
  57. *> \verbatim
  58. *> NCOLS is INTEGER
  59. *> The number of columns of the matrix A. NCOLS >= 0.
  60. *> \endverbatim
  61. *>
  62. *> \param[in] A
  63. *> \verbatim
  64. *> A is REAL array, dimension (LDA,N)
  65. *> On entry, the N-by-N matrix A.
  66. *> \endverbatim
  67. *>
  68. *> \param[in] LDA
  69. *> \verbatim
  70. *> LDA is INTEGER
  71. *> The leading dimension of the array A. LDA >= max(1,N).
  72. *> \endverbatim
  73. *>
  74. *> \param[in] AF
  75. *> \verbatim
  76. *> AF is REAL array, dimension (LDAF,N)
  77. *> The triangular factor U or L from the Cholesky factorization
  78. *> A = U**T*U or A = L*L**T, as computed by SPOTRF.
  79. *> \endverbatim
  80. *>
  81. *> \param[in] LDAF
  82. *> \verbatim
  83. *> LDAF is INTEGER
  84. *> The leading dimension of the array AF. LDAF >= max(1,N).
  85. *> \endverbatim
  86. *>
  87. *> \param[in] WORK
  88. *> \verbatim
  89. *> WORK is REAL array, dimension (2*N)
  90. *> \endverbatim
  91. *
  92. * Authors:
  93. * ========
  94. *
  95. *> \author Univ. of Tennessee
  96. *> \author Univ. of California Berkeley
  97. *> \author Univ. of Colorado Denver
  98. *> \author NAG Ltd.
  99. *
  100. *> \date September 2012
  101. *
  102. *> \ingroup realPOcomputational
  103. *
  104. * =====================================================================
  105. REAL FUNCTION SLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF, LDAF, WORK )
  106. *
  107. * -- LAPACK computational routine (version 3.4.2) --
  108. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  109. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  110. * September 2012
  111. *
  112. * .. Scalar Arguments ..
  113. CHARACTER*1 UPLO
  114. INTEGER NCOLS, LDA, LDAF
  115. * ..
  116. * .. Array Arguments ..
  117. REAL A( LDA, * ), AF( LDAF, * ), WORK( * )
  118. * ..
  119. *
  120. * =====================================================================
  121. *
  122. * .. Local Scalars ..
  123. INTEGER I, J
  124. REAL AMAX, UMAX, RPVGRW
  125. LOGICAL UPPER
  126. * ..
  127. * .. Intrinsic Functions ..
  128. INTRINSIC ABS, MAX, MIN
  129. * ..
  130. * .. External Functions ..
  131. EXTERNAL LSAME, SLASET
  132. LOGICAL LSAME
  133. * ..
  134. * .. Executable Statements ..
  135. *
  136. UPPER = LSAME( 'Upper', UPLO )
  137. *
  138. * SPOTRF will have factored only the NCOLSxNCOLS leading minor, so
  139. * we restrict the growth search to that minor and use only the first
  140. * 2*NCOLS workspace entries.
  141. *
  142. RPVGRW = 1.0
  143. DO I = 1, 2*NCOLS
  144. WORK( I ) = 0.0
  145. END DO
  146. *
  147. * Find the max magnitude entry of each column.
  148. *
  149. IF ( UPPER ) THEN
  150. DO J = 1, NCOLS
  151. DO I = 1, J
  152. WORK( NCOLS+J ) =
  153. $ MAX( ABS( A( I, J ) ), WORK( NCOLS+J ) )
  154. END DO
  155. END DO
  156. ELSE
  157. DO J = 1, NCOLS
  158. DO I = J, NCOLS
  159. WORK( NCOLS+J ) =
  160. $ MAX( ABS( A( I, J ) ), WORK( NCOLS+J ) )
  161. END DO
  162. END DO
  163. END IF
  164. *
  165. * Now find the max magnitude entry of each column of the factor in
  166. * AF. No pivoting, so no permutations.
  167. *
  168. IF ( LSAME( 'Upper', UPLO ) ) THEN
  169. DO J = 1, NCOLS
  170. DO I = 1, J
  171. WORK( J ) = MAX( ABS( AF( I, J ) ), WORK( J ) )
  172. END DO
  173. END DO
  174. ELSE
  175. DO J = 1, NCOLS
  176. DO I = J, NCOLS
  177. WORK( J ) = MAX( ABS( AF( I, J ) ), WORK( J ) )
  178. END DO
  179. END DO
  180. END IF
  181. *
  182. * Compute the *inverse* of the max element growth factor. Dividing
  183. * by zero would imply the largest entry of the factor's column is
  184. * zero. Than can happen when either the column of A is zero or
  185. * massive pivots made the factor underflow to zero. Neither counts
  186. * as growth in itself, so simply ignore terms with zero
  187. * denominators.
  188. *
  189. IF ( LSAME( 'Upper', UPLO ) ) THEN
  190. DO I = 1, NCOLS
  191. UMAX = WORK( I )
  192. AMAX = WORK( NCOLS+I )
  193. IF ( UMAX /= 0.0 ) THEN
  194. RPVGRW = MIN( AMAX / UMAX, RPVGRW )
  195. END IF
  196. END DO
  197. ELSE
  198. DO I = 1, NCOLS
  199. UMAX = WORK( I )
  200. AMAX = WORK( NCOLS+I )
  201. IF ( UMAX /= 0.0 ) THEN
  202. RPVGRW = MIN( AMAX / UMAX, RPVGRW )
  203. END IF
  204. END DO
  205. END IF
  206. SLA_PORPVGRW = RPVGRW
  207. END