LAPACK 3.12.1
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 125 of file slansb.f.

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