LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
clansb.f
Go to the documentation of this file.
1 *> \brief \b CLANSB
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CLANSB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clansb.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clansb.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clansb.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * REAL FUNCTION CLANSB( NORM, UPLO, N, K, AB, LDAB,
22 * WORK )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER NORM, UPLO
26 * INTEGER K, LDAB, N
27 * ..
28 * .. Array Arguments ..
29 * REAL WORK( * )
30 * COMPLEX AB( LDAB, * )
31 * ..
32 *
33 *
34 *> \par Purpose:
35 * =============
36 *>
37 *> \verbatim
38 *>
39 *> CLANSB returns the value of the one norm, or the Frobenius norm, or
40 *> the infinity norm, or the element of largest absolute value of an
41 *> n by n symmetric band matrix A, with k super-diagonals.
42 *> \endverbatim
43 *>
44 *> \return CLANSB
45 *> \verbatim
46 *>
47 *> CLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
48 *> (
49 *> ( norm1(A), NORM = '1', 'O' or 'o'
50 *> (
51 *> ( normI(A), NORM = 'I' or 'i'
52 *> (
53 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
54 *>
55 *> where norm1 denotes the one norm of a matrix (maximum column sum),
56 *> normI denotes the infinity norm of a matrix (maximum row sum) and
57 *> normF denotes the Frobenius norm of a matrix (square root of sum of
58 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
59 *> \endverbatim
60 *
61 * Arguments:
62 * ==========
63 *
64 *> \param[in] NORM
65 *> \verbatim
66 *> NORM is CHARACTER*1
67 *> Specifies the value to be returned in CLANSB as described
68 *> above.
69 *> \endverbatim
70 *>
71 *> \param[in] UPLO
72 *> \verbatim
73 *> UPLO is CHARACTER*1
74 *> Specifies whether the upper or lower triangular part of the
75 *> band matrix A is supplied.
76 *> = 'U': Upper triangular part is supplied
77 *> = 'L': Lower triangular part is supplied
78 *> \endverbatim
79 *>
80 *> \param[in] N
81 *> \verbatim
82 *> N is INTEGER
83 *> The order of the matrix A. N >= 0. When N = 0, CLANSB is
84 *> set to zero.
85 *> \endverbatim
86 *>
87 *> \param[in] K
88 *> \verbatim
89 *> K is INTEGER
90 *> The number of super-diagonals or sub-diagonals of the
91 *> band matrix A. K >= 0.
92 *> \endverbatim
93 *>
94 *> \param[in] AB
95 *> \verbatim
96 *> AB is COMPLEX array, dimension (LDAB,N)
97 *> The upper or lower triangle of the symmetric band matrix A,
98 *> stored in the first K+1 rows of AB. The j-th column of A is
99 *> stored in the j-th column of the array AB as follows:
100 *> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
101 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
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 *> \date November 2011
126 *
127 *> \ingroup complexOTHERauxiliary
128 *
129 * =====================================================================
130  REAL FUNCTION clansb( NORM, UPLO, N, K, AB, LDAB,
131  $ work )
132 *
133 * -- LAPACK auxiliary routine (version 3.4.0) --
134 * -- LAPACK is a software package provided by Univ. of Tennessee, --
135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
136 * November 2011
137 *
138 * .. Scalar Arguments ..
139  CHARACTER norm, uplo
140  INTEGER k, ldab, n
141 * ..
142 * .. Array Arguments ..
143  REAL work( * )
144  COMPLEX ab( ldab, * )
145 * ..
146 *
147 * =====================================================================
148 *
149 * .. Parameters ..
150  REAL one, zero
151  parameter( one = 1.0e+0, zero = 0.0e+0 )
152 * ..
153 * .. Local Scalars ..
154  INTEGER i, j, l
155  REAL absa, scale, sum, value
156 * ..
157 * .. External Functions ..
158  LOGICAL lsame
159  EXTERNAL lsame
160 * ..
161 * .. External Subroutines ..
162  EXTERNAL classq
163 * ..
164 * .. Intrinsic Functions ..
165  INTRINSIC abs, max, min, sqrt
166 * ..
167 * .. Executable Statements ..
168 *
169  IF( n.EQ.0 ) THEN
170  value = zero
171  ELSE IF( lsame( norm, 'M' ) ) THEN
172 *
173 * Find max(abs(A(i,j))).
174 *
175  value = zero
176  IF( lsame( uplo, 'U' ) ) THEN
177  DO 20 j = 1, n
178  DO 10 i = max( k+2-j, 1 ), k + 1
179  value = max( value, abs( ab( i, j ) ) )
180  10 CONTINUE
181  20 CONTINUE
182  ELSE
183  DO 40 j = 1, n
184  DO 30 i = 1, min( n+1-j, k+1 )
185  value = max( value, abs( ab( i, j ) ) )
186  30 CONTINUE
187  40 CONTINUE
188  END IF
189  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
190  $ ( norm.EQ.'1' ) ) THEN
191 *
192 * Find normI(A) ( = norm1(A), since A is symmetric).
193 *
194  value = zero
195  IF( lsame( uplo, 'U' ) ) THEN
196  DO 60 j = 1, n
197  sum = zero
198  l = k + 1 - j
199  DO 50 i = max( 1, j-k ), j - 1
200  absa = abs( ab( l+i, j ) )
201  sum = sum + absa
202  work( i ) = work( i ) + absa
203  50 CONTINUE
204  work( j ) = sum + abs( ab( k+1, j ) )
205  60 CONTINUE
206  DO 70 i = 1, n
207  value = max( value, work( i ) )
208  70 CONTINUE
209  ELSE
210  DO 80 i = 1, n
211  work( i ) = zero
212  80 CONTINUE
213  DO 100 j = 1, n
214  sum = work( j ) + abs( ab( 1, j ) )
215  l = 1 - j
216  DO 90 i = j + 1, min( n, j+k )
217  absa = abs( ab( l+i, j ) )
218  sum = sum + absa
219  work( i ) = work( i ) + absa
220  90 CONTINUE
221  value = max( value, sum )
222  100 CONTINUE
223  END IF
224  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( 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 ), j ),
234  $ 1, scale, sum )
235  110 CONTINUE
236  l = k + 1
237  ELSE
238  DO 120 j = 1, n - 1
239  CALL classq( min( n-j, k ), ab( 2, j ), 1, scale,
240  $ sum )
241  120 CONTINUE
242  l = 1
243  END IF
244  sum = 2*sum
245  ELSE
246  l = 1
247  END IF
248  CALL classq( n, ab( l, 1 ), ldab, scale, sum )
249  value = scale*sqrt( sum )
250  END IF
251 *
252  clansb = value
253  RETURN
254 *
255 * End of CLANSB
256 *
257  END