LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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
September 2012

Definition at line 143 of file clantb.f.

143 *
144 * -- LAPACK auxiliary routine (version 3.4.2) --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * September 2012
148 *
149 * .. Scalar Arguments ..
150  CHARACTER diag, norm, uplo
151  INTEGER k, ldab, n
152 * ..
153 * .. Array Arguments ..
154  REAL work( * )
155  COMPLEX ab( ldab, * )
156 * ..
157 *
158 * =====================================================================
159 *
160 * .. Parameters ..
161  REAL one, zero
162  parameter ( one = 1.0e+0, zero = 0.0e+0 )
163 * ..
164 * .. Local Scalars ..
165  LOGICAL udiag
166  INTEGER i, j, l
167  REAL scale, sum, value
168 * ..
169 * .. External Functions ..
170  LOGICAL lsame, sisnan
171  EXTERNAL lsame, sisnan
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL classq
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC abs, max, min, sqrt
178 * ..
179 * .. Executable Statements ..
180 *
181  IF( n.EQ.0 ) THEN
182  VALUE = zero
183  ELSE IF( lsame( norm, 'M' ) ) THEN
184 *
185 * Find max(abs(A(i,j))).
186 *
187  IF( lsame( diag, 'U' ) ) THEN
188  VALUE = one
189  IF( lsame( uplo, 'U' ) ) THEN
190  DO 20 j = 1, n
191  DO 10 i = max( k+2-j, 1 ), k
192  sum = abs( ab( i, j ) )
193  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
194  10 CONTINUE
195  20 CONTINUE
196  ELSE
197  DO 40 j = 1, n
198  DO 30 i = 2, min( n+1-j, k+1 )
199  sum = abs( ab( i, j ) )
200  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
201  30 CONTINUE
202  40 CONTINUE
203  END IF
204  ELSE
205  VALUE = zero
206  IF( lsame( uplo, 'U' ) ) THEN
207  DO 60 j = 1, n
208  DO 50 i = max( k+2-j, 1 ), k + 1
209  sum = abs( ab( i, j ) )
210  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
211  50 CONTINUE
212  60 CONTINUE
213  ELSE
214  DO 80 j = 1, n
215  DO 70 i = 1, min( n+1-j, k+1 )
216  sum = abs( ab( i, j ) )
217  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
218  70 CONTINUE
219  80 CONTINUE
220  END IF
221  END IF
222  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
223 *
224 * Find norm1(A).
225 *
226  VALUE = zero
227  udiag = lsame( diag, 'U' )
228  IF( lsame( uplo, 'U' ) ) THEN
229  DO 110 j = 1, n
230  IF( udiag ) THEN
231  sum = one
232  DO 90 i = max( k+2-j, 1 ), k
233  sum = sum + abs( ab( i, j ) )
234  90 CONTINUE
235  ELSE
236  sum = zero
237  DO 100 i = max( k+2-j, 1 ), k + 1
238  sum = sum + abs( ab( i, j ) )
239  100 CONTINUE
240  END IF
241  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
242  110 CONTINUE
243  ELSE
244  DO 140 j = 1, n
245  IF( udiag ) THEN
246  sum = one
247  DO 120 i = 2, min( n+1-j, k+1 )
248  sum = sum + abs( ab( i, j ) )
249  120 CONTINUE
250  ELSE
251  sum = zero
252  DO 130 i = 1, min( n+1-j, k+1 )
253  sum = sum + abs( ab( i, j ) )
254  130 CONTINUE
255  END IF
256  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
257  140 CONTINUE
258  END IF
259  ELSE IF( lsame( norm, 'I' ) ) THEN
260 *
261 * Find normI(A).
262 *
263  VALUE = zero
264  IF( lsame( uplo, 'U' ) ) THEN
265  IF( lsame( diag, 'U' ) ) THEN
266  DO 150 i = 1, n
267  work( i ) = one
268  150 CONTINUE
269  DO 170 j = 1, n
270  l = k + 1 - j
271  DO 160 i = max( 1, j-k ), j - 1
272  work( i ) = work( i ) + abs( ab( l+i, j ) )
273  160 CONTINUE
274  170 CONTINUE
275  ELSE
276  DO 180 i = 1, n
277  work( i ) = zero
278  180 CONTINUE
279  DO 200 j = 1, n
280  l = k + 1 - j
281  DO 190 i = max( 1, j-k ), j
282  work( i ) = work( i ) + abs( ab( l+i, j ) )
283  190 CONTINUE
284  200 CONTINUE
285  END IF
286  ELSE
287  IF( lsame( diag, 'U' ) ) THEN
288  DO 210 i = 1, n
289  work( i ) = one
290  210 CONTINUE
291  DO 230 j = 1, n
292  l = 1 - j
293  DO 220 i = j + 1, min( n, j+k )
294  work( i ) = work( i ) + abs( ab( l+i, j ) )
295  220 CONTINUE
296  230 CONTINUE
297  ELSE
298  DO 240 i = 1, n
299  work( i ) = zero
300  240 CONTINUE
301  DO 260 j = 1, n
302  l = 1 - j
303  DO 250 i = j, min( n, j+k )
304  work( i ) = work( i ) + abs( ab( l+i, j ) )
305  250 CONTINUE
306  260 CONTINUE
307  END IF
308  END IF
309  DO 270 i = 1, n
310  sum = work( i )
311  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
312  270 CONTINUE
313  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( 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 classq( 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 classq( min( j, k+1 ), ab( max( k+2-j, 1 ), j ),
333  $ 1, scale, sum )
334  290 CONTINUE
335  END IF
336  ELSE
337  IF( lsame( diag, 'U' ) ) THEN
338  scale = one
339  sum = n
340  IF( k.GT.0 ) THEN
341  DO 300 j = 1, n - 1
342  CALL classq( min( n-j, k ), ab( 2, j ), 1, 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 classq( min( n-j+1, k+1 ), ab( 1, j ), 1, scale,
351  $ sum )
352  310 CONTINUE
353  END IF
354  END IF
355  VALUE = scale*sqrt( sum )
356  END IF
357 *
358  clantb = VALUE
359  RETURN
360 *
361 * End of CLANTB
362 *
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
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, or the element of largest absolute value of a triangular band matrix.
Definition: clantb.f:143
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function: