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

◆ dla_gercond()

double precision function dla_gercond ( character  TRANS,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
integer  CMODE,
double precision, dimension( * )  C,
integer  INFO,
double precision, dimension( * )  WORK,
integer, dimension( * )  IWORK 
)

DLA_GERCOND estimates the Skeel condition number for a general matrix.

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

Purpose:
    DLA_GERCOND 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]TRANS
          TRANS is CHARACTER*1
     Specifies the form of the system of equations:
       = 'N':  A * X = B     (No transpose)
       = 'T':  A**T * X = B  (Transpose)
       = 'C':  A**H * X = B  (Conjugate Transpose = Transpose)
[in]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]A
          A is DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (LDAF,N)
     The factors L and U from the factorization
     A = P*L*U as computed by DGETRF.
[in]LDAF
          LDAF is INTEGER
     The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     The pivot indices from the factorization A = P*L*U
     as computed by DGETRF; row i of the matrix was interchanged
     with row IPIV(i).
[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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 149 of file dla_gercond.f.

152*
153* -- LAPACK computational routine --
154* -- LAPACK is a software package provided by Univ. of Tennessee, --
155* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
156*
157* .. Scalar Arguments ..
158 CHARACTER TRANS
159 INTEGER N, LDA, LDAF, INFO, CMODE
160* ..
161* .. Array Arguments ..
162 INTEGER IPIV( * ), IWORK( * )
163 DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), WORK( * ),
164 $ C( * )
165* ..
166*
167* =====================================================================
168*
169* .. Local Scalars ..
170 LOGICAL NOTRANS
171 INTEGER KASE, I, J
172 DOUBLE PRECISION AINVNM, TMP
173* ..
174* .. Local Arrays ..
175 INTEGER ISAVE( 3 )
176* ..
177* .. External Functions ..
178 LOGICAL LSAME
179 EXTERNAL lsame
180* ..
181* .. External Subroutines ..
182 EXTERNAL dlacn2, dgetrs, xerbla
183* ..
184* .. Intrinsic Functions ..
185 INTRINSIC abs, max
186* ..
187* .. Executable Statements ..
188*
189 dla_gercond = 0.0d+0
190*
191 info = 0
192 notrans = lsame( trans, 'N' )
193 IF ( .NOT. notrans .AND. .NOT. lsame(trans, 'T')
194 $ .AND. .NOT. lsame(trans, 'C') ) THEN
195 info = -1
196 ELSE IF( n.LT.0 ) THEN
197 info = -2
198 ELSE IF( lda.LT.max( 1, n ) ) THEN
199 info = -4
200 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
201 info = -6
202 END IF
203 IF( info.NE.0 ) THEN
204 CALL xerbla( 'DLA_GERCOND', -info )
205 RETURN
206 END IF
207 IF( n.EQ.0 ) THEN
208 dla_gercond = 1.0d+0
209 RETURN
210 END IF
211*
212* Compute the equilibration matrix R such that
213* inv(R)*A*C has unit 1-norm.
214*
215 IF (notrans) THEN
216 DO i = 1, n
217 tmp = 0.0d+0
218 IF ( cmode .EQ. 1 ) THEN
219 DO j = 1, n
220 tmp = tmp + abs( a( i, j ) * c( j ) )
221 END DO
222 ELSE IF ( cmode .EQ. 0 ) THEN
223 DO j = 1, n
224 tmp = tmp + abs( a( i, j ) )
225 END DO
226 ELSE
227 DO j = 1, n
228 tmp = tmp + abs( a( i, j ) / c( j ) )
229 END DO
230 END IF
231 work( 2*n+i ) = tmp
232 END DO
233 ELSE
234 DO i = 1, n
235 tmp = 0.0d+0
236 IF ( cmode .EQ. 1 ) THEN
237 DO j = 1, n
238 tmp = tmp + abs( a( j, i ) * c( j ) )
239 END DO
240 ELSE IF ( cmode .EQ. 0 ) THEN
241 DO j = 1, n
242 tmp = tmp + abs( a( j, i ) )
243 END DO
244 ELSE
245 DO j = 1, n
246 tmp = tmp + abs( a( j, i ) / c( j ) )
247 END DO
248 END IF
249 work( 2*n+i ) = tmp
250 END DO
251 END IF
252*
253* Estimate the norm of inv(op(A)).
254*
255 ainvnm = 0.0d+0
256
257 kase = 0
258 10 CONTINUE
259 CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
260 IF( kase.NE.0 ) THEN
261 IF( kase.EQ.2 ) THEN
262*
263* Multiply by R.
264*
265 DO i = 1, n
266 work(i) = work(i) * work(2*n+i)
267 END DO
268
269 IF (notrans) THEN
270 CALL dgetrs( 'No transpose', n, 1, af, ldaf, ipiv,
271 $ work, n, info )
272 ELSE
273 CALL dgetrs( 'Transpose', n, 1, af, ldaf, ipiv,
274 $ work, n, info )
275 END IF
276*
277* Multiply by inv(C).
278*
279 IF ( cmode .EQ. 1 ) THEN
280 DO i = 1, n
281 work( i ) = work( i ) / c( i )
282 END DO
283 ELSE IF ( cmode .EQ. -1 ) THEN
284 DO i = 1, n
285 work( i ) = work( i ) * c( i )
286 END DO
287 END IF
288 ELSE
289*
290* Multiply by inv(C**T).
291*
292 IF ( cmode .EQ. 1 ) THEN
293 DO i = 1, n
294 work( i ) = work( i ) / c( i )
295 END DO
296 ELSE IF ( cmode .EQ. -1 ) THEN
297 DO i = 1, n
298 work( i ) = work( i ) * c( i )
299 END DO
300 END IF
301
302 IF (notrans) THEN
303 CALL dgetrs( 'Transpose', n, 1, af, ldaf, ipiv,
304 $ work, n, info )
305 ELSE
306 CALL dgetrs( 'No transpose', n, 1, af, ldaf, ipiv,
307 $ work, n, info )
308 END IF
309*
310* Multiply by R.
311*
312 DO i = 1, n
313 work( i ) = work( i ) * work( 2*n+i )
314 END DO
315 END IF
316 GO TO 10
317 END IF
318*
319* Compute the estimate of the reciprocal condition number.
320*
321 IF( ainvnm .NE. 0.0d+0 )
322 $ dla_gercond = ( 1.0d+0 / ainvnm )
323*
324 RETURN
325*
326* End of DLA_GERCOND
327*
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
double precision function dla_gercond(TRANS, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)
DLA_GERCOND estimates the Skeel condition number for a general matrix.
Definition: dla_gercond.f:152
subroutine dgetrs(TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
DGETRS
Definition: dgetrs.f:121
subroutine dlacn2(N, V, X, ISGN, EST, KASE, ISAVE)
DLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: dlacn2.f:136
Here is the call graph for this function:
Here is the caller graph for this function: