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

◆ clansb()

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

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

Purpose:
 CLANSB  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
CLANSB
    CLANSB = ( 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 CLANSB 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, CLANSB 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 COMPLEX 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 128 of file clansb.f.

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