Annotation of rpl/lapack/lapack/zla_syrpvgrw.f, revision 1.17

1.8       bertrand    1: *> \brief \b ZLA_SYRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric indefinite matrix.
1.5       bertrand    2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.13      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.5       bertrand    7: *
                      8: *> \htmlonly
1.13      bertrand    9: *> Download ZLA_SYRPVGRW + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zla_syrpvgrw.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zla_syrpvgrw.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zla_syrpvgrw.f">
1.5       bertrand   15: *> [TXT]</a>
1.13      bertrand   16: *> \endhtmlonly
1.5       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       DOUBLE PRECISION FUNCTION ZLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF,
                     22: *                                               LDAF, IPIV, WORK )
1.13      bertrand   23: *
1.5       bertrand   24: *       .. Scalar Arguments ..
                     25: *       CHARACTER*1        UPLO
                     26: *       INTEGER            N, INFO, LDA, LDAF
                     27: *       ..
                     28: *       .. Array Arguments ..
                     29: *       COMPLEX*16         A( LDA, * ), AF( LDAF, * )
                     30: *       DOUBLE PRECISION   WORK( * )
                     31: *       INTEGER            IPIV( * )
                     32: *       ..
1.13      bertrand   33: *
1.5       bertrand   34: *
                     35: *> \par Purpose:
                     36: *  =============
                     37: *>
                     38: *> \verbatim
                     39: *>
1.13      bertrand   40: *>
1.5       bertrand   41: *> ZLA_SYRPVGRW computes the reciprocal pivot growth factor
                     42: *> norm(A)/norm(U). The "max absolute element" norm is used. If this is
                     43: *> much less than 1, the stability of the LU factorization of the
                     44: *> (equilibrated) matrix A could be poor. This also means that the
                     45: *> solution X, estimated condition numbers, and error bounds could be
                     46: *> unreliable.
                     47: *> \endverbatim
                     48: *
                     49: *  Arguments:
                     50: *  ==========
                     51: *
                     52: *> \param[in] UPLO
                     53: *> \verbatim
                     54: *>          UPLO is CHARACTER*1
                     55: *>       = 'U':  Upper triangle of A is stored;
                     56: *>       = 'L':  Lower triangle of A is stored.
                     57: *> \endverbatim
                     58: *>
                     59: *> \param[in] N
                     60: *> \verbatim
                     61: *>          N is INTEGER
                     62: *>     The number of linear equations, i.e., the order of the
                     63: *>     matrix A.  N >= 0.
                     64: *> \endverbatim
                     65: *>
                     66: *> \param[in] INFO
                     67: *> \verbatim
                     68: *>          INFO is INTEGER
                     69: *>     The value of INFO returned from ZSYTRF, .i.e., the pivot in
                     70: *>     column INFO is exactly 0.
                     71: *> \endverbatim
                     72: *>
                     73: *> \param[in] A
                     74: *> \verbatim
                     75: *>          A is COMPLEX*16 array, dimension (LDA,N)
                     76: *>     On entry, the N-by-N matrix A.
                     77: *> \endverbatim
                     78: *>
                     79: *> \param[in] LDA
                     80: *> \verbatim
                     81: *>          LDA is INTEGER
                     82: *>     The leading dimension of the array A.  LDA >= max(1,N).
                     83: *> \endverbatim
                     84: *>
                     85: *> \param[in] AF
                     86: *> \verbatim
                     87: *>          AF is COMPLEX*16 array, dimension (LDAF,N)
                     88: *>     The block diagonal matrix D and the multipliers used to
                     89: *>     obtain the factor U or L as computed by ZSYTRF.
                     90: *> \endverbatim
                     91: *>
                     92: *> \param[in] LDAF
                     93: *> \verbatim
                     94: *>          LDAF is INTEGER
                     95: *>     The leading dimension of the array AF.  LDAF >= max(1,N).
                     96: *> \endverbatim
                     97: *>
                     98: *> \param[in] IPIV
                     99: *> \verbatim
                    100: *>          IPIV is INTEGER array, dimension (N)
                    101: *>     Details of the interchanges and the block structure of D
                    102: *>     as determined by ZSYTRF.
                    103: *> \endverbatim
                    104: *>
1.16      bertrand  105: *> \param[out] WORK
1.5       bertrand  106: *> \verbatim
1.11      bertrand  107: *>          WORK is DOUBLE PRECISION array, dimension (2*N)
1.5       bertrand  108: *> \endverbatim
                    109: *
                    110: *  Authors:
                    111: *  ========
                    112: *
