LAPACK 3.12.1
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 128 of file clanhb.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, real, 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
176 sum = abs( ab( i, j ) )
177 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
178 10 CONTINUE
179 sum = abs( real( ab( k+1, j ) ) )
180 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
181 20 CONTINUE
182 ELSE
183 DO 40 j = 1, n
184 sum = abs( real( ab( 1, j ) ) )
185 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
186 DO 30 i = 2, 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.
193 $ ( lsame( norm, 'O' ) ) .OR.
194 $ ( norm.EQ.'1' ) ) THEN
195*
196* Find normI(A) ( = norm1(A), since A is hermitian).
197*
198 VALUE = zero
199 IF( lsame( uplo, 'U' ) ) THEN
200 DO 60 j = 1, n
201 sum = zero
202 l = k + 1 - j
203 DO 50 i = max( 1, j-k ), j - 1
204 absa = abs( ab( l+i, j ) )
205 sum = sum + absa
206 work( i ) = work( i ) + absa
207 50 CONTINUE
208 work( j ) = sum + abs( real( ab( k+1, j ) ) )
209 60 CONTINUE
210 DO 70 i = 1, n
211 sum = work( i )
212 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
213 70 CONTINUE
214 ELSE
215 DO 80 i = 1, n
216 work( i ) = zero
217 80 CONTINUE
218 DO 100 j = 1, n
219 sum = work( j ) + abs( real( ab( 1, j ) ) )
220 l = 1 - j
221 DO 90 i = j + 1, min( n, j+k )
222 absa = abs( ab( l+i, j ) )
223 sum = sum + absa
224 work( i ) = work( i ) + absa
225 90 CONTINUE
226 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
227 100 CONTINUE
228 END IF
229 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
230 $ ( 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 ),
240 $ j ),
241 $ 1, scale, sum )
242 110 CONTINUE
243 l = k + 1
244 ELSE
245 DO 120 j = 1, n - 1
246 CALL classq( min( n-j, k ), ab( 2, j ), 1, scale,
247 $ sum )
248 120 CONTINUE
249 l = 1
250 END IF
251 sum = 2*sum
252 ELSE
253 l = 1
254 END IF
255 DO 130 j = 1, n
256 IF( real( ab( l, j ) ).NE.zero ) THEN
257 absa = abs( real( ab( l, j ) ) )
258 IF( scale.LT.absa ) THEN
259 sum = one + sum*( scale / absa )**2
260 scale = absa
261 ELSE
262 sum = sum + ( absa / scale )**2
263 END IF
264 END IF
265 130 CONTINUE
266 VALUE = scale*sqrt( sum )
267 END IF
268*
269 clanhb = VALUE
270 RETURN
271*
272* End of CLANHB
273*
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:57
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:130
subroutine classq(n, x, incx, scale, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition classq.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: