LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ slansb()

real function slansb ( character  NORM,
character  UPLO,
integer  N,
integer  K,
real, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( * )  WORK 
)

SLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix.

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

Purpose:
 SLANSB  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 symmetric band matrix A,  with k super-diagonals.
Returns
SLANSB
    SLANSB = ( 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 SLANSB as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          band matrix A is supplied.
          = 'U':  Upper triangular part is supplied
          = 'L':  Lower triangular part is supplied
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, SLANSB is
          set to zero.
[in]K
          K is INTEGER
          The number of super-diagonals or sub-diagonals of the
          band matrix A.  K >= 0.
[in]AB
          AB is REAL array, dimension (LDAB,N)
          The upper or lower triangle of the symmetric 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).
[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' or '1' or 'O'; otherwise,
          WORK is not referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 127 of file slansb.f.

129 *
130 * -- LAPACK auxiliary routine --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 *
134  IMPLICIT NONE
135 * .. Scalar Arguments ..
136  CHARACTER NORM, UPLO
137  INTEGER K, LDAB, N
138 * ..
139 * .. Array Arguments ..
140  REAL AB( LDAB, * ), WORK( * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL ONE, ZERO
147  parameter( one = 1.0e+0, zero = 0.0e+0 )
148 * ..
149 * .. Local Scalars ..
150  INTEGER I, J, L
151  REAL ABSA, SUM, VALUE
152 * ..
153 * .. Local Arrays ..
154  REAL SSQ( 2 ), COLSSQ( 2 )
155 * ..
156 * .. External Functions ..
157  LOGICAL LSAME, SISNAN
158  EXTERNAL lsame, sisnan
159 * ..
160 * .. External Subroutines ..
161  EXTERNAL slassq, scombssq
162 * ..
163 * .. Intrinsic Functions ..
164  INTRINSIC abs, max, min, sqrt
165 * ..
166 * .. Executable Statements ..
167 *
168  IF( n.EQ.0 ) THEN
169  VALUE = zero
170  ELSE IF( lsame( norm, 'M' ) ) THEN
171 *
172 * Find max(abs(A(i,j))).
173 *
174  VALUE = zero
175  IF( lsame( uplo, 'U' ) ) THEN
176  DO 20 j = 1, n
177  DO 10 i = max( k+2-j, 1 ), k + 1
178  sum = abs( ab( i, j ) )
179  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
180  10 CONTINUE
181  20 CONTINUE
182  ELSE
183  DO 40 j = 1, n
184  DO 30 i = 1, min( n+1-j, k+1 )
185  sum = abs( ab( i, j ) )
186  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
187  30 CONTINUE
188  40 CONTINUE
189  END IF
190  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
191  $ ( norm.EQ.'1' ) ) THEN
192 *
193 * Find normI(A) ( = norm1(A), since A is symmetric).
194 *
195  VALUE = zero
196  IF( lsame( uplo, 'U' ) ) THEN
197  DO 60 j = 1, n
198  sum = zero
199  l = k + 1 - j
200  DO 50 i = max( 1, j-k ), j - 1
201  absa = abs( ab( l+i, j ) )
202  sum = sum + absa
203  work( i ) = work( i ) + absa
204  50 CONTINUE
205  work( j ) = sum + abs( ab( k+1, j ) )
206  60 CONTINUE
207  DO 70 i = 1, n
208  sum = work( i )
209  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
210  70 CONTINUE
211  ELSE
212  DO 80 i = 1, n
213  work( i ) = zero
214  80 CONTINUE
215  DO 100 j = 1, n
216  sum = work( j ) + abs( ab( 1, j ) )
217  l = 1 - j
218  DO 90 i = j + 1, min( n, j+k )
219  absa = abs( ab( l+i, j ) )
220  sum = sum + absa
221  work( i ) = work( i ) + absa
222  90 CONTINUE
223  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
224  100 CONTINUE
225  END IF
226  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
227 *
228 * Find normF(A).
229 * SSQ(1) is scale
230 * SSQ(2) is sum-of-squares
231 * For better accuracy, sum each column separately.
232 *
233  ssq( 1 ) = zero
234  ssq( 2 ) = one
235 *
236 * Sum off-diagonals
237 *
238  IF( k.GT.0 ) THEN
239  IF( lsame( uplo, 'U' ) ) THEN
240  DO 110 j = 2, n
241  colssq( 1 ) = zero
242  colssq( 2 ) = one
243  CALL slassq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
244  $ 1, colssq( 1 ), colssq( 2 ) )
245  CALL scombssq( ssq, colssq )
246  110 CONTINUE
247  l = k + 1
248  ELSE
249  DO 120 j = 1, n - 1
250  colssq( 1 ) = zero
251  colssq( 2 ) = one
252  CALL slassq( min( n-j, k ), ab( 2, j ), 1,
253  $ colssq( 1 ), colssq( 2 ) )
254  CALL scombssq( ssq, colssq )
255  120 CONTINUE
256  l = 1
257  END IF
258  ssq( 2 ) = 2*ssq( 2 )
259  ELSE
260  l = 1
261  END IF
262 *
263 * Sum diagonal
264 *
265  colssq( 1 ) = zero
266  colssq( 2 ) = one
267  CALL slassq( n, ab( l, 1 ), ldab, colssq( 1 ), colssq( 2 ) )
268  CALL scombssq( ssq, colssq )
269  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
270  END IF
271 *
272  slansb = VALUE
273  RETURN
274 *
275 * End of SLANSB
276 *
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 slansb(NORM, UPLO, N, K, AB, LDAB, WORK)
SLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: slansb.f:129
Here is the call graph for this function: