LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

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