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