LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
cpbcon.f
Go to the documentation of this file.
1 *> \brief \b CPBCON
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CPBCON + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpbcon.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpbcon.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpbcon.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE CPBCON( UPLO, N, KD, AB, LDAB, ANORM, RCOND, WORK,
22 * RWORK, INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER UPLO
26 * INTEGER INFO, KD, LDAB, N
27 * REAL ANORM, RCOND
28 * ..
29 * .. Array Arguments ..
30 * REAL RWORK( * )
31 * COMPLEX AB( LDAB, * ), WORK( * )
32 * ..
33 *
34 *
35 *> \par Purpose:
36 * =============
37 *>
38 *> \verbatim
39 *>
40 *> CPBCON estimates the reciprocal of the condition number (in the
41 *> 1-norm) of a complex Hermitian positive definite band matrix using
42 *> the Cholesky factorization A = U**H*U or A = L*L**H computed by
43 *> CPBTRF.
44 *>
45 *> An estimate is obtained for norm(inv(A)), and the reciprocal of the
46 *> condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] UPLO
53 *> \verbatim
54 *> UPLO is CHARACTER*1
55 *> = 'U': Upper triangular factor stored in AB;
56 *> = 'L': Lower triangular factor stored in AB.
57 *> \endverbatim
58 *>
59 *> \param[in] N
60 *> \verbatim
61 *> N is INTEGER
62 *> The order of the matrix A. N >= 0.
63 *> \endverbatim
64 *>
65 *> \param[in] KD
66 *> \verbatim
67 *> KD is INTEGER
68 *> The number of superdiagonals of the matrix A if UPLO = 'U',
69 *> or the number of sub-diagonals if UPLO = 'L'. KD >= 0.
70 *> \endverbatim
71 *>
72 *> \param[in] AB
73 *> \verbatim
74 *> AB is COMPLEX array, dimension (LDAB,N)
75 *> The triangular factor U or L from the Cholesky factorization
76 *> A = U**H*U or A = L*L**H of the band matrix A, stored in the
77 *> first KD+1 rows of the array. The j-th column of U or L is
78 *> stored in the j-th column of the array AB as follows:
79 *> if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j;
80 *> if UPLO ='L', AB(1+i-j,j) = L(i,j) for j<=i<=min(n,j+kd).
81 *> \endverbatim
82 *>
83 *> \param[in] LDAB
84 *> \verbatim
85 *> LDAB is INTEGER
86 *> The leading dimension of the array AB. LDAB >= KD+1.
87 *> \endverbatim
88 *>
89 *> \param[in] ANORM
90 *> \verbatim
91 *> ANORM is REAL
92 *> The 1-norm (or infinity-norm) of the Hermitian band matrix A.
93 *> \endverbatim
94 *>
95 *> \param[out] RCOND
96 *> \verbatim
97 *> RCOND is REAL
98 *> The reciprocal of the condition number of the matrix A,
99 *> computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
100 *> estimate of the 1-norm of inv(A) computed in this routine.
101 *> \endverbatim
102 *>
103 *> \param[out] WORK
104 *> \verbatim
105 *> WORK is COMPLEX array, dimension (2*N)
106 *> \endverbatim
107 *>
108 *> \param[out] RWORK
109 *> \verbatim
110 *> RWORK is REAL array, dimension (N)
111 *> \endverbatim
112 *>
113 *> \param[out] INFO
114 *> \verbatim
115 *> INFO is INTEGER
116 *> = 0: successful exit
117 *> < 0: if INFO = -i, the i-th argument had an illegal value
118 *> \endverbatim
119 *
120 * Authors:
121 * ========
122 *
123 *> \author Univ. of Tennessee
124 *> \author Univ. of California Berkeley
125 *> \author Univ. of Colorado Denver
126 *> \author NAG Ltd.
127 *
128 *> \date November 2011
129 *
130 *> \ingroup complexOTHERcomputational
131 *
132 * =====================================================================
133  SUBROUTINE cpbcon( UPLO, N, KD, AB, LDAB, ANORM, RCOND, WORK,
134  $ rwork, info )
135 *
136 * -- LAPACK computational routine (version 3.4.0) --
137 * -- LAPACK is a software package provided by Univ. of Tennessee, --
138 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
139 * November 2011
140 *
141 * .. Scalar Arguments ..
142  CHARACTER uplo
143  INTEGER info, kd, ldab, n
144  REAL anorm, rcond
145 * ..
146 * .. Array Arguments ..
147  REAL rwork( * )
148  COMPLEX ab( ldab, * ), work( * )
149 * ..
150 *
151 * =====================================================================
152 *
153 * .. Parameters ..
154  REAL one, zero
155  parameter( one = 1.0e+0, zero = 0.0e+0 )
156 * ..
157 * .. Local Scalars ..
158  LOGICAL upper
159  CHARACTER normin
160  INTEGER ix, kase
161  REAL ainvnm, scale, scalel, scaleu, smlnum
162  COMPLEX zdum
163 * ..
164 * .. Local Arrays ..
165  INTEGER isave( 3 )
166 * ..
167 * .. External Functions ..
168  LOGICAL lsame
169  INTEGER icamax
170  REAL slamch
171  EXTERNAL lsame, icamax, slamch
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL clacn2, clatbs, csrscl, xerbla
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC abs, aimag, real
178 * ..
179 * .. Statement Functions ..
180  REAL cabs1
181 * ..
182 * .. Statement Function definitions ..
183  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
184 * ..
185 * .. Executable Statements ..
186 *
187 * Test the input parameters.
188 *
189  info = 0
190  upper = lsame( uplo, 'U' )
191  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
192  info = -1
193  ELSE IF( n.LT.0 ) THEN
194  info = -2
195  ELSE IF( kd.LT.0 ) THEN
196  info = -3
197  ELSE IF( ldab.LT.kd+1 ) THEN
198  info = -5
199  ELSE IF( anorm.LT.zero ) THEN
200  info = -6
201  END IF
202  IF( info.NE.0 ) THEN
203  CALL xerbla( 'CPBCON', -info )
204  return
205  END IF
206 *
207 * Quick return if possible
208 *
209  rcond = zero
210  IF( n.EQ.0 ) THEN
211  rcond = one
212  return
213  ELSE IF( anorm.EQ.zero ) THEN
214  return
215  END IF
216 *
217  smlnum = slamch( 'Safe minimum' )
218 *
219 * Estimate the 1-norm of the inverse.
220 *
221  kase = 0
222  normin = 'N'
223  10 continue
224  CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
225  IF( kase.NE.0 ) THEN
226  IF( upper ) THEN
227 *
228 * Multiply by inv(U**H).
229 *
230  CALL clatbs( 'Upper', 'Conjugate transpose', 'Non-unit',
231  $ normin, n, kd, ab, ldab, work, scalel, rwork,
232  $ info )
233  normin = 'Y'
234 *
235 * Multiply by inv(U).
236 *
237  CALL clatbs( 'Upper', 'No transpose', 'Non-unit', normin, n,
238  $ kd, ab, ldab, work, scaleu, rwork, info )
239  ELSE
240 *
241 * Multiply by inv(L).
242 *
243  CALL clatbs( 'Lower', 'No transpose', 'Non-unit', normin, n,
244  $ kd, ab, ldab, work, scalel, rwork, info )
245  normin = 'Y'
246 *
247 * Multiply by inv(L**H).
248 *
249  CALL clatbs( 'Lower', 'Conjugate transpose', 'Non-unit',
250  $ normin, n, kd, ab, ldab, work, scaleu, rwork,
251  $ info )
252  END IF
253 *
254 * Multiply by 1/SCALE if doing so will not cause overflow.
255 *
256  scale = scalel*scaleu
257  IF( scale.NE.one ) THEN
258  ix = icamax( n, work, 1 )
259  IF( scale.LT.cabs1( work( ix ) )*smlnum .OR. scale.EQ.zero )
260  $ go to 20
261  CALL csrscl( n, scale, work, 1 )
262  END IF
263  go to 10
264  END IF
265 *
266 * Compute the estimate of the reciprocal condition number.
267 *
268  IF( ainvnm.NE.zero )
269  $ rcond = ( one / ainvnm ) / anorm
270 *
271  20 continue
272 *
273  return
274 *
275 * End of CPBCON
276 *
277  END