LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dlantb()

double precision function dlantb ( character  NORM,
character  UPLO,
character  DIAG,
integer  N,
integer  K,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  WORK 
)

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.

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

Purpose:
 DLANTB  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
DLANTB
    DLANTB = ( 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 DLANTB 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, DLANTB 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 DOUBLE PRECISION 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.
Date
December 2016

Definition at line 142 of file dlantb.f.

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