1.13      bertrand  113: *> \author Univ. of Tennessee
                    114: *> \author Univ. of California Berkeley
                    115: *> \author Univ. of Colorado Denver
                    116: *> \author NAG Ltd.
1.5       bertrand  117: *
                    118: *> \ingroup complex16SYcomputational
                    119: *
                    120: *  =====================================================================
1.1       bertrand  121:       DOUBLE PRECISION FUNCTION ZLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF,
                    122:      $                                        LDAF, IPIV, WORK )
                    123: *
1.17    ! bertrand  124: *  -- LAPACK computational routine --
1.5       bertrand  125: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    126: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.1       bertrand  127: *
                    128: *     .. Scalar Arguments ..
                    129:       CHARACTER*1        UPLO
                    130:       INTEGER            N, INFO, LDA, LDAF
                    131: *     ..
                    132: *     .. Array Arguments ..
                    133:       COMPLEX*16         A( LDA, * ), AF( LDAF, * )
                    134:       DOUBLE PRECISION   WORK( * )
                    135:       INTEGER            IPIV( * )
                    136: *     ..
                    137: *
                    138: *  =====================================================================
                    139: *
                    140: *     .. Local Scalars ..
                    141:       INTEGER            NCOLS, I, J, K, KP
                    142:       DOUBLE PRECISION   AMAX, UMAX, RPVGRW, TMP
                    143:       LOGICAL            UPPER
                    144:       COMPLEX*16         ZDUM
                    145: *     ..
                    146: *     .. Intrinsic Functions ..
                    147:       INTRINSIC          ABS, REAL, DIMAG, MAX, MIN
                    148: *     ..
                    149: *     .. External Subroutines ..
