Annotation of rpl/lapack/lapack/dla_syrcond.f, revision 1.14

1.10      bertrand    1: *> \brief \b DLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.
1.6       bertrand    2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.14    ! bertrand    5: * Online html documentation available at
        !             6: *            http://www.netlib.org/lapack/explore-html/
1.6       bertrand    7: *
                      8: *> \htmlonly
1.14    ! bertrand    9: *> Download DLA_SYRCOND + dependencies
        !            10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_syrcond.f">
        !            11: *> [TGZ]</a>
        !            12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_syrcond.f">
        !            13: *> [ZIP]</a>
        !            14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_syrcond.f">
1.6       bertrand   15: *> [TXT]</a>
1.14    ! bertrand   16: *> \endhtmlonly
1.6       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
1.14    ! bertrand   21: *       DOUBLE PRECISION FUNCTION DLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF,
1.6       bertrand   22: *                                              IPIV, CMODE, C, INFO, WORK,
                     23: *                                              IWORK )
1.14    ! bertrand   24: *
1.6       bertrand   25: *       .. Scalar Arguments ..
                     26: *       CHARACTER          UPLO
                     27: *       INTEGER            N, LDA, LDAF, INFO, CMODE
                     28: *       ..
                     29: *       .. Array Arguments
                     30: *       INTEGER            IWORK( * ), IPIV( * )
                     31: *       DOUBLE PRECISION   A( LDA, * ), AF( LDAF, * ), WORK( * ), C( * )
                     32: *       ..
1.14    ! bertrand   33: *
1.6       bertrand   34: *
                     35: *> \par Purpose:
                     36: *  =============
                     37: *>
                     38: *> \verbatim
                     39: *>
                     40: *>    DLA_SYRCOND estimates the Skeel condition number of  op(A) * op2(C)
                     41: *>    where op2 is determined by CMODE as follows
                     42: *>    CMODE =  1    op2(C) = C
                     43: *>    CMODE =  0    op2(C) = I
                     44: *>    CMODE = -1    op2(C) = inv(C)
                     45: *>    The Skeel condition number cond(A) = norminf( |inv(A)||A| )
                     46: *>    is computed by computing scaling factors R such that
                     47: *>    diag(R)*A*op2(C) is row equilibrated and computing the standard
                     48: *>    infinity-norm condition number.
                     49: *> \endverbatim
                     50: *
                     51: *  Arguments:
                     52: *  ==========
                     53: *
                     54: *> \param[in] UPLO
                     55: *> \verbatim
                     56: *>          UPLO is CHARACTER*1
                     57: *>       = 'U':  Upper triangle of A is stored;
                     58: *>       = 'L':  Lower triangle of A is stored.
                     59: *> \endverbatim
                     60: *>
                     61: *> \param[in] N
                     62: *> \verbatim
                     63: *>          N is INTEGER
                     64: *>     The number of linear equations, i.e., the order of the
                     65: *>     matrix A.  N >= 0.
                     66: *> \endverbatim
                     67: *>
                     68: *> \param[in] A
                     69: *> \verbatim
                     70: *>          A is DOUBLE PRECISION array, dimension (LDA,N)
                     71: *>     On entry, the N-by-N matrix A.
                     72: *> \endverbatim
                     73: *>
                     74: *> \param[in] LDA
                     75: *> \verbatim
                     76: *>          LDA is INTEGER
                     77: *>     The leading dimension of the array A.  LDA >= max(1,N).
                     78: *> \endverbatim
                     79: *>
                     80: *> \param[in] AF
                     81: *> \verbatim
                     82: *>          AF is DOUBLE PRECISION array, dimension (LDAF,N)
                     83: *>     The block diagonal matrix D and the multipliers used to
                     84: *>     obtain the factor U or L as computed by DSYTRF.
                     85: *> \endverbatim
                     86: *>
                     87: *> \param[in] LDAF
                     88: *> \verbatim
                     89: *>          LDAF is INTEGER
                     90: *>     The leading dimension of the array AF.  LDAF >= max(1,N).
                     91: *> \endverbatim
                     92: *>
                     93: *> \param[in] IPIV
                     94: *> \verbatim
                     95: *>          IPIV is INTEGER array, dimension (N)
                     96: *>     Details of the interchanges and the block structure of D
                     97: *>     as determined by DSYTRF.
                     98: *> \endverbatim
                     99: *>
                    100: *> \param[in] CMODE
                    101: *> \verbatim
                    102: *>          CMODE is INTEGER
                    103: *>     Determines op2(C) in the formula op(A) * op2(C) as follows:
                    104: *>     CMODE =  1    op2(C) = C
                    105: *>     CMODE =  0    op2(C) = I
                    106: *>     CMODE = -1    op2(C) = inv(C)
                    107: *> \endverbatim
                    108: *>
                    109: *> \param[in] C
                    110: *> \verbatim
                    111: *>          C is DOUBLE PRECISION array, dimension (N)
                    112: *>     The vector C in the formula op(A) * op2(C).
                    113: *> \endverbatim
                    114: *>
                    115: *> \param[out] INFO
                    116: *> \verbatim
                    117: *>          INFO is INTEGER
                    118: *>       = 0:  Successful exit.
                    119: *>     i > 0:  The ith argument is invalid.
                    120: *> \endverbatim
                    121: *>
                    122: *> \param[in] WORK
                    123: *> \verbatim
                    124: *>          WORK is DOUBLE PRECISION array, dimension (3*N).
                    125: *>     Workspace.
                    126: *> \endverbatim
                    127: *>
                    128: *> \param[in] IWORK
                    129: *> \verbatim
                    130: *>          IWORK is INTEGER array, dimension (N).
                    131: *>     Workspace.
                    132: *> \endverbatim
                    133: *
                    134: *  Authors:
                    135: *  ========
                    136: *
1.14    ! bertrand  137: *> \author Univ. of Tennessee
        !           138: *> \author Univ. of California Berkeley
        !           139: *> \author Univ. of Colorado Denver
        !           140: *> \author NAG Ltd.
1.6       bertrand  141: *
1.14    ! bertrand  142: *> \date December 2016
1.6       bertrand  143: *
                    144: *> \ingroup doubleSYcomputational
                    145: *
                    146: *  =====================================================================
1.14    ! bertrand  147:       DOUBLE PRECISION FUNCTION DLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF,
1.1       bertrand  148:      $                                       IPIV, CMODE, C, INFO, WORK,
                    149:      $                                       IWORK )
                    150: *
1.14    ! bertrand  151: *  -- LAPACK computational routine (version 3.7.0) --
1.6       bertrand  152: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    153: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.14    ! bertrand  154: *     December 2016
1.1       bertrand  155: *
                    156: *     .. Scalar Arguments ..
                    157:       CHARACTER          UPLO
                    158:       INTEGER            N, LDA, LDAF, INFO, CMODE
                    159: *     ..
                    160: *     .. Array Arguments
                    161:       INTEGER            IWORK( * ), IPIV( * )
                    162:       DOUBLE PRECISION   A( LDA, * ), AF( LDAF, * ), WORK( * ), C( * )
                    163: *     ..
                    164: *
                    165: *  =====================================================================
                    166: *
                    167: *     .. Local Scalars ..
                    168:       CHARACTER          NORMIN
                    169:       INTEGER            KASE, I, J
                    170:       DOUBLE PRECISION   AINVNM, SMLNUM, TMP
                    171:       LOGICAL            UP
                    172: *     ..
                    173: *     .. Local Arrays ..
                    174:       INTEGER            ISAVE( 3 )
                    175: *     ..
                    176: *     .. External Functions ..
                    177:       LOGICAL            LSAME
                    178:       DOUBLE PRECISION   DLAMCH
1.14    ! bertrand  179:       EXTERNAL           LSAME, DLAMCH
1.1       bertrand  180: *     ..
                    181: *     .. External Subroutines ..
1.14    ! bertrand  182:       EXTERNAL           DLACN2, XERBLA, DSYTRS
1.1       bertrand  183: *     ..
                    184: *     .. Intrinsic Functions ..
                    185:       INTRINSIC          ABS, MAX
                    186: *     ..
                    187: *     .. Executable Statements ..
                    188: *
                    189:       DLA_SYRCOND = 0.0D+0
                    190: *
                    191:       INFO = 0
                    192:       IF( N.LT.0 ) THEN
                    193:          INFO = -2
1.8       bertrand  194:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    195:          INFO = -4
                    196:       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
                    197:          INFO = -6
