LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
clangb.f
Go to the documentation of this file.
1*> \brief \b CLANGB returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of general band matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLANGB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clangb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clangb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clangb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* REAL FUNCTION CLANGB( NORM, N, KL, KU, AB, LDAB,
20* WORK )
21*
22* .. Scalar Arguments ..
23* CHARACTER NORM
24* INTEGER KL, KU, 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*> CLANGB 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 band matrix A, with kl sub-diagonals and ku super-diagonals.
40*> \endverbatim
41*>
42*> \return CLANGB
43*> \verbatim
44*>
45*> CLANGB = ( 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 CLANGB as described
66*> above.
67*> \endverbatim
68*>
69*> \param[in] N
70*> \verbatim
71*> N is INTEGER
72*> The order of the matrix A. N >= 0. When N = 0, CLANGB is
73*> set to zero.
74*> \endverbatim
75*>
76*> \param[in] KL
77*> \verbatim
78*> KL is INTEGER
79*> The number of sub-diagonals of the matrix A. KL >= 0.
80*> \endverbatim
81*>
82*> \param[in] KU
83*> \verbatim
84*> KU is INTEGER
85*> The number of super-diagonals of the matrix A. KU >= 0.
86*> \endverbatim
87*>
88*> \param[in] AB
89*> \verbatim
90*> AB is COMPLEX array, dimension (LDAB,N)
91*> The band matrix A, stored in rows 1 to KL+KU+1. The j-th
92*> column of A is stored in the j-th column of the array AB as
93*> follows:
94*> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
95*> \endverbatim
96*>
97*> \param[in] LDAB
98*> \verbatim
99*> LDAB is INTEGER
100*> The leading dimension of the array AB. LDAB >= KL+KU+1.
101*> \endverbatim
102*>
103*> \param[out] WORK
104*> \verbatim
105*> WORK is REAL array, dimension (MAX(1,LWORK)),
106*> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
107*> referenced.
108*> \endverbatim
109*
110* Authors:
111* ========
112*
113*> \author Univ. of Tennessee
114*> \author Univ. of California Berkeley
115*> \author Univ. of Colorado Denver
116*> \author NAG Ltd.
117*
118*> \ingroup langb
119*
120* =====================================================================
121 REAL function clangb( norm, n, kl, ku, ab, ldab,
122 $ work )
123*
124* -- LAPACK auxiliary routine --
125* -- LAPACK is a software package provided by Univ. of Tennessee, --
126* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127*
128* .. Scalar Arguments ..
129 CHARACTER norm
130 INTEGER kl, ku, ldab, n
131* ..
132* .. Array Arguments ..
133 REAL work( * )
134 COMPLEX ab( ldab, * )
135* ..
136*
137* =====================================================================
138*
139* .. Parameters ..
140 REAL one, zero
141 parameter( one = 1.0e+0, zero = 0.0e+0 )
142* ..
143* .. Local Scalars ..
144 INTEGER i, j, k, l
145 REAL scale, sum, VALUE, temp
146* ..
147* .. External Functions ..
148 LOGICAL lsame, sisnan
149 EXTERNAL lsame, sisnan
150* ..
151* .. External Subroutines ..
152 EXTERNAL classq
153* ..
154* .. Intrinsic Functions ..
155 INTRINSIC abs, max, min, sqrt
156* ..
157* .. Executable Statements ..
158*
159 IF( n.EQ.0 ) THEN
160 VALUE = zero
161 ELSE IF( lsame( norm, 'M' ) ) THEN
162*
163* Find max(abs(A(i,j))).
164*
165 VALUE = zero
166 DO 20 j = 1, n
167 DO 10 i = max( ku+2-j, 1 ), min( n+ku+1-j, kl+ku+1 )
168 temp = abs( ab( i, j ) )
169 IF( VALUE.LT.temp .OR. sisnan( temp ) ) VALUE = temp
170 10 CONTINUE
171 20 CONTINUE
172 ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
173*
174* Find norm1(A).
175*
176 VALUE = zero
177 DO 40 j = 1, n
178 sum = zero
179 DO 30 i = max( ku+2-j, 1 ), min( n+ku+1-j, kl+ku+1 )
180 sum = sum + abs( ab( i, j ) )
181 30 CONTINUE
182 IF( VALUE.LT.sum .OR. sisnan( sum ) ) VALUE = sum
183 40 CONTINUE
184 ELSE IF( lsame( norm, 'I' ) ) THEN
185*
186* Find normI(A).
187*
188 DO 50 i = 1, n
189 work( i ) = zero
190 50 CONTINUE
191 DO 70 j = 1, n
192 k = ku + 1 - j
193 DO 60 i = max( 1, j-ku ), min( n, j+kl )
194 work( i ) = work( i ) + abs( ab( k+i, j ) )
195 60 CONTINUE
196 70 CONTINUE
197 VALUE = zero
198 DO 80 i = 1, n
199 temp = work( i )
200 IF( VALUE.LT.temp .OR. sisnan( temp ) ) VALUE = temp
201 80 CONTINUE
202 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
203 $ ( lsame( norm, 'E' ) ) ) THEN
204*
205* Find normF(A).
206*
207 scale = zero
208 sum = one
209 DO 90 j = 1, n
210 l = max( 1, j-ku )
211 k = ku + 1 - j + l
212 CALL classq( min( n, j+kl )-l+1, ab( k, j ), 1, scale,
213 $ sum )
214 90 CONTINUE
215 VALUE = scale*sqrt( sum )
216 END IF
217*
218 clangb = VALUE
219 RETURN
220*
221* End of CLANGB
222*
223 END
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:57
real function clangb(norm, n, kl, ku, ab, ldab, work)
CLANGB returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition clangb.f:123
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