LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ 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* .. Scalar Arguments ..
135 CHARACTER NORM, UPLO
136 INTEGER K, LDAB, N
137* ..
138* .. Array Arguments ..
139 REAL AB( LDAB, * ), WORK( * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 REAL ONE, ZERO
146 parameter( one = 1.0e+0, zero = 0.0e+0 )
147* ..
148* .. Local Scalars ..
149 INTEGER I, J, L
150 REAL ABSA, SCALE, SUM, VALUE
151* ..
152* .. External Subroutines ..
153 EXTERNAL slassq
154* ..
155* .. External Functions ..
156 LOGICAL LSAME, SISNAN
157 EXTERNAL lsame, sisnan
158* ..
159* .. Intrinsic Functions ..
160 INTRINSIC abs, max, min, sqrt
161* ..
162* .. Executable Statements ..
163*
164 IF( n.EQ.0 ) THEN
165 VALUE = zero
166 ELSE IF( lsame( norm, 'M' ) ) THEN
167*
168* Find max(abs(A(i,j))).
169*
170 VALUE = zero
171 IF( lsame( uplo, 'U' ) ) THEN
172 DO 20 j = 1, n
173 DO 10 i = max( k+2-j, 1 ), k + 1
174 sum = abs( ab( i, j ) )
175 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
176 10 CONTINUE
177 20 CONTINUE
178 ELSE
179 DO 40 j = 1, n
180 DO 30 i = 1, min( n+1-j, k+1 )
181 sum = abs( ab( i, j ) )
182 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
183 30 CONTINUE
184 40 CONTINUE
185 END IF
186 ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
187 $ ( norm.EQ.'1' ) ) THEN
188*
189* Find normI(A) ( = norm1(A), since A is symmetric).
190*
191 VALUE = zero
192 IF( lsame( uplo, 'U' ) ) THEN
193 DO 60 j = 1, n
194 sum = zero
195 l = k + 1 - j
196 DO 50 i = max( 1, j-k ), j - 1
197 absa = abs( ab( l+i, j ) )
198 sum = sum + absa
199 work( i ) = work( i ) + absa
200 50 CONTINUE
201 work( j ) = sum + abs( ab( k+1, j ) )
202 60 CONTINUE
203 DO 70 i = 1, n
204 sum = work( i )
205 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
206 70 CONTINUE
207 ELSE
208 DO 80 i = 1, n
209 work( i ) = zero
210 80 CONTINUE
211 DO 100 j = 1, n
212 sum = work( j ) + abs( ab( 1, j ) )
213 l = 1 - j
214 DO 90 i = j + 1, min( n, j+k )
215 absa = abs( ab( l+i, j ) )
216 sum = sum + absa
217 work( i ) = work( i ) + absa
218 90 CONTINUE
219 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
220 100 CONTINUE
221 END IF
222 ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
223*
224* Find normF(A).
225*
226 scale = zero
227 sum = one
228 IF( k.GT.0 ) THEN
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO 110 j = 2, n
231 CALL slassq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
232 $ 1, scale, sum )
233 110 CONTINUE
234 l = k + 1
235 ELSE
236 DO 120 j = 1, n - 1
237 CALL slassq( min( n-j, k ), ab( 2, j ), 1, scale,
238 $ sum )
239 120 CONTINUE
240 l = 1
241 END IF
242 sum = 2*sum
243 ELSE
244 l = 1
245 END IF
246 CALL slassq( n, ab( l, 1 ), ldab, scale, sum )
247 VALUE = scale*sqrt( sum )
248 END IF
249*
250 slansb = VALUE
251 RETURN
252*
253* End of SLANSB
254*
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:59
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
subroutine slassq(n, x, incx, scale, sumsq)
SLASSQ updates a sum of squares represented in scaled form.
Definition slassq.f90:124
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: