LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
clanhb.f
Go to the documentation of this file.
1*> \brief \b 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.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLANHB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clanhb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clanhb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clanhb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* REAL FUNCTION CLANHB( NORM, UPLO, N, K, AB, LDAB,
20* WORK )
21*
22* .. Scalar Arguments ..
23* CHARACTER NORM, UPLO
24* INTEGER K, LDAB, N
25* ..
26* .. Array Arguments ..
27* REAL WORK( * )
28* COMPLEX AB( LDAB, * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> CLANHB returns the value of the one norm, or the Frobenius norm, or
38*> the infinity norm, or the element of largest absolute value of an
39*> n by n hermitian band matrix A, with k super-diagonals.
40*> \endverbatim
41*>
42*> \return CLANHB
43*> \verbatim
44*>
45*> CLANHB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
46*> (
47*> ( norm1(A), NORM = '1', 'O' or 'o'
48*> (
49*> ( normI(A), NORM = 'I' or 'i'
50*> (
51*> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
52*>
53*> where norm1 denotes the one norm of a matrix (maximum column sum),
54*> normI denotes the infinity norm of a matrix (maximum row sum) and
55*> normF denotes the Frobenius norm of a matrix (square root of sum of
56*> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
57*> \endverbatim
58*
59* Arguments:
60* ==========
61*
62*> \param[in] NORM
63*> \verbatim
64*> NORM is CHARACTER*1
65*> Specifies the value to be returned in CLANHB as described
66*> above.
67*> \endverbatim
68*>
69*> \param[in] UPLO
70*> \verbatim
71*> UPLO is CHARACTER*1
72*> Specifies whether the upper or lower triangular part of the
73*> band matrix A is supplied.
74*> = 'U': Upper triangular
75*> = 'L': Lower triangular
76*> \endverbatim
77*>
78*> \param[in] N
79*> \verbatim
80*> N is INTEGER
81*> The order of the matrix A. N >= 0. When N = 0, CLANHB is
82*> set to zero.
83*> \endverbatim
84*>
85*> \param[in] K
86*> \verbatim
87*> K is INTEGER
88*> The number of super-diagonals or sub-diagonals of the
89*> band matrix A. K >= 0.
90*> \endverbatim
91*>
92*> \param[in] AB
93*> \verbatim
94*> AB is COMPLEX array, dimension (LDAB,N)
95*> The upper or lower triangle of the hermitian band matrix A,
96*> stored in the first K+1 rows of AB. The j-th column of A is
97*> stored in the j-th column of the array AB as follows:
98*> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
99*> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
100*> Note that the imaginary parts of the diagonal elements need
101*> not be set and are assumed to be zero.
102*> \endverbatim
103*>
104*> \param[in] LDAB
105*> \verbatim
106*> LDAB is INTEGER
107*> The leading dimension of the array AB. LDAB >= K+1.
108*> \endverbatim
109*>
110*> \param[out] WORK
111*> \verbatim
112*> WORK is REAL array, dimension (MAX(1,LWORK)),
113*> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
114*> WORK is not referenced.
115*> \endverbatim
116*
117* Authors:
118* ========
119*
120*> \author Univ. of Tennessee
121*> \author Univ. of California Berkeley
122*> \author Univ. of Colorado Denver
123*> \author NAG Ltd.
124*
125*> \ingroup lanhb
126*
127* =====================================================================
128 REAL function clanhb( norm, uplo, n, k, ab, ldab,
129 $ work )
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*
274 END
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