LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sgbcon.f
Go to the documentation of this file.
1*> \brief \b SGBCON
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SGBCON + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgbcon.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgbcon.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgbcon.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SGBCON( NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND,
20* WORK, IWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER NORM
24* INTEGER INFO, KL, KU, LDAB, N
25* REAL ANORM, RCOND
26* ..
27* .. Array Arguments ..
28* INTEGER IPIV( * ), IWORK( * )
29* REAL AB( LDAB, * ), WORK( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> SGBCON estimates the reciprocal of the condition number of a real
39*> general band matrix A, in either the 1-norm or the infinity-norm,
40*> using the LU factorization computed by SGBTRF.
41*>
42*> An estimate is obtained for norm(inv(A)), and the reciprocal of the
43*> condition number is computed as
44*> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] NORM
51*> \verbatim
52*> NORM is CHARACTER*1
53*> Specifies whether the 1-norm condition number or the
54*> infinity-norm condition number is required:
55*> = '1' or 'O': 1-norm;
56*> = 'I': Infinity-norm.
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] KL
66*> \verbatim
67*> KL is INTEGER
68*> The number of subdiagonals within the band of A. KL >= 0.
69*> \endverbatim
70*>
71*> \param[in] KU
72*> \verbatim
73*> KU is INTEGER
74*> The number of superdiagonals within the band of A. KU >= 0.
75*> \endverbatim
76*>
77*> \param[in] AB
78*> \verbatim
79*> AB is REAL array, dimension (LDAB,N)
80*> Details of the LU factorization of the band matrix A, as
81*> computed by SGBTRF. U is stored as an upper triangular band
82*> matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
83*> the multipliers used during the factorization are stored in
84*> rows KL+KU+2 to 2*KL+KU+1.
85*> \endverbatim
86*>
87*> \param[in] LDAB
88*> \verbatim
89*> LDAB is INTEGER
90*> The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
91*> \endverbatim
92*>
93*> \param[in] IPIV
94*> \verbatim
95*> IPIV is INTEGER array, dimension (N)
96*> The pivot indices; for 1 <= i <= N, row i of the matrix was
97*> interchanged with row IPIV(i).
98*> \endverbatim
99*>
100*> \param[in] ANORM
101*> \verbatim
102*> ANORM is REAL
103*> If NORM = '1' or 'O', the 1-norm of the original matrix A.
104*> If NORM = 'I', the infinity-norm of the original matrix A.
105*> \endverbatim
106*>
107*> \param[out] RCOND
108*> \verbatim
109*> RCOND is REAL
110*> The reciprocal of the condition number of the matrix A,
111*> computed as RCOND = 1/(norm(A) * norm(inv(A))).
112*> \endverbatim
113*>
114*> \param[out] WORK
115*> \verbatim
116*> WORK is REAL array, dimension (3*N)
117*> \endverbatim
118*>
119*> \param[out] IWORK
120*> \verbatim
121*> IWORK is INTEGER array, dimension (N)
122*> \endverbatim
123*>
124*> \param[out] INFO
125*> \verbatim
126*> INFO is INTEGER
127*> = 0: successful exit
128*> < 0: if INFO = -i, the i-th argument had an illegal value
129*> \endverbatim
130*
131* Authors:
132* ========
133*
134*> \author Univ. of Tennessee
135*> \author Univ. of California Berkeley
136*> \author Univ. of Colorado Denver
137*> \author NAG Ltd.
138*
139*> \ingroup gbcon
140*
141* =====================================================================
142 SUBROUTINE sgbcon( NORM, N, KL, KU, AB, LDAB, IPIV, ANORM,
143 $ RCOND, WORK, IWORK, INFO )
144*
145* -- LAPACK computational routine --
146* -- LAPACK is a software package provided by Univ. of Tennessee, --
147* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
148*
149* .. Scalar Arguments ..
150 CHARACTER NORM
151 INTEGER INFO, KL, KU, LDAB, N
152 REAL ANORM, RCOND
153* ..
154* .. Array Arguments ..
155 INTEGER IPIV( * ), IWORK( * )
156 REAL AB( LDAB, * ), WORK( * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameters ..
162 REAL ONE, ZERO
163 parameter( one = 1.0e+0, zero = 0.0e+0 )
164* ..
165* .. Local Scalars ..
166 LOGICAL LNOTI, ONENRM
167 CHARACTER NORMIN
168 INTEGER IX, J, JP, KASE, KASE1, KD, LM
169 REAL AINVNM, SCALE, SMLNUM, T
170* ..
171* .. Local Arrays ..
172 INTEGER ISAVE( 3 )
173* ..
174* .. External Functions ..
175 LOGICAL LSAME
176 INTEGER ISAMAX
177 REAL SDOT, SLAMCH
178 EXTERNAL lsame, isamax, sdot, slamch
179* ..
180* .. External Subroutines ..
181 EXTERNAL saxpy, slacn2, slatbs, srscl,
182 $ xerbla
183* ..
184* .. Intrinsic Functions ..
185 INTRINSIC abs, min
186* ..
187* .. Executable Statements ..
188*
189* Test the input parameters.
190*
191 info = 0
192 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
193 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
194 info = -1
195 ELSE IF( n.LT.0 ) THEN
196 info = -2
197 ELSE IF( kl.LT.0 ) THEN
198 info = -3
199 ELSE IF( ku.LT.0 ) THEN
200 info = -4
201 ELSE IF( ldab.LT.2*kl+ku+1 ) THEN
202 info = -6
203 ELSE IF( anorm.LT.zero ) THEN
204 info = -8
205 END IF
206 IF( info.NE.0 ) THEN
207 CALL xerbla( 'SGBCON', -info )
208 RETURN
209 END IF
210*
211* Quick return if possible
212*
213 rcond = zero
214 IF( n.EQ.0 ) THEN
215 rcond = one
216 RETURN
217 ELSE IF( anorm.EQ.zero ) THEN
218 RETURN
219 END IF
220*
221 smlnum = slamch( 'Safe minimum' )
222*
223* Estimate the norm of inv(A).
224*
225 ainvnm = zero
226 normin = 'N'
227 IF( onenrm ) THEN
228 kase1 = 1
229 ELSE
230 kase1 = 2
231 END IF
232 kd = kl + ku + 1
233 lnoti = kl.GT.0
234 kase = 0
235 10 CONTINUE
236 CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
237 IF( kase.NE.0 ) THEN
238 IF( kase.EQ.kase1 ) THEN
239*
240* Multiply by inv(L).
241*
242 IF( lnoti ) THEN
243 DO 20 j = 1, n - 1
244 lm = min( kl, n-j )
245 jp = ipiv( j )
246 t = work( jp )
247 IF( jp.NE.j ) THEN
248 work( jp ) = work( j )
249 work( j ) = t
250 END IF
251 CALL saxpy( lm, -t, ab( kd+1, j ), 1,
252 $ work( j+1 ), 1 )
253 20 CONTINUE
254 END IF
255*
256* Multiply by inv(U).
257*
258 CALL slatbs( 'Upper', 'No transpose', 'Non-unit', normin,
259 $ n,
260 $ kl+ku, ab, ldab, work, scale, work( 2*n+1 ),
261 $ info )
262 ELSE
263*
264* Multiply by inv(U**T).
265*
266 CALL slatbs( 'Upper', 'Transpose', 'Non-unit', normin, n,
267 $ kl+ku, ab, ldab, work, scale, work( 2*n+1 ),
268 $ info )
269*
270* Multiply by inv(L**T).
271*
272 IF( lnoti ) THEN
273 DO 30 j = n - 1, 1, -1
274 lm = min( kl, n-j )
275 work( j ) = work( j ) - sdot( lm, ab( kd+1, j ), 1,
276 $ work( j+1 ), 1 )
277 jp = ipiv( j )
278 IF( jp.NE.j ) THEN
279 t = work( jp )
280 work( jp ) = work( j )
281 work( j ) = t
282 END IF
283 30 CONTINUE
284 END IF
285 END IF
286*
287* Divide X by 1/SCALE if doing so will not cause overflow.
288*
289 normin = 'Y'
290 IF( scale.NE.one ) THEN
291 ix = isamax( n, work, 1 )
292 IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
293 $ GO TO 40
294 CALL srscl( n, scale, work, 1 )
295 END IF
296 GO TO 10
297 END IF
298*
299* Compute the estimate of the reciprocal condition number.
300*
301 IF( ainvnm.NE.zero )
302 $ rcond = ( one / ainvnm ) / anorm
303*
304 40 CONTINUE
305 RETURN
306*
307* End of SGBCON
308*
309 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
Definition saxpy.f:89
subroutine sgbcon(norm, n, kl, ku, ab, ldab, ipiv, anorm, rcond, work, iwork, info)
SGBCON
Definition sgbcon.f:144
subroutine slacn2(n, v, x, isgn, est, kase, isave)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition slacn2.f:134
subroutine slatbs(uplo, trans, diag, normin, n, kd, ab, ldab, x, scale, cnorm, info)
SLATBS solves a triangular banded system of equations.
Definition slatbs.f:241
subroutine srscl(n, sa, sx, incx)
SRSCL multiplies a vector by the reciprocal of a real scalar.
Definition srscl.f:82