LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
real function slantb ( character  NORM,
character  UPLO,
character  DIAG,
integer  N,
integer  K,
real, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( * )  WORK 
)

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

Purpose:
 SLANTB  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
SLANTB
    SLANTB = ( 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 SLANTB 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, SLANTB 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 REAL 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 142 of file slantb.f.

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

Here is the call graph for this function: