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

◆ clantb()

real function clantb ( character  norm,
character  uplo,
character  diag,
integer  n,
integer  k,
complex, dimension( ldab, * )  ab,
integer  ldab,
real, dimension( * )  work 
)

CLANTB 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 CLANTB + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CLANTB  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
CLANTB
    CLANTB = ( 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 CLANTB 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, CLANTB 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 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 REAL 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 139 of file clantb.f.

141*
142* -- LAPACK auxiliary routine --
143* -- LAPACK is a software package provided by Univ. of Tennessee, --
144* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
145*
146* .. Scalar Arguments ..
147 CHARACTER DIAG, NORM, UPLO
148 INTEGER K, LDAB, N
149* ..
150* .. Array Arguments ..
151 REAL WORK( * )
152 COMPLEX AB( LDAB, * )
153* ..
154*
155* =====================================================================
156*
157* .. Parameters ..
158 REAL ONE, ZERO
159 parameter( one = 1.0e+0, zero = 0.0e+0 )
160* ..
161* .. Local Scalars ..
162 LOGICAL UDIAG
163 INTEGER I, J, L
164 REAL SCALE, SUM, VALUE
165* ..
166* .. External Functions ..
167 LOGICAL LSAME, SISNAN
168 EXTERNAL lsame, sisnan
169* ..
170* .. External Subroutines ..
171 EXTERNAL classq
172* ..
173* .. Intrinsic Functions ..
174 INTRINSIC abs, max, min, sqrt
175* ..
176* .. Executable Statements ..
177*
178 IF( n.EQ.0 ) THEN
179 VALUE = zero
180 ELSE IF( lsame( norm, 'M' ) ) THEN
181*
182* Find max(abs(A(i,j))).
183*
184 IF( lsame( diag, 'U' ) ) THEN
185 VALUE = one
186 IF( lsame( uplo, 'U' ) ) THEN
187 DO 20 j = 1, n
188 DO 10 i = max( k+2-j, 1 ), k
189 sum = abs( ab( i, j ) )
190 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
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 sum = abs( ab( i, j ) )
197 IF( VALUE .LT. sum .OR. sisnan( 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. sisnan( sum ) ) VALUE = sum
208 50 CONTINUE
209 60 CONTINUE
210 ELSE
211 DO 80 j = 1, n
212 DO 70 i = 1, min( n+1-j, k+1 )
213 sum = abs( ab( i, j ) )
214 IF( VALUE .LT. sum .OR. sisnan( 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. sisnan( 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. sisnan( 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. sisnan( sum ) ) VALUE = sum
309 270 CONTINUE
310 ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
311*
312* Find normF(A).
313*
314 IF( lsame( uplo, 'U' ) ) THEN
315 IF( lsame( diag, 'U' ) ) THEN
316 scale = one
317 sum = n
318 IF( k.GT.0 ) THEN
319 DO 280 j = 2, n
320 CALL classq( min( j-1, k ),
321 $ ab( max( k+2-j, 1 ), j ), 1, scale,
322 $ sum )
323 280 CONTINUE
324 END IF
325 ELSE
326 scale = zero
327 sum = one
328 DO 290 j = 1, n
329 CALL classq( min( j, k+1 ), ab( max( k+2-j, 1 ), j ),
330 $ 1, scale, sum )
331 290 CONTINUE
332 END IF
333 ELSE
334 IF( lsame( diag, 'U' ) ) THEN
335 scale = one
336 sum = n
337 IF( k.GT.0 ) THEN
338 DO 300 j = 1, n - 1
339 CALL classq( min( n-j, k ), ab( 2, j ), 1, scale,
340 $ sum )
341 300 CONTINUE
342 END IF
343 ELSE
344 scale = zero
345 sum = one
346 DO 310 j = 1, n
347 CALL classq( min( n-j+1, k+1 ), ab( 1, j ), 1, scale,
348 $ sum )
349 310 CONTINUE
350 END IF
351 END IF
352 VALUE = scale*sqrt( sum )
353 END IF
354*
355 clantb = VALUE
356 RETURN
357*
358* End of CLANTB
359*
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:59
real function clantb(norm, uplo, diag, n, k, ab, ldab, work)
CLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clantb.f:141
subroutine classq(n, x, incx, scale, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition classq.f90:124
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: