LAPACK  3.10.0 LAPACK: Linear Algebra PACKage
stbcon.f
Go to the documentation of this file.
1 *> \brief \b STBCON
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stbcon.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stbcon.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stbcon.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE STBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
22 * IWORK, INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORM, UPLO
26 * INTEGER INFO, KD, LDAB, N
27 * REAL RCOND
28 * ..
29 * .. Array Arguments ..
30 * INTEGER IWORK( * )
31 * REAL AB( LDAB, * ), WORK( * )
32 * ..
33 *
34 *
35 *> \par Purpose:
36 * =============
37 *>
38 *> \verbatim
39 *>
40 *> STBCON estimates the reciprocal of the condition number of a
41 *> triangular band matrix A, in either the 1-norm or the infinity-norm.
42 *>
43 *> The norm of A is computed and an estimate is obtained for
44 *> norm(inv(A)), then the reciprocal of the condition number is
45 *> computed as
46 *> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] NORM
53 *> \verbatim
54 *> NORM is CHARACTER*1
55 *> Specifies whether the 1-norm condition number or the
56 *> infinity-norm condition number is required:
57 *> = '1' or 'O': 1-norm;
58 *> = 'I': Infinity-norm.
59 *> \endverbatim
60 *>
61 *> \param[in] UPLO
62 *> \verbatim
63 *> UPLO is CHARACTER*1
64 *> = 'U': A is upper triangular;
65 *> = 'L': A is lower triangular.
66 *> \endverbatim
67 *>
68 *> \param[in] DIAG
69 *> \verbatim
70 *> DIAG is CHARACTER*1
71 *> = 'N': A is non-unit triangular;
72 *> = 'U': A is unit triangular.
73 *> \endverbatim
74 *>
75 *> \param[in] N
76 *> \verbatim
77 *> N is INTEGER
78 *> The order of the matrix A. N >= 0.
79 *> \endverbatim
80 *>
81 *> \param[in] KD
82 *> \verbatim
83 *> KD is INTEGER
84 *> The number of superdiagonals or subdiagonals of the
85 *> triangular band matrix A. KD >= 0.
86 *> \endverbatim
87 *>
88 *> \param[in] AB
89 *> \verbatim
90 *> AB is REAL array, dimension (LDAB,N)
91 *> The upper or lower triangular band matrix A, stored in the
92 *> first kd+1 rows of the array. The j-th column of A is stored
93 *> in the j-th column of the array AB as follows:
94 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
95 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
96 *> If DIAG = 'U', the diagonal elements of A are not referenced
97 *> and are assumed to be 1.
98 *> \endverbatim
99 *>
100 *> \param[in] LDAB
101 *> \verbatim
102 *> LDAB is INTEGER
103 *> The leading dimension of the array AB. LDAB >= KD+1.
104 *> \endverbatim
105 *>
106 *> \param[out] RCOND
107 *> \verbatim
108 *> RCOND is REAL
109 *> The reciprocal of the condition number of the matrix A,
110 *> computed as RCOND = 1/(norm(A) * norm(inv(A))).
111 *> \endverbatim
112 *>
113 *> \param[out] WORK
114 *> \verbatim
115 *> WORK is REAL array, dimension (3*N)
116 *> \endverbatim
117 *>
118 *> \param[out] IWORK
119 *> \verbatim
120 *> IWORK is INTEGER array, dimension (N)
121 *> \endverbatim
122 *>
123 *> \param[out] INFO
124 *> \verbatim
125 *> INFO is INTEGER
126 *> = 0: successful exit
127 *> < 0: if INFO = -i, the i-th argument had an illegal value
128 *> \endverbatim
129 *
130 * Authors:
131 * ========
132 *
133 *> \author Univ. of Tennessee
134 *> \author Univ. of California Berkeley
135 *> \author Univ. of Colorado Denver
136 *> \author NAG Ltd.
137 *
138 *> \ingroup realOTHERcomputational
139 *
140 * =====================================================================
141  SUBROUTINE stbcon( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
142  \$ IWORK, INFO )
143 *
144 * -- LAPACK computational routine --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 *
148 * .. Scalar Arguments ..
149  CHARACTER DIAG, NORM, UPLO
150  INTEGER INFO, KD, LDAB, N
151  REAL RCOND
152 * ..
153 * .. Array Arguments ..
154  INTEGER IWORK( * )
155  REAL AB( LDAB, * ), WORK( * )
156 * ..
157 *
158 * =====================================================================
159 *
160 * .. Parameters ..
161  REAL ONE, ZERO
162  parameter( one = 1.0e+0, zero = 0.0e+0 )
163 * ..
164 * .. Local Scalars ..
165  LOGICAL NOUNIT, ONENRM, UPPER
166  CHARACTER NORMIN
167  INTEGER IX, KASE, KASE1
168  REAL AINVNM, ANORM, SCALE, SMLNUM, XNORM
169 * ..
170 * .. Local Arrays ..
171  INTEGER ISAVE( 3 )
172 * ..
173 * .. External Functions ..
174  LOGICAL LSAME
175  INTEGER ISAMAX
176  REAL SLAMCH, SLANTB
177  EXTERNAL lsame, isamax, slamch, slantb
178 * ..
179 * .. External Subroutines ..
180  EXTERNAL slacn2, slatbs, srscl, xerbla
181 * ..
182 * .. Intrinsic Functions ..
183  INTRINSIC abs, max, real
184 * ..
185 * .. Executable Statements ..
186 *
187 * Test the input parameters.
188 *
189  info = 0
190  upper = lsame( uplo, 'U' )
191  onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
192  nounit = lsame( diag, 'N' )
193 *
194  IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
195  info = -1
196  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
197  info = -2
198  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
199  info = -3
200  ELSE IF( n.LT.0 ) THEN
201  info = -4
202  ELSE IF( kd.LT.0 ) THEN
203  info = -5
204  ELSE IF( ldab.LT.kd+1 ) THEN
205  info = -7
206  END IF
207  IF( info.NE.0 ) THEN
208  CALL xerbla( 'STBCON', -info )
209  RETURN
210  END IF
211 *
212 * Quick return if possible
213 *
214  IF( n.EQ.0 ) THEN
215  rcond = one
216  RETURN
217  END IF
218 *
219  rcond = zero
220  smlnum = slamch( 'Safe minimum' )*real( max( 1, n ) )
221 *
222 * Compute the norm of the triangular matrix A.
223 *
224  anorm = slantb( norm, uplo, diag, n, kd, ab, ldab, work )
225 *
226 * Continue only if ANORM > 0.
227 *
228  IF( anorm.GT.zero ) THEN
229 *
230 * Estimate the norm of the inverse of A.
231 *
232  ainvnm = zero
233  normin = 'N'
234  IF( onenrm ) THEN
235  kase1 = 1
236  ELSE
237  kase1 = 2
238  END IF
239  kase = 0
240  10 CONTINUE
241  CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
242  IF( kase.NE.0 ) THEN
243  IF( kase.EQ.kase1 ) THEN
244 *
245 * Multiply by inv(A).
246 *
247  CALL slatbs( uplo, 'No transpose', diag, normin, n, kd,
248  \$ ab, ldab, work, scale, work( 2*n+1 ), info )
249  ELSE
250 *
251 * Multiply by inv(A**T).
252 *
253  CALL slatbs( uplo, 'Transpose', diag, normin, n, kd, ab,
254  \$ ldab, work, scale, work( 2*n+1 ), info )
255  END IF
256  normin = 'Y'
257 *
258 * Multiply by 1/SCALE if doing so will not cause overflow.
259 *
260  IF( scale.NE.one ) THEN
261  ix = isamax( n, work, 1 )
262  xnorm = abs( work( ix ) )
263  IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
264  \$ GO TO 20
265  CALL srscl( n, scale, work, 1 )
266  END IF
267  GO TO 10
268  END IF
269 *
270 * Compute the estimate of the reciprocal condition number.
271 *
272  IF( ainvnm.NE.zero )
273  \$ rcond = ( one / anorm ) / ainvnm
274  END IF
275 *
276  20 CONTINUE
277  RETURN
278 *
279 * End of STBCON
280 *
281  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
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:136
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:242
subroutine srscl(N, SA, SX, INCX)
SRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: srscl.f:84
subroutine stbcon(NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK, IWORK, INFO)
STBCON
Definition: stbcon.f:143