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

◆ 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.

Definition at line 130 of file clanhb.f.

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