LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ clanhb()

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

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

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

Purpose:
 CLANHB  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 hermitian band matrix A,  with k super-diagonals.
Returns
CLANHB
    CLANHB = ( 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 CLANHB 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
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, CLANHB 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 hermitian 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).
          Note that the imaginary parts of the diagonal elements need
          not be set and are assumed to be zero.
[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.
Date
December 2016

Definition at line 134 of file clanhb.f.

134 *
135 * -- LAPACK auxiliary routine (version 3.7.0) --
136 * -- LAPACK is a software package provided by Univ. of Tennessee, --
137 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138 * December 2016
139 *
140  IMPLICIT NONE
141 * .. Scalar Arguments ..
142  CHARACTER NORM, UPLO
143  INTEGER K, LDAB, N
144 * ..
145 * .. Array Arguments ..
146  REAL WORK( * )
147  COMPLEX AB( LDAB, * )
148 * ..
149 *
150 * =====================================================================
151 *
152 * .. Parameters ..
153  REAL ONE, ZERO
154  parameter( one = 1.0e+0, zero = 0.0e+0 )
155 * ..
156 * .. Local Scalars ..
157  INTEGER I, J, L
158  REAL ABSA, SUM, VALUE
159 * ..
160 * .. Local Arrays ..
161  REAL SSQ( 2 ), COLSSQ( 2 )
162 * ..
163 * .. External Functions ..
164  LOGICAL LSAME, SISNAN
165  EXTERNAL lsame, sisnan
166 * ..
167 * .. External Subroutines ..
168  EXTERNAL classq, scombssq
169 * ..
170 * .. Intrinsic Functions ..
171  INTRINSIC abs, max, min, real, sqrt
172 * ..
173 * .. Executable Statements ..
174 *
175  IF( n.EQ.0 ) THEN
176  VALUE = zero
177  ELSE IF( lsame( norm, 'M' ) ) THEN
178 *
179 * Find max(abs(A(i,j))).
180 *
181  VALUE = zero
182  IF( lsame( uplo, 'U' ) ) THEN
183  DO 20 j = 1, n
184  DO 10 i = max( k+2-j, 1 ), k
185  sum = abs( ab( i, j ) )
186  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
187  10 CONTINUE
188  sum = abs( real( ab( k+1, j ) ) )
189  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
190  20 CONTINUE
191  ELSE
192  DO 40 j = 1, n
193  sum = abs( real( ab( 1, j ) ) )
194  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
195  DO 30 i = 2, min( n+1-j, k+1 )
196  sum = abs( ab( i, j ) )
197  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
198  30 CONTINUE
199  40 CONTINUE
200  END IF
201  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
202  $ ( norm.EQ.'1' ) ) THEN
203 *
204 * Find normI(A) ( = norm1(A), since A is hermitian).
205 *
206  VALUE = zero
207  IF( lsame( uplo, 'U' ) ) THEN
208  DO 60 j = 1, n
209  sum = zero
210  l = k + 1 - j
211  DO 50 i = max( 1, j-k ), j - 1
212  absa = abs( ab( l+i, j ) )
213  sum = sum + absa
214  work( i ) = work( i ) + absa
215  50 CONTINUE
216  work( j ) = sum + abs( real( ab( k+1, j ) ) )
217  60 CONTINUE
218  DO 70 i = 1, n
219  sum = work( i )
220  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
221  70 CONTINUE
222  ELSE
223  DO 80 i = 1, n
224  work( i ) = zero
225  80 CONTINUE
226  DO 100 j = 1, n
227  sum = work( j ) + abs( real( ab( 1, j ) ) )
228  l = 1 - j
229  DO 90 i = j + 1, min( n, j+k )
230  absa = abs( ab( l+i, j ) )
231  sum = sum + absa
232  work( i ) = work( i ) + absa
233  90 CONTINUE
234  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
235  100 CONTINUE
236  END IF
237  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
238 *
239 * Find normF(A).
240 * SSQ(1) is scale
241 * SSQ(2) is sum-of-squares
242 * For better accuracy, sum each column separately.
243 *
244  ssq( 1 ) = zero
245  ssq( 2 ) = one
246 *
247 * Sum off-diagonals
248 *
249  IF( k.GT.0 ) THEN
250  IF( lsame( uplo, 'U' ) ) THEN
251  DO 110 j = 2, n
252  colssq( 1 ) = zero
253  colssq( 2 ) = one
254  CALL classq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
255  $ 1, colssq( 1 ), colssq( 2 ) )
256  CALL scombssq( ssq, colssq )
257  110 CONTINUE
258  l = k + 1
259  ELSE
260  DO 120 j = 1, n - 1
261  colssq( 1 ) = zero
262  colssq( 2 ) = one
263  CALL classq( min( n-j, k ), ab( 2, j ), 1,
264  $ colssq( 1 ), colssq( 2 ) )
265  CALL scombssq( ssq, colssq )
266  120 CONTINUE
267  l = 1
268  END IF
269  ssq( 2 ) = 2*ssq( 2 )
270  ELSE
271  l = 1
272  END IF
273 *
274 * Sum diagonal
275 *
276  colssq( 1 ) = zero
277  colssq( 2 ) = one
278  DO 130 j = 1, n
279  IF( real( ab( l, j ) ).NE.zero ) THEN
280  absa = abs( real( ab( l, j ) ) )
281  IF( colssq( 1 ).LT.absa ) THEN
282  colssq( 2 ) = one + colssq(2)*( colssq(1) / absa )**2
283  colssq( 1 ) = absa
284  ELSE
285  colssq( 2 ) = colssq( 2 ) + ( absa / colssq( 1 ) )**2
286  END IF
287  END IF
288  130 CONTINUE
289  CALL scombssq( ssq, colssq )
290  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
291  END IF
292 *
293  clanhb = VALUE
294  RETURN
295 *
296 * End of CLANHB
297 *
Here is the call graph for this function:
classq
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
clanhb
real function clanhb(NORM, UPLO, N, K, AB, LDAB, WORK)
CLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clanhb.f:134
sisnan
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
scombssq
subroutine scombssq(V1, V2)
SCOMBSSQ adds two scaled sum of squares quantities
Definition: scombssq.f:62