LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlansb.f
Go to the documentation of this file.
1*> \brief \b DLANSB 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 DLANSB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlansb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlansb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlansb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION DLANSB( 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* DOUBLE PRECISION AB( LDAB, * ), WORK( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> DLANSB returns the value of the one norm, or the Frobenius norm, or
37*> the infinity norm, or the element of largest absolute value of an
38*> n by n symmetric band matrix A, with k super-diagonals.
39*> \endverbatim
40*>
41*> \return DLANSB
42*> \verbatim
43*>
44*> DLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
45*> (
46*> ( norm1(A), NORM = '1', 'O' or 'o'
47*> (
48*> ( normI(A), NORM = 'I' or 'i'
49*> (
50*> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
51*>
52*> where norm1 denotes the one norm of a matrix (maximum column sum),
53*> normI denotes the infinity norm of a matrix (maximum row sum) and
54*> normF denotes the Frobenius norm of a matrix (square root of sum of
55*> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
56*> \endverbatim
57*
58* Arguments:
59* ==========
60*
61*> \param[in] NORM
62*> \verbatim
63*> NORM is CHARACTER*1
64*> Specifies the value to be returned in DLANSB as described
65*> above.
66*> \endverbatim
67*>
68*> \param[in] UPLO
69*> \verbatim
70*> UPLO is CHARACTER*1
71*> Specifies whether the upper or lower triangular part of the
72*> band matrix A is supplied.
73*> = 'U': Upper triangular part is supplied
74*> = 'L': Lower triangular part is supplied
75*> \endverbatim
76*>
77*> \param[in] N
78*> \verbatim
79*> N is INTEGER
80*> The order of the matrix A. N >= 0. When N = 0, DLANSB is
81*> set to zero.
82*> \endverbatim
83*>
84*> \param[in] K
85*> \verbatim
86*> K is INTEGER
87*> The number of super-diagonals or sub-diagonals of the
88*> band matrix A. K >= 0.
89*> \endverbatim
90*>
91*> \param[in] AB
92*> \verbatim
93*> AB is DOUBLE PRECISION array, dimension (LDAB,N)
94*> The upper or lower triangle of the symmetric band matrix A,
95*> stored in the first K+1 rows of AB. The j-th column of A is
96*> stored in the j-th column of the array AB as follows:
97*> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
98*> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
99*> \endverbatim
100*>
101*> \param[in] LDAB
102*> \verbatim
103*> LDAB is INTEGER
104*> The leading dimension of the array AB. LDAB >= K+1.
105*> \endverbatim
106*>
107*> \param[out] WORK
108*> \verbatim
109*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
110*> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
111*> WORK is not referenced.
112*> \endverbatim
113*
114* Authors:
115* ========
116*
117*> \author Univ. of Tennessee
118*> \author Univ. of California Berkeley
119*> \author Univ. of Colorado Denver
120*> \author NAG Ltd.
121*
122*> \ingroup lanhb
123*
124* =====================================================================
125 DOUBLE PRECISION FUNCTION dlansb( NORM, UPLO, N, K, AB, LDAB,
126 $ WORK )
127*
128* -- LAPACK auxiliary routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 CHARACTER norm, uplo
134 INTEGER k, ldab, n
135* ..
136* .. Array Arguments ..
137 DOUBLE PRECISION ab( ldab, * ), work( * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 DOUBLE PRECISION one, zero
144 parameter( one = 1.0d+0, zero = 0.0d+0 )
145* ..
146* .. Local Scalars ..
147 INTEGER i, j, l
148 DOUBLE PRECISION absa, scale, sum, value
149* ..
150* .. External Subroutines ..
151 EXTERNAL dlassq
152* ..
153* .. External Functions ..
154 LOGICAL lsame, disnan
155 EXTERNAL lsame, disnan
156* ..
157* .. Intrinsic Functions ..
158 INTRINSIC abs, max, min, sqrt
159* ..
160* .. Executable Statements ..
161*
162 IF( n.EQ.0 ) THEN
163 VALUE = zero
164 ELSE IF( lsame( norm, 'M' ) ) THEN
165*
166* Find max(abs(A(i,j))).
167*
168 VALUE = zero
169 IF( lsame( uplo, 'U' ) ) THEN
170 DO 20 j = 1, n
171 DO 10 i = max( k+2-j, 1 ), k + 1
172 sum = abs( ab( i, j ) )
173 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
174 10 CONTINUE
175 20 CONTINUE
176 ELSE
177 DO 40 j = 1, n
178 DO 30 i = 1, min( n+1-j, k+1 )
179 sum = abs( ab( i, j ) )
180 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
181 30 CONTINUE
182 40 CONTINUE
183 END IF
184 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
185 $ ( lsame( norm, 'O' ) ) .OR.
186 $ ( norm.EQ.'1' ) ) THEN
187*
188* Find normI(A) ( = norm1(A), since A is symmetric).
189*
190 VALUE = zero
191 IF( lsame( uplo, 'U' ) ) THEN
192 DO 60 j = 1, n
193 sum = zero
194 l = k + 1 - j
195 DO 50 i = max( 1, j-k ), j - 1
196 absa = abs( ab( l+i, j ) )
197 sum = sum + absa
198 work( i ) = work( i ) + absa
199 50 CONTINUE
200 work( j ) = sum + abs( ab( k+1, j ) )
201 60 CONTINUE
202 DO 70 i = 1, n
203 sum = work( i )
204 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
205 70 CONTINUE
206 ELSE
207 DO 80 i = 1, n
208 work( i ) = zero
209 80 CONTINUE
210 DO 100 j = 1, n
211 sum = work( j ) + abs( ab( 1, j ) )
212 l = 1 - j
213 DO 90 i = j + 1, min( n, j+k )
214 absa = abs( ab( l+i, j ) )
215 sum = sum + absa
216 work( i ) = work( i ) + absa
217 90 CONTINUE
218 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
219 100 CONTINUE
220 END IF
221 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
222 $ ( lsame( norm, 'E' ) ) ) THEN
223*
224* Find normF(A).
225*
226 scale = zero
227 sum = one
228 IF( k.GT.0 ) THEN
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO 110 j = 2, n
231 CALL dlassq( min( j-1, k ), ab( max( k+2-j, 1 ),
232 $ j ),
233 $ 1, scale, sum )
234 110 CONTINUE
235 l = k + 1
236 ELSE
237 DO 120 j = 1, n - 1
238 CALL dlassq( min( n-j, k ), ab( 2, j ), 1, scale,
239 $ sum )
240 120 CONTINUE
241 l = 1
242 END IF
243 sum = 2*sum
244 ELSE
245 l = 1
246 END IF
247 CALL dlassq( n, ab( l, 1 ), ldab, scale, sum )
248 VALUE = scale*sqrt( sum )
249 END IF
250*
251 dlansb = VALUE
252 RETURN
253*
254* End of DLANSB
255*
256 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function dlansb(norm, uplo, n, k, ab, ldab, work)
DLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlansb.f:127
subroutine dlassq(n, x, incx, scale, sumsq)
DLASSQ updates a sum of squares represented in scaled form.
Definition dlassq.f90:122
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48