LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 143 of file clantb.f.

143 *
144 * -- LAPACK auxiliary routine (version 3.7.0) --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * December 2016
148 *
149  IMPLICIT NONE
150 * .. Scalar Arguments ..
151  CHARACTER DIAG, NORM, UPLO
152  INTEGER K, LDAB, N
153 * ..
154 * .. Array Arguments ..
155  REAL WORK( * )
156  COMPLEX AB( LDAB, * )
157 * ..
158 *
159 * =====================================================================
160 *
161 * .. Parameters ..
162  REAL ONE, ZERO
163  parameter( one = 1.0e+0, zero = 0.0e+0 )
164 * ..
165 * .. Local Scalars ..
166  LOGICAL UDIAG
167  INTEGER I, J, L
168  REAL SUM, VALUE
169 * ..
170 * .. Local Arrays ..
171  REAL SSQ( 2 ), COLSSQ( 2 )
172 * ..
173 * .. External Functions ..
174  LOGICAL LSAME, SISNAN
175  EXTERNAL lsame, sisnan
176 * ..
177 * .. External Subroutines ..
178  EXTERNAL classq, scombssq
179 * ..
180 * .. Intrinsic Functions ..
181  INTRINSIC abs, max, min, sqrt
182 * ..
183 * .. Executable Statements ..
184 *
185  IF( n.EQ.0 ) THEN
186  VALUE = zero
187  ELSE IF( lsame( norm, 'M' ) ) THEN
188 *
189 * Find max(abs(A(i,j))).
190 *
191  IF( lsame( diag, 'U' ) ) THEN
192  VALUE = one
193  IF( lsame( uplo, 'U' ) ) THEN
194  DO 20 j = 1, n
195  DO 10 i = max( k+2-j, 1 ), k
196  sum = abs( ab( i, j ) )
197  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
198  10 CONTINUE
199  20 CONTINUE
200  ELSE
201  DO 40 j = 1, n
202  DO 30 i = 2, min( n+1-j, k+1 )
203  sum = abs( ab( i, j ) )
204  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
205  30 CONTINUE
206  40 CONTINUE
207  END IF
208  ELSE
209  VALUE = zero
210  IF( lsame( uplo, 'U' ) ) THEN
211  DO 60 j = 1, n
212  DO 50 i = max( k+2-j, 1 ), k + 1
213  sum = abs( ab( i, j ) )
214  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
215  50 CONTINUE
216  60 CONTINUE
217  ELSE
218  DO 80 j = 1, n
219  DO 70 i = 1, min( n+1-j, k+1 )
220  sum = abs( ab( i, j ) )
221  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
222  70 CONTINUE
223  80 CONTINUE
224  END IF
225  END IF
226  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
227 *
228 * Find norm1(A).
229 *
230  VALUE = zero
231  udiag = lsame( diag, 'U' )
232  IF( lsame( uplo, 'U' ) ) THEN
233  DO 110 j = 1, n
234  IF( udiag ) THEN
235  sum = one
236  DO 90 i = max( k+2-j, 1 ), k
237  sum = sum + abs( ab( i, j ) )
238  90 CONTINUE
239  ELSE
240  sum = zero
241  DO 100 i = max( k+2-j, 1 ), k + 1
242  sum = sum + abs( ab( i, j ) )
243  100 CONTINUE
244  END IF
245  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
246  110 CONTINUE
247  ELSE
248  DO 140 j = 1, n
249  IF( udiag ) THEN
250  sum = one
251  DO 120 i = 2, min( n+1-j, k+1 )
252  sum = sum + abs( ab( i, j ) )
253  120 CONTINUE
254  ELSE
255  sum = zero
256  DO 130 i = 1, min( n+1-j, k+1 )
257  sum = sum + abs( ab( i, j ) )
258  130 CONTINUE
259  END IF
260  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
261  140 CONTINUE
262  END IF
263  ELSE IF( lsame( norm, 'I' ) ) THEN
264 *
265 * Find normI(A).
266 *
267  VALUE = zero
268  IF( lsame( uplo, 'U' ) ) THEN
269  IF( lsame( diag, 'U' ) ) THEN
270  DO 150 i = 1, n
271  work( i ) = one
272  150 CONTINUE
273  DO 170 j = 1, n
274  l = k + 1 - j
275  DO 160 i = max( 1, j-k ), j - 1
276  work( i ) = work( i ) + abs( ab( l+i, j ) )
277  160 CONTINUE
278  170 CONTINUE
279  ELSE
280  DO 180 i = 1, n
281  work( i ) = zero
282  180 CONTINUE
283  DO 200 j = 1, n
284  l = k + 1 - j
285  DO 190 i = max( 1, j-k ), j
286  work( i ) = work( i ) + abs( ab( l+i, j ) )
287  190 CONTINUE
288  200 CONTINUE
289  END IF
290  ELSE
291  IF( lsame( diag, 'U' ) ) THEN
292  DO 210 i = 1, n
293  work( i ) = one
294  210 CONTINUE
295  DO 230 j = 1, n
296  l = 1 - j
297  DO 220 i = j + 1, min( n, j+k )
298  work( i ) = work( i ) + abs( ab( l+i, j ) )
299  220 CONTINUE
300  230 CONTINUE
301  ELSE
302  DO 240 i = 1, n
303  work( i ) = zero
304  240 CONTINUE
305  DO 260 j = 1, n
306  l = 1 - j
307  DO 250 i = j, min( n, j+k )
308  work( i ) = work( i ) + abs( ab( l+i, j ) )
309  250 CONTINUE
310  260 CONTINUE
311  END IF
312  END IF
313  DO 270 i = 1, n
314  sum = work( i )
315  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
316  270 CONTINUE
317  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
318 *
319 * Find normF(A).
320 * SSQ(1) is scale
321 * SSQ(2) is sum-of-squares
322 * For better accuracy, sum each column separately.
323 *
324  IF( lsame( uplo, 'U' ) ) THEN
325  IF( lsame( diag, 'U' ) ) THEN
326  ssq( 1 ) = one
327  ssq( 2 ) = n
328  IF( k.GT.0 ) THEN
329  DO 280 j = 2, n
330  colssq( 1 ) = zero
331  colssq( 2 ) = one
332  CALL classq( min( j-1, k ),
333  $ ab( max( k+2-j, 1 ), j ), 1,
334  $ colssq( 1 ), colssq( 2 ) )
335  CALL scombssq( ssq, colssq )
336  280 CONTINUE
337  END IF
338  ELSE
339  ssq( 1 ) = zero
340  ssq( 2 ) = one
341  DO 290 j = 1, n
342  colssq( 1 ) = zero
343  colssq( 2 ) = one
344  CALL classq( min( j, k+1 ), ab( max( k+2-j, 1 ), j ),
345  $ 1, colssq( 1 ), colssq( 2 ) )
346  CALL scombssq( ssq, colssq )
347  290 CONTINUE
348  END IF
349  ELSE
350  IF( lsame( diag, 'U' ) ) THEN
351  ssq( 1 ) = one
352  ssq( 2 ) = n
353  IF( k.GT.0 ) THEN
354  DO 300 j = 1, n - 1
355  colssq( 1 ) = zero
356  colssq( 2 ) = one
357  CALL classq( min( n-j, k ), ab( 2, j ), 1,
358  $ colssq( 1 ), colssq( 2 ) )
359  CALL scombssq( ssq, colssq )
360  300 CONTINUE
361  END IF
362  ELSE
363  ssq( 1 ) = zero
364  ssq( 2 ) = one
365  DO 310 j = 1, n
366  colssq( 1 ) = zero
367  colssq( 2 ) = one
368  CALL classq( min( n-j+1, k+1 ), ab( 1, j ), 1,
369  $ colssq( 1 ), colssq( 2 ) )
370  CALL scombssq( ssq, colssq )
371  310 CONTINUE
372  END IF
373  END IF
374  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
375  END IF
376 *
377  clantb = VALUE
378  RETURN
379 *
380 * End of CLANTB
381 *
Here is the call graph for this function:
classq
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
sisnan
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
clantb
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:143
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
scombssq
subroutine scombssq(V1, V2)
SCOMBSSQ adds two scaled sum of squares quantities
Definition: scombssq.f:62