File:  [local] / rpl / lapack / lapack / zla_herpvgrw.f
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:39:27 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    1: *> \brief \b ZLA_HERPVGRW
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    9: *> Download ZLA_HERPVGRW + dependencies
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zla_herpvgrw.f">
   11: *> [TGZ]</a>
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zla_herpvgrw.f">
   13: *> [ZIP]</a>
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zla_herpvgrw.f">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       DOUBLE PRECISION FUNCTION ZLA_HERPVGRW( UPLO, N, INFO, A, LDA, AF,
   22: *                                               LDAF, IPIV, WORK )
   23: *
   24: *       .. Scalar Arguments ..
   25: *       CHARACTER*1        UPLO
   26: *       INTEGER            N, INFO, LDA, LDAF
   27: *       ..
   28: *       .. Array Arguments ..
   29: *       INTEGER            IPIV( * )
   30: *       COMPLEX*16         A( LDA, * ), AF( LDAF, * )
   31: *       DOUBLE PRECISION   WORK( * )
   32: *       ..
   33: *
   34: *
   35: *> \par Purpose:
   36: *  =============
   37: *>
   38: *> \verbatim
   39: *>
   40: *>
   41: *> ZLA_HERPVGRW 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 ZHETRF, .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 ZHETRF.
   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 ZHETRF.
  103: *> \endverbatim
  104: *>
  105: *> \param[out] WORK
  106: *> \verbatim
  107: *>          WORK is DOUBLE PRECISION array, dimension (2*N)
  108: *> \endverbatim
  109: *
  110: *  Authors:
  111: *  ========
  112: *
  113: *> \author Univ. of Tennessee
  114: *> \author Univ. of California Berkeley
  115: *> \author Univ. of Colorado Denver
  116: *> \author NAG Ltd.
  117: *
  118: *> \ingroup complex16HEcomputational
  119: *
  120: *  =====================================================================
  121:       DOUBLE PRECISION FUNCTION ZLA_HERPVGRW( UPLO, N, INFO, A, LDA, AF,
  122:      $                                        LDAF, IPIV, WORK )
  123: *
  124: *  -- LAPACK computational routine --
  125: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  126: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  127: *
  128: *     .. Scalar Arguments ..
  129:       CHARACTER*1        UPLO
  130:       INTEGER            N, INFO, LDA, LDAF
  131: *     ..
  132: *     .. Array Arguments ..
  133:       INTEGER            IPIV( * )
  134:       COMPLEX*16         A( LDA, * ), AF( LDAF, * )
  135:       DOUBLE PRECISION   WORK( * )
  136: *     ..
  137: *
  138: *  =====================================================================
  139: *
  140: *     .. Local Scalars ..
  141:       INTEGER            NCOLS, I, J, K, KP
  142:       DOUBLE PRECISION   AMAX, UMAX, RPVGRW, TMP
  143:       LOGICAL            UPPER, LSAME
  144:       COMPLEX*16         ZDUM
  145: *     ..
  146: *     .. External Functions ..
  147:       EXTERNAL           LSAME
  148: *     ..
  149: *     .. Intrinsic Functions ..
  150:       INTRINSIC          ABS, REAL, DIMAG, MAX, MIN
  151: *     ..
  152: *     .. Statement Functions ..
  153:       DOUBLE PRECISION   CABS1
  154: *     ..
  155: *     .. Statement Function Definitions ..
  156:       CABS1( ZDUM ) = ABS( DBLE ( ZDUM ) ) + ABS( DIMAG ( ZDUM ) )
  157: *     ..
  158: *     .. Executable Statements ..
  159: *
  160:       UPPER = LSAME( 'Upper', UPLO )
  161:       IF ( INFO.EQ.0 ) THEN
  162:          IF (UPPER) THEN
  163:             NCOLS = 1
  164:          ELSE
  165:             NCOLS = N
  166:          END IF
  167:       ELSE
  168:          NCOLS = INFO
  169:       END IF
  170: 
  171:       RPVGRW = 1.0D+0
  172:       DO I = 1, 2*N
  173:          WORK( I ) = 0.0D+0
  174:       END DO
  175: *
  176: *     Find the max magnitude entry of each column of A.  Compute the max
  177: *     for all N columns so we can apply the pivot permutation while
  178: *     looping below.  Assume a full factorization is the common case.
  179: *
  180:       IF ( UPPER ) THEN
  181:          DO J = 1, N
  182:             DO I = 1, J
  183:                WORK( N+I ) = MAX( CABS1( A( I,J ) ), WORK( N+I ) )
  184:                WORK( N+J ) = MAX( CABS1( A( I,J ) ), WORK( N+J ) )
  185:             END DO
  186:          END DO
  187:       ELSE
  188:          DO J = 1, N
  189:             DO I = J, N
  190:                WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
  191:                WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
  192:             END DO
  193:          END DO
  194:       END IF
  195: *
  196: *     Now find the max magnitude entry of each column of U or L.  Also
  197: *     permute the magnitudes of A above so they're in the same order as
  198: *     the factor.
  199: *
  200: *     The iteration orders and permutations were copied from zsytrs.
  201: *     Calls to SSWAP would be severe overkill.
  202: *
  203:       IF ( UPPER ) THEN
  204:          K = N
  205:          DO WHILE ( K .LT. NCOLS .AND. K.GT.0 )
  206:             IF ( IPIV( K ).GT.0 ) THEN
  207: !              1x1 pivot
  208:                KP = IPIV( K )
  209:                IF ( KP .NE. K ) THEN
  210:                   TMP = WORK( N+K )
  211:                   WORK( N+K ) = WORK( N+KP )
  212:                   WORK( N+KP ) = TMP
  213:                END IF
  214:                DO I = 1, K
  215:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
  216:                END DO
  217:                K = K - 1
  218:             ELSE
  219: !              2x2 pivot
  220:                KP = -IPIV( K )
  221:                TMP = WORK( N+K-1 )
  222:                WORK( N+K-1 ) = WORK( N+KP )
  223:                WORK( N+KP ) = TMP
  224:                DO I = 1, K-1
  225:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
  226:                   WORK( K-1 ) =
  227:      $                 MAX( CABS1( AF( I, K-1 ) ), WORK( K-1 ) )
  228:                END DO
  229:                WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
  230:                K = K - 2
  231:             END IF
  232:          END DO
  233:          K = NCOLS
  234:          DO WHILE ( K .LE. N )
  235:             IF ( IPIV( K ).GT.0 ) THEN
  236:                KP = IPIV( K )
  237:                IF ( KP .NE. K ) THEN
  238:                   TMP = WORK( N+K )
  239:                   WORK( N+K ) = WORK( N+KP )
  240:                   WORK( N+KP ) = TMP
  241:                END IF
  242:                K = K + 1
  243:             ELSE
  244:                KP = -IPIV( K )
  245:                TMP = WORK( N+K )
  246:                WORK( N+K ) = WORK( N+KP )
  247:                WORK( N+KP ) = TMP
  248:                K = K + 2
  249:             END IF
  250:          END DO
  251:       ELSE
  252:          K = 1
  253:          DO WHILE ( K .LE. NCOLS )
  254:             IF ( IPIV( K ).GT.0 ) THEN
  255: !              1x1 pivot
  256:                KP = IPIV( K )
  257:                IF ( KP .NE. K ) THEN
  258:                   TMP = WORK( N+K )
  259:                   WORK( N+K ) = WORK( N+KP )
  260:                   WORK( N+KP ) = TMP
  261:                END IF
  262:                DO I = K, N
  263:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
  264:                END DO
  265:                K = K + 1
  266:             ELSE
  267: !              2x2 pivot
  268:                KP = -IPIV( K )
  269:                TMP = WORK( N+K+1 )
  270:                WORK( N+K+1 ) = WORK( N+KP )
  271:                WORK( N+KP ) = TMP
  272:                DO I = K+1, N
  273:                   WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
  274:                   WORK( K+1 ) =
  275:      $                 MAX( CABS1( AF( I, K+1 ) ) , WORK( K+1 ) )
  276:                END DO
  277:                WORK(K) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
  278:                K = K + 2
  279:             END IF
  280:          END DO
  281:          K = NCOLS
  282:          DO WHILE ( K .GE. 1 )
  283:             IF ( IPIV( K ).GT.0 ) THEN
  284:                KP = IPIV( K )
  285:                IF ( KP .NE. K ) THEN
  286:                   TMP = WORK( N+K )
  287:                   WORK( N+K ) = WORK( N+KP )
  288:                   WORK( N+KP ) = TMP
  289:                END IF
  290:                K = K - 1
  291:             ELSE
  292:                KP = -IPIV( K )
  293:                TMP = WORK( N+K )
  294:                WORK( N+K ) = WORK( N+KP )
  295:                WORK( N+KP ) = TMP
  296:                K = K - 2
  297:             ENDIF
  298:          END DO
  299:       END IF
  300: *
  301: *     Compute the *inverse* of the max element growth factor.  Dividing
  302: *     by zero would imply the largest entry of the factor's column is
  303: *     zero.  Than can happen when either the column of A is zero or
  304: *     massive pivots made the factor underflow to zero.  Neither counts
  305: *     as growth in itself, so simply ignore terms with zero
  306: *     denominators.
  307: *
  308:       IF ( UPPER ) THEN
  309:          DO I = NCOLS, N
  310:             UMAX = WORK( I )
  311:             AMAX = WORK( N+I )
  312:             IF ( UMAX /= 0.0D+0 ) THEN
  313:                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
  314:             END IF
  315:          END DO
  316:       ELSE
  317:          DO I = 1, NCOLS
  318:             UMAX = WORK( I )
  319:             AMAX = WORK( N+I )
  320:             IF ( UMAX /= 0.0D+0 ) THEN
  321:                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
  322:             END IF
  323:          END DO
  324:       END IF
  325: 
  326:       ZLA_HERPVGRW = RPVGRW
  327: *
  328: *     End of ZLA_HERPVGRW
  329: *
  330:       END

CVSweb interface <joel.bertrand@systella.fr>