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.

zlanhb.f 8.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. *> \brief \b ZLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a Hermitian band matrix.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download ZLANHB + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhb.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhb.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhb.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * DOUBLE PRECISION FUNCTION ZLANHB( NORM, UPLO, N, K, AB, LDAB,
  22. * WORK )
  23. *
  24. * .. Scalar Arguments ..
  25. * CHARACTER NORM, UPLO
  26. * INTEGER K, LDAB, N
  27. * ..
  28. * .. Array Arguments ..
  29. * DOUBLE PRECISION WORK( * )
  30. * COMPLEX*16 AB( LDAB, * )
  31. * ..
  32. *
  33. *
  34. *> \par Purpose:
  35. * =============
  36. *>
  37. *> \verbatim
  38. *>
  39. *> ZLANHB returns the value of the one norm, or the Frobenius norm, or
  40. *> the infinity norm, or the element of largest absolute value of an
  41. *> n by n hermitian band matrix A, with k super-diagonals.
  42. *> \endverbatim
  43. *>
  44. *> \return ZLANHB
  45. *> \verbatim
  46. *>
  47. *> ZLANHB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
  48. *> (
  49. *> ( norm1(A), NORM = '1', 'O' or 'o'
  50. *> (
  51. *> ( normI(A), NORM = 'I' or 'i'
  52. *> (
  53. *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
  54. *>
  55. *> where norm1 denotes the one norm of a matrix (maximum column sum),
  56. *> normI denotes the infinity norm of a matrix (maximum row sum) and
  57. *> normF denotes the Frobenius norm of a matrix (square root of sum of
  58. *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
  59. *> \endverbatim
  60. *
  61. * Arguments:
  62. * ==========
  63. *
  64. *> \param[in] NORM
  65. *> \verbatim
  66. *> NORM is CHARACTER*1
  67. *> Specifies the value to be returned in ZLANHB as described
  68. *> above.
  69. *> \endverbatim
  70. *>
  71. *> \param[in] UPLO
  72. *> \verbatim
  73. *> UPLO is CHARACTER*1
  74. *> Specifies whether the upper or lower triangular part of the
  75. *> band matrix A is supplied.
  76. *> = 'U': Upper triangular
  77. *> = 'L': Lower triangular
  78. *> \endverbatim
  79. *>
  80. *> \param[in] N
  81. *> \verbatim
  82. *> N is INTEGER
  83. *> The order of the matrix A. N >= 0. When N = 0, ZLANHB is
  84. *> set to zero.
  85. *> \endverbatim
  86. *>
  87. *> \param[in] K
  88. *> \verbatim
  89. *> K is INTEGER
  90. *> The number of super-diagonals or sub-diagonals of the
  91. *> band matrix A. K >= 0.
  92. *> \endverbatim
  93. *>
  94. *> \param[in] AB
  95. *> \verbatim
  96. *> AB is COMPLEX*16 array, dimension (LDAB,N)
  97. *> The upper or lower triangle of the hermitian band matrix A,
  98. *> stored in the first K+1 rows of AB. The j-th column of A is
  99. *> stored in the j-th column of the array AB as follows:
  100. *> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
  101. *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
  102. *> Note that the imaginary parts of the diagonal elements need
  103. *> not be set and are assumed to be zero.
  104. *> \endverbatim
  105. *>
  106. *> \param[in] LDAB
  107. *> \verbatim
  108. *> LDAB is INTEGER
  109. *> The leading dimension of the array AB. LDAB >= K+1.
  110. *> \endverbatim
  111. *>
  112. *> \param[out] WORK
  113. *> \verbatim
  114. *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
  115. *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
  116. *> WORK is not referenced.
  117. *> \endverbatim
  118. *
  119. * Authors:
  120. * ========
  121. *
  122. *> \author Univ. of Tennessee
  123. *> \author Univ. of California Berkeley
  124. *> \author Univ. of Colorado Denver
  125. *> \author NAG Ltd.
  126. *
  127. *> \ingroup complex16OTHERauxiliary
  128. *
  129. * =====================================================================
  130. DOUBLE PRECISION FUNCTION ZLANHB( NORM, UPLO, N, K, AB, LDAB,
  131. $ WORK )
  132. *
  133. * -- LAPACK auxiliary routine --
  134. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  135. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  136. *
  137. * .. Scalar Arguments ..
  138. CHARACTER NORM, UPLO
  139. INTEGER K, LDAB, N
  140. * ..
  141. * .. Array Arguments ..
  142. DOUBLE PRECISION WORK( * )
  143. COMPLEX*16 AB( LDAB, * )
  144. * ..
  145. *
  146. * =====================================================================
  147. *
  148. * .. Parameters ..
  149. DOUBLE PRECISION ONE, ZERO
  150. PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
  151. * ..
  152. * .. Local Scalars ..
  153. INTEGER I, J, L
  154. DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
  155. * ..
  156. * .. External Functions ..
  157. LOGICAL LSAME, DISNAN
  158. EXTERNAL LSAME, DISNAN
  159. * ..
  160. * .. External Subroutines ..
  161. EXTERNAL ZLASSQ
  162. * ..
  163. * .. Intrinsic Functions ..
  164. INTRINSIC ABS, DBLE, MAX, MIN, SQRT
  165. * ..
  166. * .. Executable Statements ..
  167. *
  168. IF( N.EQ.0 ) THEN
  169. VALUE = ZERO
  170. ELSE IF( LSAME( NORM, 'M' ) ) THEN
  171. *
  172. * Find max(abs(A(i,j))).
  173. *
  174. VALUE = ZERO
  175. IF( LSAME( UPLO, 'U' ) ) THEN
  176. DO 20 J = 1, N
  177. DO 10 I = MAX( K+2-J, 1 ), K
  178. SUM = ABS( AB( I, J ) )
  179. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  180. 10 CONTINUE
  181. SUM = ABS( DBLE( AB( K+1, J ) ) )
  182. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  183. 20 CONTINUE
  184. ELSE
  185. DO 40 J = 1, N
  186. SUM = ABS( DBLE( AB( 1, J ) ) )
  187. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  188. DO 30 I = 2, MIN( N+1-J, K+1 )
  189. SUM = ABS( AB( I, J ) )
  190. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  191. 30 CONTINUE
  192. 40 CONTINUE
  193. END IF
  194. ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
  195. $ ( NORM.EQ.'1' ) ) THEN
  196. *
  197. * Find normI(A) ( = norm1(A), since A is hermitian).
  198. *
  199. VALUE = ZERO
  200. IF( LSAME( UPLO, 'U' ) ) THEN
  201. DO 60 J = 1, N
  202. SUM = ZERO
  203. L = K + 1 - J
  204. DO 50 I = MAX( 1, J-K ), J - 1
  205. ABSA = ABS( AB( L+I, J ) )
  206. SUM = SUM + ABSA
  207. WORK( I ) = WORK( I ) + ABSA
  208. 50 CONTINUE
  209. WORK( J ) = SUM + ABS( DBLE( AB( K+1, J ) ) )
  210. 60 CONTINUE
  211. DO 70 I = 1, N
  212. SUM = WORK( I )
  213. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  214. 70 CONTINUE
  215. ELSE
  216. DO 80 I = 1, N
  217. WORK( I ) = ZERO
  218. 80 CONTINUE
  219. DO 100 J = 1, N
  220. SUM = WORK( J ) + ABS( DBLE( AB( 1, J ) ) )
  221. L = 1 - J
  222. DO 90 I = J + 1, MIN( N, J+K )
  223. ABSA = ABS( AB( L+I, J ) )
  224. SUM = SUM + ABSA
  225. WORK( I ) = WORK( I ) + ABSA
  226. 90 CONTINUE
  227. IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  228. 100 CONTINUE
  229. END IF
  230. ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
  231. *
  232. * Find normF(A).
  233. *
  234. SCALE = ZERO
  235. SUM = ONE
  236. IF( K.GT.0 ) THEN
  237. IF( LSAME( UPLO, 'U' ) ) THEN
  238. DO 110 J = 2, N
  239. CALL ZLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
  240. $ 1, SCALE, SUM )
  241. 110 CONTINUE
  242. L = K + 1
  243. ELSE
  244. DO 120 J = 1, N - 1
  245. CALL ZLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
  246. $ SUM )
  247. 120 CONTINUE
  248. L = 1
  249. END IF
  250. SUM = 2*SUM
  251. ELSE
  252. L = 1
  253. END IF
  254. DO 130 J = 1, N
  255. IF( DBLE( AB( L, J ) ).NE.ZERO ) THEN
  256. ABSA = ABS( DBLE( AB( L, J ) ) )
  257. IF( SCALE.LT.ABSA ) THEN
  258. SUM = ONE + SUM*( SCALE / ABSA )**2
  259. SCALE = ABSA
  260. ELSE
  261. SUM = SUM + ( ABSA / SCALE )**2
  262. END IF
  263. END IF
  264. 130 CONTINUE
  265. VALUE = SCALE*SQRT( SUM )
  266. END IF
  267. *
  268. ZLANHB = VALUE
  269. RETURN
  270. *
  271. * End of ZLANHB
  272. *
  273. END