LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
zlanhb.f
Go to the documentation of this file.
1 *> \brief \b ZLANHB
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 *> \date November 2011
128 *
129 *> \ingroup complex16OTHERauxiliary
130 *
131 * =====================================================================
132  DOUBLE PRECISION FUNCTION zlanhb( NORM, UPLO, N, K, AB, LDAB,
133  $ work )
134 *
135 * -- LAPACK auxiliary routine (version 3.4.0) --
136 * -- LAPACK is a software package provided by Univ. of Tennessee, --
137 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138 * November 2011
139 *
140 * .. Scalar Arguments ..
141  CHARACTER norm, uplo
142  INTEGER k, ldab, n
143 * ..
144 * .. Array Arguments ..
145  DOUBLE PRECISION work( * )
146  COMPLEX*16 ab( ldab, * )
147 * ..
148 *
149 * =====================================================================
150 *
151 * .. Parameters ..
152  DOUBLE PRECISION one, zero
153  parameter( one = 1.0d+0, zero = 0.0d+0 )
154 * ..
155 * .. Local Scalars ..
156  INTEGER i, j, l
157  DOUBLE PRECISION absa, scale, sum, value
158 * ..
159 * .. External Functions ..
160  LOGICAL lsame
161  EXTERNAL lsame
162 * ..
163 * .. External Subroutines ..
164  EXTERNAL zlassq
165 * ..
166 * .. Intrinsic Functions ..
167  INTRINSIC abs, dble, max, min, sqrt
168 * ..
169 * .. Executable Statements ..
170 *
171  IF( n.EQ.0 ) THEN
172  value = zero
173  ELSE IF( lsame( norm, 'M' ) ) THEN
174 *
175 * Find max(abs(A(i,j))).
176 *
177  value = zero
178  IF( lsame( uplo, 'U' ) ) THEN
179  DO 20 j = 1, n
180  DO 10 i = max( k+2-j, 1 ), k
181  value = max( value, abs( ab( i, j ) ) )
182  10 CONTINUE
183  value = max( value, abs( dble( ab( k+1, j ) ) ) )
184  20 CONTINUE
185  ELSE
186  DO 40 j = 1, n
187  value = max( value, abs( dble( ab( 1, j ) ) ) )
188  DO 30 i = 2, min( n+1-j, k+1 )
189  value = max( value, abs( ab( i, j ) ) )
190  30 CONTINUE
191  40 CONTINUE
192  END IF
193  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
194  $ ( norm.EQ.'1' ) ) THEN
195 *
196 * Find normI(A) ( = norm1(A), since A is hermitian).
197 *
198  value = zero
199  IF( lsame( uplo, 'U' ) ) THEN
200  DO 60 j = 1, n
201  sum = zero
202  l = k + 1 - j
203  DO 50 i = max( 1, j-k ), j - 1
204  absa = abs( ab( l+i, j ) )
205  sum = sum + absa
206  work( i ) = work( i ) + absa
207  50 CONTINUE
208  work( j ) = sum + abs( dble( ab( k+1, j ) ) )
209  60 CONTINUE
210  DO 70 i = 1, n
211  value = max( value, work( i ) )
212  70 CONTINUE
213  ELSE
214  DO 80 i = 1, n
215  work( i ) = zero
216  80 CONTINUE
217  DO 100 j = 1, n
218  sum = work( j ) + abs( dble( ab( 1, j ) ) )
219  l = 1 - j
220  DO 90 i = j + 1, min( n, j+k )
221  absa = abs( ab( l+i, j ) )
222  sum = sum + absa
223  work( i ) = work( i ) + absa
224  90 CONTINUE
225  value = max( value, sum )
226  100 CONTINUE
227  END IF
228  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
229 *
230 * Find normF(A).
231 *
232  scale = zero
233  sum = one
234  IF( k.GT.0 ) THEN
235  IF( lsame( uplo, 'U' ) ) THEN
236  DO 110 j = 2, n
237  CALL zlassq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
238  $ 1, scale, sum )
239  110 CONTINUE
240  l = k + 1
241  ELSE
242  DO 120 j = 1, n - 1
243  CALL zlassq( min( n-j, k ), ab( 2, j ), 1, scale,
244  $ sum )
245  120 CONTINUE
246  l = 1
247  END IF
248  sum = 2*sum
249  ELSE
250  l = 1
251  END IF
252  DO 130 j = 1, n
253  IF( dble( ab( l, j ) ).NE.zero ) THEN
254  absa = abs( dble( ab( l, j ) ) )
255  IF( scale.LT.absa ) THEN
256  sum = one + sum*( scale / absa )**2
257  scale = absa
258  ELSE
259  sum = sum + ( absa / scale )**2
260  END IF
261  END IF
262  130 CONTINUE
263  value = scale*sqrt( sum )
264  END IF
265 *
266  zlanhb = value
267  RETURN
268 *
269 * End of ZLANHB
270 *
271  END