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