LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zlantb()

double precision function zlantb ( character norm,
character uplo,
character diag,
integer n,
integer k,
complex*16, dimension( ldab, * ) ab,
integer ldab,
double precision, dimension( * ) work )

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.

Download ZLANTB + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLANTB  returns the value of the one norm,  or the Frobenius norm, or
!> the  infinity norm,  or the element of  largest absolute value  of an
!> n by n triangular band matrix A,  with ( k + 1 ) diagonals.
!> 
Returns
ZLANTB
!>
!>    ZLANTB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
!>             (
!>             ( norm1(A),         NORM = '1', 'O' or 'o'
!>             (
!>             ( normI(A),         NORM = 'I' or 'i'
!>             (
!>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
!>
!> where  norm1  denotes the  one norm of a matrix (maximum column sum),
!> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
!> normF  denotes the  Frobenius norm of a matrix (square root of sum of
!> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
!> 
Parameters
[in]NORM
!>          NORM is CHARACTER*1
!>          Specifies the value to be returned in ZLANTB as described
!>          above.
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the matrix A is upper or lower triangular.
!>          = 'U':  Upper triangular
!>          = 'L':  Lower triangular
!> 
[in]DIAG
!>          DIAG is CHARACTER*1
!>          Specifies whether or not the matrix A is unit triangular.
!>          = 'N':  Non-unit triangular
!>          = 'U':  Unit triangular
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.  When N = 0, ZLANTB is
!>          set to zero.
!> 
[in]K
!>          K is INTEGER
!>          The number of super-diagonals of the matrix A if UPLO = 'U',
!>          or the number of sub-diagonals of the matrix A if UPLO = 'L'.
!>          K >= 0.
!> 
[in]AB
!>          AB is COMPLEX*16 array, dimension (LDAB,N)
!>          The upper or lower triangular band matrix A, stored in the
!>          first k+1 rows of AB.  The j-th column of A is stored
!>          in the j-th column of the array AB as follows:
!>          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
!>          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
!>          Note that when DIAG = 'U', the elements of the array AB
!>          corresponding to the diagonal elements of the matrix A are
!>          not referenced, but are assumed to be one.
!> 
[in]LDAB
!>          LDAB is INTEGER
!>          The leading dimension of the array AB.  LDAB >= K+1.
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
!>          where LWORK >= N when NORM = 'I'; otherwise, WORK is not
!>          referenced.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 137 of file zlantb.f.

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*
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
Here is the call graph for this function:
Here is the caller graph for this function: