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

◆ cla_hercond_c()

real function cla_hercond_c ( character uplo,
integer n,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( ldaf, * ) af,
integer ldaf,
integer, dimension( * ) ipiv,
real, dimension ( * ) c,
logical capply,
integer info,
complex, dimension( * ) work,
real, dimension( * ) rwork )

CLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian indefinite matrices.

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

Purpose:
!>
!>    CLA_HERCOND_C computes the infinity norm condition number of
!>    op(A) * inv(diag(C)) where C is a REAL vector.
!> 
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 COMPLEX 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 COMPLEX array, dimension (LDAF,N)
!>     The block diagonal matrix D and the multipliers used to
!>     obtain the factor U or L as computed by CHETRF.
!> 
[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 CHETRF.
!> 
[in]C
!>          C is REAL array, dimension (N)
!>     The vector C in the formula op(A) * inv(diag(C)).
!> 
[in]CAPPLY
!>          CAPPLY is LOGICAL
!>     If .TRUE. then access the vector C in the formula above.
!> 
[out]INFO
!>          INFO is INTEGER
!>       = 0:  Successful exit.
!>     i > 0:  The ith argument is invalid.
!> 
[out]WORK
!>          WORK is COMPLEX array, dimension (2*N).
!>     Workspace.
!> 
[out]RWORK
!>          RWORK is REAL array, dimension (N).
!>     Workspace.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 134 of file cla_hercond_c.f.

137*
138* -- LAPACK computational routine --
139* -- LAPACK is a software package provided by Univ. of Tennessee, --
140* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141*
142* .. Scalar Arguments ..
143 CHARACTER UPLO
144 LOGICAL CAPPLY
145 INTEGER N, LDA, LDAF, INFO
146* ..
147* .. Array Arguments ..
148 INTEGER IPIV( * )
149 COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * )
150 REAL C ( * ), RWORK( * )
151* ..
152*
153* =====================================================================
154*
155* .. Local Scalars ..
156 INTEGER KASE, I, J
157 REAL AINVNM, ANORM, TMP
158 LOGICAL UP, UPPER
159 COMPLEX ZDUM
160* ..
161* .. Local Arrays ..
162 INTEGER ISAVE( 3 )
163* ..
164* .. External Functions ..
165 LOGICAL LSAME
166 EXTERNAL lsame
167* ..
168* .. External Subroutines ..
169 EXTERNAL clacn2, chetrs, xerbla
170* ..
171* .. Intrinsic Functions ..
172 INTRINSIC abs, max
173* ..
174* .. Statement Functions ..
175 REAL CABS1
176* ..
177* .. Statement Function Definitions ..
178 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
179* ..
180* .. Executable Statements ..
181*
182 cla_hercond_c = 0.0e+0
183*
184 info = 0
185 upper = lsame( uplo, 'U' )
186 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
187 info = -1
188 ELSE IF( n.LT.0 ) THEN
189 info = -2
190 ELSE IF( lda.LT.max( 1, n ) ) THEN
191 info = -4
192 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
193 info = -6
194 END IF
195 IF( info.NE.0 ) THEN
196 CALL xerbla( 'CLA_HERCOND_C', -info )
197 RETURN
198 END IF
199 up = .false.
200 IF ( lsame( uplo, 'U' ) ) up = .true.
201*
202* Compute norm of op(A)*op2(C).
203*
204 anorm = 0.0e+0
205 IF ( up ) THEN
206 DO i = 1, n
207 tmp = 0.0e+0
208 IF ( capply ) THEN
209 DO j = 1, i
210 tmp = tmp + cabs1( a( j, i ) ) / c( j )
211 END DO
212 DO j = i+1, n
213 tmp = tmp + cabs1( a( i, j ) ) / c( j )
214 END DO
215 ELSE
216 DO j = 1, i
217 tmp = tmp + cabs1( a( j, i ) )
218 END DO
219 DO j = i+1, n
220 tmp = tmp + cabs1( a( i, j ) )
221 END DO
222 END IF
223 rwork( i ) = tmp
224 anorm = max( anorm, tmp )
225 END DO
226 ELSE
227 DO i = 1, n
228 tmp = 0.0e+0
229 IF ( capply ) THEN
230 DO j = 1, i
231 tmp = tmp + cabs1( a( i, j ) ) / c( j )
232 END DO
233 DO j = i+1, n
234 tmp = tmp + cabs1( a( j, i ) ) / c( j )
235 END DO
236 ELSE
237 DO j = 1, i
238 tmp = tmp + cabs1( a( i, j ) )
239 END DO
240 DO j = i+1, n
241 tmp = tmp + cabs1( a( j, i ) )
242 END DO
243 END IF
244 rwork( i ) = tmp
245 anorm = max( anorm, tmp )
246 END DO
247 END IF
248*
249* Quick return if possible.
250*
251 IF( n.EQ.0 ) THEN
252 cla_hercond_c = 1.0e+0
253 RETURN
254 ELSE IF( anorm .EQ. 0.0e+0 ) THEN
255 RETURN
256 END IF
257*
258* Estimate the norm of inv(op(A)).
259*
260 ainvnm = 0.0e+0
261*
262 kase = 0
263 10 CONTINUE
264 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
265 IF( kase.NE.0 ) THEN
266 IF( kase.EQ.2 ) THEN
267*
268* Multiply by R.
269*
270 DO i = 1, n
271 work( i ) = work( i ) * rwork( i )
272 END DO
273*
274 IF ( up ) THEN
275 CALL chetrs( 'U', n, 1, af, ldaf, ipiv,
276 $ work, n, info )
277 ELSE
278 CALL chetrs( 'L', n, 1, af, ldaf, ipiv,
279 $ work, n, info )
280 ENDIF
281*
282* Multiply by inv(C).
283*
284 IF ( capply ) THEN
285 DO i = 1, n
286 work( i ) = work( i ) * c( i )
287 END DO
288 END IF
289 ELSE
290*
291* Multiply by inv(C**H).
292*
293 IF ( capply ) THEN
294 DO i = 1, n
295 work( i ) = work( i ) * c( i )
296 END DO
297 END IF
298*
299 IF ( up ) THEN
300 CALL chetrs( 'U', n, 1, af, ldaf, ipiv,
301 $ work, n, info )
302 ELSE
303 CALL chetrs( 'L', n, 1, af, ldaf, ipiv,
304 $ work, n, info )
305 END IF
306*
307* Multiply by R.
308*
309 DO i = 1, n
310 work( i ) = work( i ) * rwork( i )
311 END DO
312 END IF
313 GO TO 10
314 END IF
315*
316* Compute the estimate of the reciprocal condition number.
317*
318 IF( ainvnm .NE. 0.0e+0 )
319 $ cla_hercond_c = 1.0e+0 / ainvnm
320*
321 RETURN
322*
323* End of CLA_HERCOND_C
324*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine chetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
CHETRS
Definition chetrs.f:118
real function cla_hercond_c(uplo, n, a, lda, af, ldaf, ipiv, c, capply, info, work, rwork)
CLA_HERCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian indefin...
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition clacn2.f:131
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: