LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlantb.f
Go to the documentation of this file.
1*> \brief \b ZLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLANTB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlantb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlantb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlantb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLANTB( NORM, UPLO, DIAG, N, K, AB,
20* LDAB, WORK )
21*
22* .. Scalar Arguments ..
23* CHARACTER DIAG, NORM, UPLO
24* INTEGER K, LDAB, N
25* ..
26* .. Array Arguments ..
27* DOUBLE PRECISION WORK( * )
28* COMPLEX*16 AB( LDAB, * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> ZLANTB returns the value of the one norm, or the Frobenius norm, or
38*> the infinity norm, or the element of largest absolute value of an
39*> n by n triangular band matrix A, with ( k + 1 ) diagonals.
40*> \endverbatim
41*>
42*> \return ZLANTB
43*> \verbatim
44*>
45*> ZLANTB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
46*> (
47*> ( norm1(A), NORM = '1', 'O' or 'o'
48*> (
49*> ( normI(A), NORM = 'I' or 'i'
50*> (
51*> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
52*>
53*> where norm1 denotes the one norm of a matrix (maximum column sum),
54*> normI denotes the infinity norm of a matrix (maximum row sum) and
55*> normF denotes the Frobenius norm of a matrix (square root of sum of
56*> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
57*> \endverbatim
58*
59* Arguments:
60* ==========
61*
62*> \param[in] NORM
63*> \verbatim
64*> NORM is CHARACTER*1
65*> Specifies the value to be returned in ZLANTB as described
66*> above.
67*> \endverbatim
68*>
69*> \param[in] UPLO
70*> \verbatim
71*> UPLO is CHARACTER*1
72*> Specifies whether the matrix A is upper or lower triangular.
73*> = 'U': Upper triangular
74*> = 'L': Lower triangular
75*> \endverbatim
76*>
77*> \param[in] DIAG
78*> \verbatim
79*> DIAG is CHARACTER*1
80*> Specifies whether or not the matrix A is unit triangular.
81*> = 'N': Non-unit triangular
82*> = 'U': Unit triangular
83*> \endverbatim
84*>
85*> \param[in] N
86*> \verbatim
87*> N is INTEGER
88*> The order of the matrix A. N >= 0. When N = 0, ZLANTB is
89*> set to zero.
90*> \endverbatim
91*>
92*> \param[in] K
93*> \verbatim
94*> K is INTEGER
95*> The number of super-diagonals of the matrix A if UPLO = 'U',
96*> or the number of sub-diagonals of the matrix A if UPLO = 'L'.
97*> K >= 0.
98*> \endverbatim
99*>
100*> \param[in] AB
101*> \verbatim
102*> AB is COMPLEX*16 array, dimension (LDAB,N)
103*> The upper or lower triangular band matrix A, stored in the
104*> first k+1 rows of AB. The j-th column of A is stored
105*> in the j-th column of the array AB as follows:
106*> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
107*> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
108*> Note that when DIAG = 'U', the elements of the array AB
109*> corresponding to the diagonal elements of the matrix A are
110*> not referenced, but are assumed to be one.
111*> \endverbatim
112*>
113*> \param[in] LDAB
114*> \verbatim
115*> LDAB is INTEGER
116*> The leading dimension of the array AB. LDAB >= K+1.
117*> \endverbatim
118*>
119*> \param[out] WORK
120*> \verbatim
121*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
122*> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
123*> referenced.
124*> \endverbatim
125*
126* Authors:
127* ========
128*
129*> \author Univ. of Tennessee
130*> \author Univ. of California Berkeley
131*> \author Univ. of Colorado Denver
132*> \author NAG Ltd.
133*
134*> \ingroup lantb
135*
136* =====================================================================
137 DOUBLE PRECISION FUNCTION zlantb( NORM, UPLO, DIAG, N, K, AB,
138 $ LDAB, WORK )
139*
140* -- LAPACK auxiliary routine --
141* -- LAPACK is a software package provided by Univ. of Tennessee, --
142* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
143*
144* .. Scalar Arguments ..
145 CHARACTER diag, norm, uplo
146 INTEGER k, ldab, n
147* ..
148* .. Array Arguments ..
149 DOUBLE PRECISION work( * )
150 COMPLEX*16 ab( ldab, * )
151* ..
152*
153* =====================================================================
154*
155* .. Parameters ..
156 DOUBLE PRECISION one, zero
157 parameter( one = 1.0d+0, zero = 0.0d+0 )
158* ..
159* .. Local Scalars ..
160 LOGICAL udiag
161 INTEGER i, j, l
162 DOUBLE PRECISION scale, sum, value
163* ..
164* .. External Functions ..
165 LOGICAL lsame, disnan
166 EXTERNAL lsame, disnan
167* ..
168* .. External Subroutines ..
169 EXTERNAL zlassq
170* ..
171* .. Intrinsic Functions ..
172 INTRINSIC abs, max, min, sqrt
173* ..
174* .. Executable Statements ..
175*
176 IF( n.EQ.0 ) THEN
177 VALUE = zero
178 ELSE IF( lsame( norm, 'M' ) ) THEN
179*
180* Find max(abs(A(i,j))).
181*
182 IF( lsame( diag, 'U' ) ) THEN
183 VALUE = one
184 IF( lsame( uplo, 'U' ) ) THEN
185 DO 20 j = 1, n
186 DO 10 i = max( k+2-j, 1 ), k
187 sum = abs( ab( i, j ) )
188 IF( VALUE .LT. sum .OR.
189 $ disnan( sum ) ) VALUE = sum
190 10 CONTINUE
191 20 CONTINUE
192 ELSE
193 DO 40 j = 1, n
194 DO 30 i = 2, min( n+1-j, k+1 )
195 sum = abs( ab( i, j ) )
196 IF( VALUE .LT. sum .OR.
197 $ disnan( sum ) ) VALUE = sum
198 30 CONTINUE
199 40 CONTINUE
200 END IF
201 ELSE
202 VALUE = zero
203 IF( lsame( uplo, 'U' ) ) THEN
204 DO 60 j = 1, n
205 DO 50 i = max( k+2-j, 1 ), k + 1
206 sum = abs( ab( i, j ) )
207 IF( VALUE .LT. sum .OR.
208 $ disnan( sum ) ) VALUE = sum
209 50 CONTINUE
210 60 CONTINUE
211 ELSE
212 DO 80 j = 1, n
213 DO 70 i = 1, min( n+1-j, k+1 )
214 sum = abs( ab( i, j ) )
215 IF( VALUE .LT. sum .OR.
216 $ disnan( sum ) ) VALUE = sum
217 70 CONTINUE
218 80 CONTINUE
219 END IF
220 END IF
221 ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
222*
223* Find norm1(A).
224*
225 VALUE = zero
226 udiag = lsame( diag, 'U' )
227 IF( lsame( uplo, 'U' ) ) THEN
228 DO 110 j = 1, n
229 IF( udiag ) THEN
230 sum = one
231 DO 90 i = max( k+2-j, 1 ), k
232 sum = sum + abs( ab( i, j ) )
233 90 CONTINUE
234 ELSE
235 sum = zero
236 DO 100 i = max( k+2-j, 1 ), k + 1
237 sum = sum + abs( ab( i, j ) )
238 100 CONTINUE
239 END IF
240 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
241 110 CONTINUE
242 ELSE
243 DO 140 j = 1, n
244 IF( udiag ) THEN
245 sum = one
246 DO 120 i = 2, min( n+1-j, k+1 )
247 sum = sum + abs( ab( i, j ) )
248 120 CONTINUE
249 ELSE
250 sum = zero
251 DO 130 i = 1, min( n+1-j, k+1 )
252 sum = sum + abs( ab( i, j ) )
253 130 CONTINUE
254 END IF
255 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
256 140 CONTINUE
257 END IF
258 ELSE IF( lsame( norm, 'I' ) ) THEN
259*
260* Find normI(A).
261*
262 VALUE = zero
263 IF( lsame( uplo, 'U' ) ) THEN
264 IF( lsame( diag, 'U' ) ) THEN
265 DO 150 i = 1, n
266 work( i ) = one
267 150 CONTINUE
268 DO 170 j = 1, n
269 l = k + 1 - j
270 DO 160 i = max( 1, j-k ), j - 1
271 work( i ) = work( i ) + abs( ab( l+i, j ) )
272 160 CONTINUE
273 170 CONTINUE
274 ELSE
275 DO 180 i = 1, n
276 work( i ) = zero
277 180 CONTINUE
278 DO 200 j = 1, n
279 l = k + 1 - j
280 DO 190 i = max( 1, j-k ), j
281 work( i ) = work( i ) + abs( ab( l+i, j ) )
282 190 CONTINUE
283 200 CONTINUE
284 END IF
285 ELSE
286 IF( lsame( diag, 'U' ) ) THEN
287 DO 210 i = 1, n
288 work( i ) = one
289 210 CONTINUE
290 DO 230 j = 1, n
291 l = 1 - j
292 DO 220 i = j + 1, min( n, j+k )
293 work( i ) = work( i ) + abs( ab( l+i, j ) )
294 220 CONTINUE
295 230 CONTINUE
296 ELSE
297 DO 240 i = 1, n
298 work( i ) = zero
299 240 CONTINUE
300 DO 260 j = 1, n
301 l = 1 - j
302 DO 250 i = j, min( n, j+k )
303 work( i ) = work( i ) + abs( ab( l+i, j ) )
304 250 CONTINUE
305 260 CONTINUE
306 END IF
307 END IF
308 DO 270 i = 1, n
309 sum = work( i )
310 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
311 270 CONTINUE
312 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
313 $ ( lsame( norm, 'E' ) ) ) THEN
314*
315* Find normF(A).
316*
317 IF( lsame( uplo, 'U' ) ) THEN
318 IF( lsame( diag, 'U' ) ) THEN
319 scale = one
320 sum = n
321 IF( k.GT.0 ) THEN
322 DO 280 j = 2, n
323 CALL zlassq( min( j-1, k ),
324 $ ab( max( k+2-j, 1 ), j ), 1, scale,
325 $ sum )
326 280 CONTINUE
327 END IF
328 ELSE
329 scale = zero
330 sum = one
331 DO 290 j = 1, n
332 CALL zlassq( min( j, k+1 ), ab( max( k+2-j, 1 ),
333 $ j ),
334 $ 1, scale, sum )
335 290 CONTINUE
336 END IF
337 ELSE
338 IF( lsame( diag, 'U' ) ) THEN
339 scale = one
340 sum = n
341 IF( k.GT.0 ) THEN
342 DO 300 j = 1, n - 1
343 CALL zlassq( min( n-j, k ), ab( 2, j ), 1,
344 $ scale,
345 $ sum )
346 300 CONTINUE
347 END IF
348 ELSE
349 scale = zero
350 sum = one
351 DO 310 j = 1, n
352 CALL zlassq( min( n-j+1, k+1 ), ab( 1, j ), 1,
353 $ scale,
354 $ sum )
355 310 CONTINUE
356 END IF
357 END IF
358 VALUE = scale*sqrt( sum )
359 END IF
360*
361 zlantb = VALUE
362 RETURN
363*
364* End of ZLANTB
365*
366 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlantb(norm, uplo, diag, n, k, ab, ldab, work)
ZLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlantb.f:139
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:122
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48