1.13      bertrand  150:       EXTERNAL           LSAME
1.1       bertrand  151:       LOGICAL            LSAME
                    152: *     ..
                    153: *     .. Statement Functions ..
                    154:       DOUBLE PRECISION   CABS1
                    155: *     ..
                    156: *     .. Statement Function Definitions ..
                    157:       CABS1( ZDUM ) = ABS( DBLE ( ZDUM ) ) + ABS( DIMAG ( ZDUM ) )
                    158: *     ..
                    159: *     .. Executable Statements ..
                    160: *
                    161:       UPPER = LSAME( 'Upper', UPLO )
                    162:       IF ( INFO.EQ.0 ) THEN
                    163:          IF ( UPPER ) THEN
                    164:             NCOLS = 1
                    165:          ELSE
                    166:             NCOLS = N
                    167:          END IF
                    168:       ELSE
                    169:          NCOLS = INFO
                    170:       END IF
                    171: 
                    172:       RPVGRW = 1.0D+0
                    173:       DO I = 1, 2*N
                    174:          WORK( I ) = 0.0D+0
                    175:       END DO
                    176: *
                    177: *     Find the max magnitude entry of each column of A.  Compute the max
                    178: *     for all N columns so we can apply the pivot permutation while
                    179: *     looping below.  Assume a full factorization is the common case.
                    180: *
                    181:       IF ( UPPER ) THEN
                    182:          DO J = 1, N
                    183:             DO I = 1, J
                    184:                WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
                    185:                WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
                    186:             END DO
                    187:          END DO
                    188:       ELSE
                    189:          DO J = 1, N
                    190:             DO I = J, N
                    191:                WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
                    192:                WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
                    193:             END DO
                    194:          END DO
                    195:       END IF
                    196: *
                    197: *     Now find the max magnitude entry of each column of U or L.  Also
                    198: *     permute the magnitudes of A above so they're in the same order as
                    199: *     the factor.
                    200: *
                    201: *     The iteration orders and permutations were copied from zsytrs.
                    202: *     Calls to SSWAP would be severe overkill.
                    203: *
                    204:       IF ( UPPER ) THEN
                    205:          K = N
                    206:          DO WHILE ( K .LT. NCOLS .AND. K.GT.0 )
                    207:             IF ( IPIV( K ).GT.0 ) THEN
                    208: !              1x1 pivot
                    209:                KP = IPIV( K )
                    210:                IF ( KP .NE. K ) THEN
                    211:                   TMP = WORK( N+K )
                    212:                   WORK( N+K ) = WORK( N+KP )
                    213:                   WORK( N+KP ) = TMP
                    214:                END IF
                    215:                DO I = 1, K
                    216:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
                    217:                END DO
                    218:                K = K - 1
                    219:             ELSE
                    220: !              2x2 pivot
                    221:                KP = -IPIV( K )
                    222:                TMP = WORK( N+K-1 )
                    223:                WORK( N+K-1 ) = WORK( N+KP )
                    224:                WORK( N+KP ) = TMP
                    225:                DO I = 1, K-1
                    226:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
                    227:                   WORK( K-1 ) =
                    228:      $                 MAX( CABS1( AF( I, K-1 ) ), WORK( K-1 ) )
                    229:                END DO
                    230:                WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
                    231:                K = K - 2
                    232:             END IF
                    233:          END DO
                    234:          K = NCOLS
                    235:          DO WHILE ( K .LE. N )
                    236:             IF ( IPIV( K ).GT.0 ) THEN
                    237:                KP = IPIV( K )
                    238:                IF ( KP .NE. K ) THEN
                    239:                   TMP = WORK( N+K )
                    240:                   WORK( N+K ) = WORK( N+KP )
                    241:                   WORK( N+KP ) = TMP
                    242:                END IF
                    243:                K = K + 1
                    244:             ELSE
                    245:                KP = -IPIV( K )
                    246:                TMP = WORK( N+K )
                    247:                WORK( N+K ) = WORK( N+KP )
                    248:                WORK( N+KP ) = TMP
                    249:                K = K + 2
                    250:             END IF
                    251:          END DO
                    252:       ELSE
                    253:          K = 1
                    254:          DO WHILE ( K .LE. NCOLS )
                    255:             IF ( IPIV( K ).GT.0 ) THEN
                    256: !              1x1 pivot
                    257:                KP = IPIV( K )
                    258:                IF ( KP .NE. K ) THEN
                    259:                   TMP = WORK( N+K )
                    260:                   WORK( N+K ) = WORK( N+KP )
                    261:                   WORK( N+KP ) = TMP
                    262:                END IF
                    263:                DO I = K, N
                    264:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
                    265:                END DO
                    266:                K = K + 1
                    267:             ELSE
                    268: !              2x2 pivot
                    269:                KP = -IPIV( K )
                    270:                TMP = WORK( N+K+1 )
                    271:                WORK( N+K+1 ) = WORK( N+KP )
                    272:                WORK( N+KP ) = TMP
                    273:                DO I = K+1, N
                    274:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
                    275:                   WORK( K+1 ) =
                    276:      $                 MAX( CABS1( AF( I, K+1 ) ), WORK( K+1 ) )
                    277:                END DO
                    278:                WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
                    279:                K = K + 2
                    280:             END IF
                    281:          END DO
                    282:          K = NCOLS
                    283:          DO WHILE ( K .GE. 1 )
                    284:             IF ( IPIV( K ).GT.0 ) THEN
                    285:                KP = IPIV( K )
                    286:                IF ( KP .NE. K ) THEN
                    287:                   TMP = WORK( N+K )
                    288:                   WORK( N+K ) = WORK( N+KP )
                    289:                   WORK( N+KP ) = TMP
                    290:                END IF
                    291:                K = K - 1
                    292:             ELSE
                    293:                KP = -IPIV( K )
                    294:                TMP = WORK( N+K )
                    295:                WORK( N+K ) = WORK( N+KP )
                    296:                WORK( N+KP ) = TMP
                    297:                K = K - 2
                    298:             ENDIF
                    299:          END DO
                    300:       END IF
                    301: *
                    302: *     Compute the *inverse* of the max element growth factor.  Dividing
                    303: *     by zero would imply the largest entry of the factor's column is
                    304: *     zero.  Than can happen when either the column of A is zero or
                    305: *     massive pivots made the factor underflow to zero.  Neither counts
                    306: *     as growth in itself, so simply ignore terms with zero
                    307: *     denominators.
                    308: *
                    309:       IF ( UPPER ) THEN
                    310:          DO I = NCOLS, N
                    311:             UMAX = WORK( I )
                    312:             AMAX = WORK( N+I )
                    313:             IF ( UMAX /= 0.0D+0 ) THEN
                    314:                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
                    315:             END IF
                    316:          END DO
                    317:       ELSE
                    318:          DO I = 1, NCOLS
                    319:             UMAX = WORK( I )
                    320:             AMAX = WORK( N+I )
                    321:             IF ( UMAX /= 0.0D+0 ) THEN
                    322:                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
                    323:             END IF
                    324:          END DO
                    325:       END IF
                    326: 
                    327:       ZLA_SYRPVGRW = RPVGRW
1.17    ! bertrand  328: *
        !           329: *     End of ZLA_SYRPVGRW
        !           330: *
1.1       bertrand  331:       END

CVSweb interface <joel.bertrand@systella.fr>