LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
clansb.f
Go to the documentation of this file.
1*> \brief \b CLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLANSB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clansb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clansb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clansb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* REAL FUNCTION CLANSB( 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*> CLANSB 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 symmetric band matrix A, with k super-diagonals.
40*> \endverbatim
41*>
42*> \return CLANSB
43*> \verbatim
44*>
45*> CLANSB = ( 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 CLANSB 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 part is supplied
75*> = 'L': Lower triangular part is supplied
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, CLANSB 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 symmetric 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*> \endverbatim
101*>
102*> \param[in] LDAB
103*> \verbatim
104*> LDAB is INTEGER
105*> The leading dimension of the array AB. LDAB >= K+1.
106*> \endverbatim
107*>
108*> \param[out] WORK
109*> \verbatim
110*> WORK is REAL array, dimension (MAX(1,LWORK)),
111*> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
112*> WORK is not referenced.
113*> \endverbatim
114*
115* Authors:
116* ========
117*
118*> \author Univ. of Tennessee
119*> \author Univ. of California Berkeley
120*> \author Univ. of Colorado Denver
121*> \author NAG Ltd.
122*
123*> \ingroup lanhb
124*
125* =====================================================================
126 REAL function clansb( norm, uplo, n, k, ab, ldab,
127 $ work )
128*
129* -- LAPACK auxiliary routine --
130* -- LAPACK is a software package provided by Univ. of Tennessee, --
131* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132*
133* .. Scalar Arguments ..
134 CHARACTER norm, uplo
135 INTEGER k, ldab, n
136* ..
137* .. Array Arguments ..
138 REAL work( * )
139 COMPLEX ab( ldab, * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 REAL one, zero
146 parameter( one = 1.0e+0, zero = 0.0e+0 )
147* ..
148* .. Local Scalars ..
149 INTEGER i, j, l
150 REAL absa, scale, sum, value
151* ..
152* .. External Functions ..
153 LOGICAL lsame, sisnan
154 EXTERNAL lsame, sisnan
155* ..
156* .. External Subroutines ..
157 EXTERNAL classq
158* ..
159* .. Intrinsic Functions ..
160 INTRINSIC abs, max, min, sqrt
161* ..
162* .. Executable Statements ..
163*
164 IF( n.EQ.0 ) THEN
165 VALUE = zero
166 ELSE IF( lsame( norm, 'M' ) ) THEN
167*
168* Find max(abs(A(i,j))).
169*
170 VALUE = zero
171 IF( lsame( uplo, 'U' ) ) THEN
172 DO 20 j = 1, n
173 DO 10 i = max( k+2-j, 1 ), k + 1
174 sum = abs( ab( i, j ) )
175 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
176 10 CONTINUE
177 20 CONTINUE
178 ELSE
179 DO 40 j = 1, n
180 DO 30 i = 1, min( n+1-j, k+1 )
181 sum = abs( ab( i, j ) )
182 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
183 30 CONTINUE
184 40 CONTINUE
185 END IF
186 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
187 $ ( lsame( norm, 'O' ) ) .OR.
188 $ ( norm.EQ.'1' ) ) THEN
189*
190* Find normI(A) ( = norm1(A), since A is symmetric).
191*
192 VALUE = zero
193 IF( lsame( uplo, 'U' ) ) THEN
194 DO 60 j = 1, n
195 sum = zero
196 l = k + 1 - j
197 DO 50 i = max( 1, j-k ), j - 1
198 absa = abs( ab( l+i, j ) )
199 sum = sum + absa
200 work( i ) = work( i ) + absa
201 50 CONTINUE
202 work( j ) = sum + abs( ab( k+1, j ) )
203 60 CONTINUE
204 DO 70 i = 1, n
205 sum = work( i )
206 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
207 70 CONTINUE
208 ELSE
209 DO 80 i = 1, n
210 work( i ) = zero
211 80 CONTINUE
212 DO 100 j = 1, n
213 sum = work( j ) + abs( ab( 1, j ) )
214 l = 1 - j
215 DO 90 i = j + 1, min( n, j+k )
216 absa = abs( ab( l+i, j ) )
217 sum = sum + absa
218 work( i ) = work( i ) + absa
219 90 CONTINUE
220 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
221 100 CONTINUE
222 END IF
223 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
224 $ ( lsame( norm, 'E' ) ) ) THEN
225*
226* Find normF(A).
227*
228 scale = zero
229 sum = one
230 IF( k.GT.0 ) THEN
231 IF( lsame( uplo, 'U' ) ) THEN
232 DO 110 j = 2, n
233 CALL classq( min( j-1, k ), ab( max( k+2-j, 1 ),
234 $ j ),
235 $ 1, scale, sum )
236 110 CONTINUE
237 l = k + 1
238 ELSE
239 DO 120 j = 1, n - 1
240 CALL classq( min( n-j, k ), ab( 2, j ), 1, scale,
241 $ sum )
242 120 CONTINUE
243 l = 1
244 END IF
245 sum = 2*sum
246 ELSE
247 l = 1
248 END IF
249 CALL classq( n, ab( l, 1 ), ldab, scale, sum )
250 VALUE = scale*sqrt( sum )
251 END IF
252*
253 clansb = VALUE
254 RETURN
255*
256* End of CLANSB
257*
258 END
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:57
real function clansb(norm, uplo, n, k, ab, ldab, work)
CLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clansb.f:128
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