LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
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 *> \htmlonly
9 *> Download CLANGB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clangb.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clangb.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clangb.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * REAL FUNCTION CLANGB( NORM, N, KL, KU, AB, LDAB,
22 * WORK )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER NORM
26 * INTEGER KL, KU, 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 *> CLANGB 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 band matrix A, with kl sub-diagonals and ku super-diagonals.
42 *> \endverbatim
43 *>
44 *> \return CLANGB
45 *> \verbatim
46 *>
47 *> CLANGB = ( 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 CLANGB as described
68 *> above.
69 *> \endverbatim
70 *>
71 *> \param[in] N
72 *> \verbatim
73 *> N is INTEGER
74 *> The order of the matrix A. N >= 0. When N = 0, CLANGB is
75 *> set to zero.
76 *> \endverbatim
77 *>
78 *> \param[in] KL
79 *> \verbatim
80 *> KL is INTEGER
81 *> The number of sub-diagonals of the matrix A. KL >= 0.
82 *> \endverbatim
83 *>
84 *> \param[in] KU
85 *> \verbatim
86 *> KU is INTEGER
87 *> The number of super-diagonals of the matrix A. KU >= 0.
88 *> \endverbatim
89 *>
90 *> \param[in] AB
91 *> \verbatim
92 *> AB is COMPLEX array, dimension (LDAB,N)
93 *> The band matrix A, stored in rows 1 to KL+KU+1. The j-th
94 *> column of A is stored in the j-th column of the array AB as
95 *> follows:
96 *> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
97 *> \endverbatim
98 *>
99 *> \param[in] LDAB
100 *> \verbatim
101 *> LDAB is INTEGER
102 *> The leading dimension of the array AB. LDAB >= KL+KU+1.
103 *> \endverbatim
104 *>
105 *> \param[out] WORK
106 *> \verbatim
107 *> WORK is REAL array, dimension (MAX(1,LWORK)),
108 *> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
109 *> referenced.
110 *> \endverbatim
111 *
112 * Authors:
113 * ========
114 *
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
118 *> \author NAG Ltd.
119 *
120 *> \date September 2012
121 *
122 *> \ingroup complexGBauxiliary
123 *
124 * =====================================================================
125  REAL FUNCTION clangb( NORM, N, KL, KU, AB, LDAB,
126  $ work )
127 *
128 * -- LAPACK auxiliary routine (version 3.4.2) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * September 2012
132 *
133 * .. Scalar Arguments ..
134  CHARACTER norm
135  INTEGER kl, ku, 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, k, l
150  REAL scale, sum, value, temp
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  DO 20 j = 1, n
172  DO 10 i = max( ku+2-j, 1 ), min( n+ku+1-j, kl+ku+1 )
173  temp = abs( ab( i, j ) )
174  IF( value.LT.temp .OR. sisnan( temp ) ) value = temp
175  10 continue
176  20 continue
177  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
178 *
179 * Find norm1(A).
180 *
181  value = zero
182  DO 40 j = 1, n
183  sum = zero
184  DO 30 i = max( ku+2-j, 1 ), min( n+ku+1-j, kl+ku+1 )
185  sum = sum + abs( ab( i, j ) )
186  30 continue
187  IF( value.LT.sum .OR. sisnan( sum ) ) value = sum
188  40 continue
189  ELSE IF( lsame( norm, 'I' ) ) THEN
190 *
191 * Find normI(A).
192 *
193  DO 50 i = 1, n
194  work( i ) = zero
195  50 continue
196  DO 70 j = 1, n
197  k = ku + 1 - j
198  DO 60 i = max( 1, j-ku ), min( n, j+kl )
199  work( i ) = work( i ) + abs( ab( k+i, j ) )
200  60 continue
201  70 continue
202  value = zero
203  DO 80 i = 1, n
204  temp = work( i )
205  IF( value.LT.temp .OR. sisnan( temp ) ) value = temp
206  80 continue
207  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
208 *
209 * Find normF(A).
210 *
211  scale = zero
212  sum = one
213  DO 90 j = 1, n
214  l = max( 1, j-ku )
215  k = ku + 1 - j + l
216  CALL classq( min( n, j+kl )-l+1, ab( k, j ), 1, scale, sum )
217  90 continue
218  value = scale*sqrt( sum )
219  END IF
220 *
221  clangb = value
222  return
223 *
224 * End of CLANGB
225 *
226  END