LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ stpcon()

subroutine stpcon ( character norm,
character uplo,
character diag,
integer n,
real, dimension( * ) ap,
real rcond,
real, dimension( * ) work,
integer, dimension( * ) iwork,
integer info )

STPCON

Download STPCON + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> STPCON estimates the reciprocal of the condition number of a packed
!> triangular matrix A, in either the 1-norm or the infinity-norm.
!>
!> The norm of A is computed and an estimate is obtained for
!> norm(inv(A)), then the reciprocal of the condition number is
!> computed as
!>    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
!> 
Parameters
[in]NORM
!>          NORM is CHARACTER*1
!>          Specifies whether the 1-norm condition number or the
!>          infinity-norm condition number is required:
!>          = '1' or 'O':  1-norm;
!>          = 'I':         Infinity-norm.
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          = 'U':  A is upper triangular;
!>          = 'L':  A is lower triangular.
!> 
[in]DIAG
!>          DIAG is CHARACTER*1
!>          = 'N':  A is non-unit triangular;
!>          = 'U':  A is unit triangular.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in]AP
!>          AP is REAL array, dimension (N*(N+1)/2)
!>          The upper or lower triangular matrix A, packed columnwise in
!>          a linear array.  The j-th column of A is stored in the array
!>          AP as follows:
!>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
!>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
!>          If DIAG = 'U', the diagonal elements of A are not referenced
!>          and are assumed to be 1.
!> 
[out]RCOND
!>          RCOND is REAL
!>          The reciprocal of the condition number of the matrix A,
!>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
!> 
[out]WORK
!>          WORK is REAL array, dimension (3*N)
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N)
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 126 of file stpcon.f.

128*
129* -- LAPACK computational routine --
130* -- LAPACK is a software package provided by Univ. of Tennessee, --
131* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132*
133* .. Scalar Arguments ..
134 CHARACTER DIAG, NORM, UPLO
135 INTEGER INFO, N
136 REAL RCOND
137* ..
138* .. Array Arguments ..
139 INTEGER IWORK( * )
140 REAL AP( * ), WORK( * )
141* ..
142*
143* =====================================================================
144*
145* .. Parameters ..
146 REAL ONE, ZERO
147 parameter( one = 1.0e+0, zero = 0.0e+0 )
148* ..
149* .. Local Scalars ..
150 LOGICAL NOUNIT, ONENRM, UPPER
151 CHARACTER NORMIN
152 INTEGER IX, KASE, KASE1
153 REAL AINVNM, ANORM, SCALE, SMLNUM, XNORM
154* ..
155* .. Local Arrays ..
156 INTEGER ISAVE( 3 )
157* ..
158* .. External Functions ..
159 LOGICAL LSAME
160 INTEGER ISAMAX
161 REAL SLAMCH, SLANTP
162 EXTERNAL lsame, isamax, slamch, slantp
163* ..
164* .. External Subroutines ..
165 EXTERNAL slacn2, slatps, srscl, xerbla
166* ..
167* .. Intrinsic Functions ..
168 INTRINSIC abs, max, real
169* ..
170* .. Executable Statements ..
171*
172* Test the input parameters.
173*
174 info = 0
175 upper = lsame( uplo, 'U' )
176 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
177 nounit = lsame( diag, 'N' )
178*
179 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
180 info = -1
181 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
182 info = -2
183 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
184 info = -3
185 ELSE IF( n.LT.0 ) THEN
186 info = -4
187 END IF
188 IF( info.NE.0 ) THEN
189 CALL xerbla( 'STPCON', -info )
190 RETURN
191 END IF
192*
193* Quick return if possible
194*
195 IF( n.EQ.0 ) THEN
196 rcond = one
197 RETURN
198 END IF
199*
200 rcond = zero
201 smlnum = slamch( 'Safe minimum' )*real( max( 1, n ) )
202*
203* Compute the norm of the triangular matrix A.
204*
205 anorm = slantp( norm, uplo, diag, n, ap, work )
206*
207* Continue only if ANORM > 0.
208*
209 IF( anorm.GT.zero ) THEN
210*
211* Estimate the norm of the inverse of A.
212*
213 ainvnm = zero
214 normin = 'N'
215 IF( onenrm ) THEN
216 kase1 = 1
217 ELSE
218 kase1 = 2
219 END IF
220 kase = 0
221 10 CONTINUE
222 CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase,
223 $ isave )
224 IF( kase.NE.0 ) THEN
225 IF( kase.EQ.kase1 ) THEN
226*
227* Multiply by inv(A).
228*
229 CALL slatps( uplo, 'No transpose', diag, normin, n,
230 $ ap,
231 $ work, scale, work( 2*n+1 ), info )
232 ELSE
233*
234* Multiply by inv(A**T).
235*
236 CALL slatps( uplo, 'Transpose', diag, normin, n, ap,
237 $ work, scale, work( 2*n+1 ), info )
238 END IF
239 normin = 'Y'
240*
241* Multiply by 1/SCALE if doing so will not cause overflow.
242*
243 IF( scale.NE.one ) THEN
244 ix = isamax( n, work, 1 )
245 xnorm = abs( work( ix ) )
246 IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
247 $ GO TO 20
248 CALL srscl( n, scale, work, 1 )
249 END IF
250 GO TO 10
251 END IF
252*
253* Compute the estimate of the reciprocal condition number.
254*
255 IF( ainvnm.NE.zero )
256 $ rcond = ( one / anorm ) / ainvnm
257 END IF
258*
259 20 CONTINUE
260 RETURN
261*
262* End of STPCON
263*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function isamax(n, sx, incx)
ISAMAX
Definition isamax.f:71
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
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slantp(norm, uplo, diag, n, ap, work)
SLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition slantp.f:123
subroutine slatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
SLATPS solves a triangular system of equations with the matrix held in packed storage.
Definition slatps.f:227
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine srscl(n, sa, sx, incx)
SRSCL multiplies a vector by the reciprocal of a real scalar.
Definition srscl.f:82
Here is the call graph for this function:
Here is the caller graph for this function: