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

◆ sla_syrcond()

real function sla_syrcond ( character uplo,
integer n,
real, dimension( lda, * ) a,
integer lda,
real, dimension( ldaf, * ) af,
integer ldaf,
integer, dimension( * ) ipiv,
integer cmode,
real, dimension( * ) c,
integer info,
real, dimension( * ) work,
integer, dimension( * ) iwork )

SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.

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

Purpose:
!>
!>    SLA_SYRCOND estimates the Skeel condition number of  op(A) * op2(C)
!>    where op2 is determined by CMODE as follows
!>    CMODE =  1    op2(C) = C
!>    CMODE =  0    op2(C) = I
!>    CMODE = -1    op2(C) = inv(C)
!>    The Skeel condition number cond(A) = norminf( |inv(A)||A| )
!>    is computed by computing scaling factors R such that
!>    diag(R)*A*op2(C) is row equilibrated and computing the standard
!>    infinity-norm condition number.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>       = 'U':  Upper triangle of A is stored;
!>       = 'L':  Lower triangle of A is stored.
!> 
[in]N
!>          N is INTEGER
!>     The number of linear equations, i.e., the order of the
!>     matrix A.  N >= 0.
!> 
[in]A
!>          A is REAL array, dimension (LDA,N)
!>     On entry, the N-by-N matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>     The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]AF
!>          AF is REAL array, dimension (LDAF,N)
!>     The block diagonal matrix D and the multipliers used to
!>     obtain the factor U or L as computed by SSYTRF.
!> 
[in]LDAF
!>          LDAF is INTEGER
!>     The leading dimension of the array AF.  LDAF >= max(1,N).
!> 
[in]IPIV
!>          IPIV is INTEGER array, dimension (N)
!>     Details of the interchanges and the block structure of D
!>     as determined by SSYTRF.
!> 
[in]CMODE
!>          CMODE is INTEGER
!>     Determines op2(C) in the formula op(A) * op2(C) as follows:
!>     CMODE =  1    op2(C) = C
!>     CMODE =  0    op2(C) = I
!>     CMODE = -1    op2(C) = inv(C)
!> 
[in]C
!>          C is REAL array, dimension (N)
!>     The vector C in the formula op(A) * op2(C).
!> 
[out]INFO
!>          INFO is INTEGER
!>       = 0:  Successful exit.
!>     i > 0:  The ith argument is invalid.
!> 
[out]WORK
!>          WORK is REAL array, dimension (3*N).
!>     Workspace.
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N).
!>     Workspace.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 142 of file sla_syrcond.f.

145*
146* -- LAPACK computational routine --
147* -- LAPACK is a software package provided by Univ. of Tennessee, --
148* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149*
150* .. Scalar Arguments ..
151 CHARACTER UPLO
152 INTEGER N, LDA, LDAF, INFO, CMODE
153* ..
154* .. Array Arguments
155 INTEGER IWORK( * ), IPIV( * )
156 REAL A( LDA, * ), AF( LDAF, * ), WORK( * ), C( * )
157* ..
158*
159* =====================================================================
160*
161* .. Local Scalars ..
162 CHARACTER NORMIN
163 INTEGER KASE, I, J
164 REAL AINVNM, SMLNUM, TMP
165 LOGICAL UP
166* ..
167* .. Local Arrays ..
168 INTEGER ISAVE( 3 )
169* ..
170* .. External Functions ..
171 LOGICAL LSAME
172 REAL SLAMCH
173 EXTERNAL lsame, slamch
174* ..
175* .. External Subroutines ..
176 EXTERNAL slacn2, xerbla, ssytrs
177* ..
178* .. Intrinsic Functions ..
179 INTRINSIC abs, max
180* ..
181* .. Executable Statements ..
182*
183 sla_syrcond = 0.0
184*
185 info = 0
186 IF( n.LT.0 ) THEN
187 info = -2
188 ELSE IF( lda.LT.max( 1, n ) ) THEN
189 info = -4
190 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
191 info = -6
192 END IF
193 IF( info.NE.0 ) THEN
194 CALL xerbla( 'SLA_SYRCOND', -info )
195 RETURN
196 END IF
197 IF( n.EQ.0 ) THEN
198 sla_syrcond = 1.0
199 RETURN
200 END IF
201 up = .false.
202 IF ( lsame( uplo, 'U' ) ) up = .true.
203*
204* Compute the equilibration matrix R such that
205* inv(R)*A*C has unit 1-norm.
206*
207 IF ( up ) THEN
208 DO i = 1, n
209 tmp = 0.0
210 IF ( cmode .EQ. 1 ) THEN
211 DO j = 1, i
212 tmp = tmp + abs( a( j, i ) * c( j ) )
213 END DO
214 DO j = i+1, n
215 tmp = tmp + abs( a( i, j ) * c( j ) )
216 END DO
217 ELSE IF ( cmode .EQ. 0 ) THEN
218 DO j = 1, i
219 tmp = tmp + abs( a( j, i ) )
220 END DO
221 DO j = i+1, n
222 tmp = tmp + abs( a( i, j ) )
223 END DO
224 ELSE
225 DO j = 1, i
226 tmp = tmp + abs( a( j, i ) / c( j ) )
227 END DO
228 DO j = i+1, n
229 tmp = tmp + abs( a( i, j ) / c( j ) )
230 END DO
231 END IF
232 work( 2*n+i ) = tmp
233 END DO
234 ELSE
235 DO i = 1, n
236 tmp = 0.0
237 IF ( cmode .EQ. 1 ) THEN
238 DO j = 1, i
239 tmp = tmp + abs( a( i, j ) * c( j ) )
240 END DO
241 DO j = i+1, n
242 tmp = tmp + abs( a( j, i ) * c( j ) )
243 END DO
244 ELSE IF ( cmode .EQ. 0 ) THEN
245 DO j = 1, i
246 tmp = tmp + abs( a( i, j ) )
247 END DO
248 DO j = i+1, n
249 tmp = tmp + abs( a( j, i ) )
250 END DO
251 ELSE
252 DO j = 1, i
253 tmp = tmp + abs( a( i, j) / c( j ) )
254 END DO
255 DO j = i+1, n
256 tmp = tmp + abs( a( j, i) / c( j ) )
257 END DO
258 END IF
259 work( 2*n+i ) = tmp
260 END DO
261 ENDIF
262*
263* Estimate the norm of inv(op(A)).
264*
265 smlnum = slamch( 'Safe minimum' )
266 ainvnm = 0.0
267 normin = 'N'
268
269 kase = 0
270 10 CONTINUE
271 CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
272 IF( kase.NE.0 ) THEN
273 IF( kase.EQ.2 ) THEN
274*
275* Multiply by R.
276*
277 DO i = 1, n
278 work( i ) = work( i ) * work( 2*n+i )
279 END DO
280
281 IF ( up ) THEN
282 CALL ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n,
283 $ info )
284 ELSE
285 CALL ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n,
286 $ info )
287 ENDIF
288*
289* Multiply by inv(C).
290*
291 IF ( cmode .EQ. 1 ) THEN
292 DO i = 1, n
293 work( i ) = work( i ) / c( i )
294 END DO
295 ELSE IF ( cmode .EQ. -1 ) THEN
296 DO i = 1, n
297 work( i ) = work( i ) * c( i )
298 END DO
299 END IF
300 ELSE
301*
302* Multiply by inv(C**T).
303*
304 IF ( cmode .EQ. 1 ) THEN
305 DO i = 1, n
306 work( i ) = work( i ) / c( i )
307 END DO
308 ELSE IF ( cmode .EQ. -1 ) THEN
309 DO i = 1, n
310 work( i ) = work( i ) * c( i )
311 END DO
312 END IF
313
314 IF ( up ) THEN
315 CALL ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n,
316 $ info )
317 ELSE
318 CALL ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n,
319 $ info )
320 ENDIF
321*
322* Multiply by R.
323*
324 DO i = 1, n
325 work( i ) = work( i ) * work( 2*n+i )
326 END DO
327 END IF
328*
329 GO TO 10
330 END IF
331*
332* Compute the estimate of the reciprocal condition number.
333*
334 IF( ainvnm .NE. 0.0 )
335 $ sla_syrcond = ( 1.0 / ainvnm )
336*
337 RETURN
338*
339* End of SLA_SYRCOND
340*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ssytrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
SSYTRS
Definition ssytrs.f:118
real function sla_syrcond(uplo, n, a, lda, af, ldaf, ipiv, cmode, c, info, work, iwork)
SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.
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
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: