LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
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 *> \htmlonly
9 *> Download ZLANTB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlantb.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlantb.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlantb.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * DOUBLE PRECISION FUNCTION ZLANTB( NORM, UPLO, DIAG, N, K, AB,
22 * LDAB, WORK )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, 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 *> ZLANTB 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 triangular band matrix A, with ( k + 1 ) diagonals.
42 *> \endverbatim
43 *>
44 *> \return ZLANTB
45 *> \verbatim
46 *>
47 *> ZLANTB = ( 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 ZLANTB as described
68 *> above.
69 *> \endverbatim
70 *>
71 *> \param[in] UPLO
72 *> \verbatim
73 *> UPLO is CHARACTER*1
74 *> Specifies whether the matrix A is upper or lower triangular.
75 *> = 'U': Upper triangular
76 *> = 'L': Lower triangular
77 *> \endverbatim
78 *>
79 *> \param[in] DIAG
80 *> \verbatim
81 *> DIAG is CHARACTER*1
82 *> Specifies whether or not the matrix A is unit triangular.
83 *> = 'N': Non-unit triangular
84 *> = 'U': Unit triangular
85 *> \endverbatim
86 *>
87 *> \param[in] N
88 *> \verbatim
89 *> N is INTEGER
90 *> The order of the matrix A. N >= 0. When N = 0, ZLANTB is
91 *> set to zero.
92 *> \endverbatim
93 *>
94 *> \param[in] K
95 *> \verbatim
96 *> K is INTEGER
97 *> The number of super-diagonals of the matrix A if UPLO = 'U',
98 *> or the number of sub-diagonals of the matrix A if UPLO = 'L'.
99 *> K >= 0.
100 *> \endverbatim
101 *>
102 *> \param[in] AB
103 *> \verbatim
104 *> AB is COMPLEX*16 array, dimension (LDAB,N)
105 *> The upper or lower triangular band matrix A, stored in the
106 *> first k+1 rows of AB. The j-th column of A is stored
107 *> in the j-th column of the array AB as follows:
108 *> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
109 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
110 *> Note that when DIAG = 'U', the elements of the array AB
111 *> corresponding to the diagonal elements of the matrix A are
112 *> not referenced, but are assumed to be one.
113 *> \endverbatim
114 *>
115 *> \param[in] LDAB
116 *> \verbatim
117 *> LDAB is INTEGER
118 *> The leading dimension of the array AB. LDAB >= K+1.
119 *> \endverbatim
120 *>
121 *> \param[out] WORK
122 *> \verbatim
123 *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
124 *> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
125 *> referenced.
126 *> \endverbatim
127 *
128 * Authors:
129 * ========
130 *
131 *> \author Univ. of Tennessee
132 *> \author Univ. of California Berkeley
133 *> \author Univ. of Colorado Denver
134 *> \author NAG Ltd.
135 *
136 *> \date September 2012
137 *
138 *> \ingroup complex16OTHERauxiliary
139 *
140 * =====================================================================
141  DOUBLE PRECISION FUNCTION zlantb( NORM, UPLO, DIAG, N, K, AB,
142  $ ldab, work )
143 *
144 * -- LAPACK auxiliary routine (version 3.4.2) --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * September 2012
148 *
149 * .. Scalar Arguments ..
150  CHARACTER diag, norm, uplo
151  INTEGER k, ldab, n
152 * ..
153 * .. Array Arguments ..
154  DOUBLE PRECISION work( * )
155  COMPLEX*16 ab( ldab, * )
156 * ..
157 *
158 * =====================================================================
159 *
160 * .. Parameters ..
161  DOUBLE PRECISION one, zero
162  parameter( one = 1.0d+0, zero = 0.0d+0 )
163 * ..
164 * .. Local Scalars ..
165  LOGICAL udiag
166  INTEGER i, j, l
167  DOUBLE PRECISION scale, sum, value
168 * ..
169 * .. External Functions ..
170  LOGICAL lsame, disnan
171  EXTERNAL lsame, disnan
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL zlassq
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC abs, max, min, sqrt
178 * ..
179 * .. Executable Statements ..
180 *
181  IF( n.EQ.0 ) THEN
182  value = zero
183  ELSE IF( lsame( norm, 'M' ) ) THEN
184 *
185 * Find max(abs(A(i,j))).
186 *
187  IF( lsame( diag, 'U' ) ) THEN
188  value = one
189  IF( lsame( uplo, 'U' ) ) THEN
190  DO 20 j = 1, n
191  DO 10 i = max( k+2-j, 1 ), k
192  sum = abs( ab( i, j ) )
193  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
194  10 continue
195  20 continue
196  ELSE
197  DO 40 j = 1, n
198  DO 30 i = 2, min( n+1-j, k+1 )
199  sum = abs( ab( i, j ) )
200  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
201  30 continue
202  40 continue
203  END IF
204  ELSE
205  value = zero
206  IF( lsame( uplo, 'U' ) ) THEN
207  DO 60 j = 1, n
208  DO 50 i = max( k+2-j, 1 ), k + 1
209  sum = abs( ab( i, j ) )
210  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
211  50 continue
212  60 continue
213  ELSE
214  DO 80 j = 1, n
215  DO 70 i = 1, min( n+1-j, k+1 )
216  sum = abs( ab( i, j ) )
217  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
218  70 continue
219  80 continue
220  END IF
221  END IF
222  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
223 *
224 * Find norm1(A).
225 *
226  value = zero
227  udiag = lsame( diag, 'U' )
228  IF( lsame( uplo, 'U' ) ) THEN
229  DO 110 j = 1, n
230  IF( udiag ) THEN
231  sum = one
232  DO 90 i = max( k+2-j, 1 ), k
233  sum = sum + abs( ab( i, j ) )
234  90 continue
235  ELSE
236  sum = zero
237  DO 100 i = max( k+2-j, 1 ), k + 1
238  sum = sum + abs( ab( i, j ) )
239  100 continue
240  END IF
241  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
242  110 continue
243  ELSE
244  DO 140 j = 1, n
245  IF( udiag ) THEN
246  sum = one
247  DO 120 i = 2, min( n+1-j, k+1 )
248  sum = sum + abs( ab( i, j ) )
249  120 continue
250  ELSE
251  sum = zero
252  DO 130 i = 1, min( n+1-j, k+1 )
253  sum = sum + abs( ab( i, j ) )
254  130 continue
255  END IF
256  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
257  140 continue
258  END IF
259  ELSE IF( lsame( norm, 'I' ) ) THEN
260 *
261 * Find normI(A).
262 *
263  value = zero
264  IF( lsame( uplo, 'U' ) ) THEN
265  IF( lsame( diag, 'U' ) ) THEN
266  DO 150 i = 1, n
267  work( i ) = one
268  150 continue
269  DO 170 j = 1, n
270  l = k + 1 - j
271  DO 160 i = max( 1, j-k ), j - 1
272  work( i ) = work( i ) + abs( ab( l+i, j ) )
273  160 continue
274  170 continue
275  ELSE
276  DO 180 i = 1, n
277  work( i ) = zero
278  180 continue
279  DO 200 j = 1, n
280  l = k + 1 - j
281  DO 190 i = max( 1, j-k ), j
282  work( i ) = work( i ) + abs( ab( l+i, j ) )
283  190 continue
284  200 continue
285  END IF
286  ELSE
287  IF( lsame( diag, 'U' ) ) THEN
288  DO 210 i = 1, n
289  work( i ) = one
290  210 continue
291  DO 230 j = 1, n
292  l = 1 - j
293  DO 220 i = j + 1, min( n, j+k )
294  work( i ) = work( i ) + abs( ab( l+i, j ) )
295  220 continue
296  230 continue
297  ELSE
298  DO 240 i = 1, n
299  work( i ) = zero
300  240 continue
301  DO 260 j = 1, n
302  l = 1 - j
303  DO 250 i = j, min( n, j+k )
304  work( i ) = work( i ) + abs( ab( l+i, j ) )
305  250 continue
306  260 continue
307  END IF
308  END IF
309  DO 270 i = 1, n
310  sum = work( i )
311  IF( value .LT. sum .OR. disnan( sum ) ) value = sum
312  270 continue
313  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( 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 ), j ),
333  $ 1, scale, sum )
334  290 continue
335  END IF
336  ELSE
337  IF( lsame( diag, 'U' ) ) THEN
338  scale = one
339  sum = n
340  IF( k.GT.0 ) THEN
341  DO 300 j = 1, n - 1
342  CALL zlassq( min( n-j, k ), ab( 2, j ), 1, scale,
343  $ sum )
344  300 continue
345  END IF
346  ELSE
347  scale = zero
348  sum = one
349  DO 310 j = 1, n
350  CALL zlassq( min( n-j+1, k+1 ), ab( 1, j ), 1, scale,
351  $ sum )
352  310 continue
353  END IF
354  END IF
355  value = scale*sqrt( sum )
356  END IF
357 *
358  zlantb = value
359  return
360 *
361 * End of ZLANTB
362 *
363  END