LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ slantb()

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.

Definition at line 138 of file slantb.f.

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