1.1       bertrand  198:       END IF
                    199:       IF( INFO.NE.0 ) THEN
                    200:          CALL XERBLA( 'DLA_SYRCOND', -INFO )
                    201:          RETURN
                    202:       END IF
                    203:       IF( N.EQ.0 ) THEN
                    204:          DLA_SYRCOND = 1.0D+0
                    205:          RETURN
                    206:       END IF
                    207:       UP = .FALSE.
                    208:       IF ( LSAME( UPLO, 'U' ) ) UP = .TRUE.
                    209: *
                    210: *     Compute the equilibration matrix R such that
                    211: *     inv(R)*A*C has unit 1-norm.
                    212: *
                    213:       IF ( UP ) THEN
                    214:          DO I = 1, N
                    215:             TMP = 0.0D+0
                    216:             IF ( CMODE .EQ. 1 ) THEN
                    217:                DO J = 1, I
                    218:                   TMP = TMP + ABS( A( J, I ) * C( J ) )
                    219:                END DO
                    220:                DO J = I+1, N
                    221:                   TMP = TMP + ABS( A( I, J ) * C( J ) )
                    222:                END DO
                    223:             ELSE IF ( CMODE .EQ. 0 ) THEN
                    224:                DO J = 1, I
                    225:                   TMP = TMP + ABS( A( J, I ) )
                    226:                END DO
                    227:                DO J = I+1, N
                    228:                   TMP = TMP + ABS( A( I, J ) )
                    229:                END DO
                    230:             ELSE
                    231:                DO J = 1, I
                    232:                   TMP = TMP + ABS( A( J, I ) / C( J ) )
                    233:                END DO
                    234:                DO J = I+1, N
                    235:                   TMP = TMP + ABS( A( I, J ) / C( J ) )
                    236:                END DO
                    237:             END IF
                    238:             WORK( 2*N+I ) = TMP
                    239:          END DO
                    240:       ELSE
                    241:          DO I = 1, N
                    242:             TMP = 0.0D+0
                    243:             IF ( CMODE .EQ. 1 ) THEN
                    244:                DO J = 1, I
                    245:                   TMP = TMP + ABS( A( I, J ) * C( J ) )
                    246:                END DO
                    247:                DO J = I+1, N
                    248:                   TMP = TMP + ABS( A( J, I ) * C( J ) )
                    249:                END DO
                    250:             ELSE IF ( CMODE .EQ. 0 ) THEN
                    251:                DO J = 1, I
                    252:                   TMP = TMP + ABS( A( I, J ) )
                    253:                END DO
                    254:                DO J = I+1, N
                    255:                   TMP = TMP + ABS( A( J, I ) )
                    256:                END DO
                    257:             ELSE
                    258:                DO J = 1, I
                    259:                   TMP = TMP + ABS( A( I, J) / C( J ) )
                    260:                END DO
                    261:                DO J = I+1, N
                    262:                   TMP = TMP + ABS( A( J, I) / C( J ) )
                    263:                END DO
                    264:             END IF
                    265:             WORK( 2*N+I ) = TMP
                    266:          END DO
                    267:       ENDIF
                    268: *
                    269: *     Estimate the norm of inv(op(A)).
                    270: *
                    271:       SMLNUM = DLAMCH( 'Safe minimum' )
                    272:       AINVNM = 0.0D+0
                    273:       NORMIN = 'N'
                    274: 
                    275:       KASE = 0
                    276:    10 CONTINUE
                    277:       CALL DLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE )
                    278:       IF( KASE.NE.0 ) THEN
                    279:          IF( KASE.EQ.2 ) THEN
                    280: *
                    281: *           Multiply by R.
                    282: *
                    283:             DO I = 1, N
                    284:                WORK( I ) = WORK( I ) * WORK( 2*N+I )
                    285:             END DO
                    286: 
                    287:             IF ( UP ) THEN
                    288:                CALL DSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
                    289:             ELSE
                    290:                CALL DSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
                    291:             ENDIF
                    292: *
                    293: *           Multiply by inv(C).
                    294: *
                    295:             IF ( CMODE .EQ. 1 ) THEN
                    296:                DO I = 1, N
                    297:                   WORK( I ) = WORK( I ) / C( I )
                    298:                END DO
                    299:             ELSE IF ( CMODE .EQ. -1 ) THEN
                    300:                DO I = 1, N
                    301:                   WORK( I ) = WORK( I ) * C( I )
                    302:                END DO
                    303:             END IF
                    304:          ELSE
                    305: *
1.5       bertrand  306: *           Multiply by inv(C**T).
1.1       bertrand  307: *
                    308:             IF ( CMODE .EQ. 1 ) THEN
                    309:                DO I = 1, N
                    310:                   WORK( I ) = WORK( I ) / C( I )
                    311:                END DO
                    312:             ELSE IF ( CMODE .EQ. -1 ) THEN
                    313:                DO I = 1, N
                    314:                   WORK( I ) = WORK( I ) * C( I )
                    315:                END DO
                    316:             END IF
                    317: 
                    318:             IF ( UP ) THEN
                    319:                CALL DSYTRS( 'U', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
                    320:             ELSE
                    321:                CALL DSYTRS( 'L', N, 1, AF, LDAF, IPIV, WORK, N, INFO )
                    322:             ENDIF
                    323: *
                    324: *           Multiply by R.
                    325: *
                    326:             DO I = 1, N
                    327:                WORK( I ) = WORK( I ) * WORK( 2*N+I )
                    328:             END DO
                    329:          END IF
                    330: *
                    331:          GO TO 10
                    332:       END IF
                    333: *
                    334: *     Compute the estimate of the reciprocal condition number.
                    335: *
                    336:       IF( AINVNM .NE. 0.0D+0 )
                    337:      $   DLA_SYRCOND = ( 1.0D+0 / AINVNM )
                    338: *
                    339:       RETURN
                    340: *
                    341:       END

CVSweb interface <joel.bertrand@systella.fr>