File:  [local] / rpl / lapack / blas / zhpr.f
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:45 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 ZHPR
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *  Definition:
    9: *  ===========
   10: *
   11: *       SUBROUTINE ZHPR(UPLO,N,ALPHA,X,INCX,AP)
   12: *
   13: *       .. Scalar Arguments ..
   14: *       DOUBLE PRECISION ALPHA
   15: *       INTEGER INCX,N
   16: *       CHARACTER UPLO
   17: *       ..
   18: *       .. Array Arguments ..
   19: *       COMPLEX*16 AP(*),X(*)
   20: *       ..
   21: *
   22: *
   23: *> \par Purpose:
   24: *  =============
   25: *>
   26: *> \verbatim
   27: *>
   28: *> ZHPR    performs the hermitian rank 1 operation
   29: *>
   30: *>    A := alpha*x*x**H + A,
   31: *>
   32: *> where alpha is a real scalar, x is an n element vector and A is an
   33: *> n by n hermitian matrix, supplied in packed form.
   34: *> \endverbatim
   35: *
   36: *  Arguments:
   37: *  ==========
   38: *
   39: *> \param[in] UPLO
   40: *> \verbatim
   41: *>          UPLO is CHARACTER*1
   42: *>           On entry, UPLO specifies whether the upper or lower
   43: *>           triangular part of the matrix A is supplied in the packed
   44: *>           array AP as follows:
   45: *>
   46: *>              UPLO = 'U' or 'u'   The upper triangular part of A is
   47: *>                                  supplied in AP.
   48: *>
   49: *>              UPLO = 'L' or 'l'   The lower triangular part of A is
   50: *>                                  supplied in AP.
   51: *> \endverbatim
   52: *>
   53: *> \param[in] N
   54: *> \verbatim
   55: *>          N is INTEGER
   56: *>           On entry, N specifies the order of the matrix A.
   57: *>           N must be at least zero.
   58: *> \endverbatim
   59: *>
   60: *> \param[in] ALPHA
   61: *> \verbatim
   62: *>          ALPHA is DOUBLE PRECISION.
   63: *>           On entry, ALPHA specifies the scalar alpha.
   64: *> \endverbatim
   65: *>
   66: *> \param[in] X
   67: *> \verbatim
   68: *>          X is COMPLEX*16 array, dimension at least
   69: *>           ( 1 + ( n - 1 )*abs( INCX ) ).
   70: *>           Before entry, the incremented array X must contain the n
   71: *>           element vector x.
   72: *> \endverbatim
   73: *>
   74: *> \param[in] INCX
   75: *> \verbatim
   76: *>          INCX is INTEGER
   77: *>           On entry, INCX specifies the increment for the elements of
   78: *>           X. INCX must not be zero.
   79: *> \endverbatim
   80: *>
   81: *> \param[in,out] AP
   82: *> \verbatim
   83: *>          AP is COMPLEX*16 array, dimension at least
   84: *>           ( ( n*( n + 1 ) )/2 ).
   85: *>           Before entry with  UPLO = 'U' or 'u', the array AP must
   86: *>           contain the upper triangular part of the hermitian matrix
   87: *>           packed sequentially, column by column, so that AP( 1 )
   88: *>           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
   89: *>           and a( 2, 2 ) respectively, and so on. On exit, the array
   90: *>           AP is overwritten by the upper triangular part of the
   91: *>           updated matrix.
   92: *>           Before entry with UPLO = 'L' or 'l', the array AP must
   93: *>           contain the lower triangular part of the hermitian matrix
   94: *>           packed sequentially, column by column, so that AP( 1 )
   95: *>           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
   96: *>           and a( 3, 1 ) respectively, and so on. On exit, the array
   97: *>           AP is overwritten by the lower triangular part of the
   98: *>           updated matrix.
   99: *>           Note that the imaginary parts of the diagonal elements need
  100: *>           not be set, they are assumed to be zero, and on exit they
  101: *>           are set to zero.
  102: *> \endverbatim
  103: *
  104: *  Authors:
  105: *  ========
  106: *
  107: *> \author Univ. of Tennessee
  108: *> \author Univ. of California Berkeley
  109: *> \author Univ. of Colorado Denver
  110: *> \author NAG Ltd.
  111: *
  112: *> \ingroup complex16_blas_level2
  113: *
  114: *> \par Further Details:
  115: *  =====================
  116: *>
  117: *> \verbatim
  118: *>
  119: *>  Level 2 Blas routine.
  120: *>
  121: *>  -- Written on 22-October-1986.
  122: *>     Jack Dongarra, Argonne National Lab.
  123: *>     Jeremy Du Croz, Nag Central Office.
  124: *>     Sven Hammarling, Nag Central Office.
  125: *>     Richard Hanson, Sandia National Labs.
  126: *> \endverbatim
  127: *>
  128: *  =====================================================================
  129:       SUBROUTINE ZHPR(UPLO,N,ALPHA,X,INCX,AP)
  130: *
  131: *  -- Reference BLAS level2 routine --
  132: *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
  133: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  134: *
  135: *     .. Scalar Arguments ..
  136:       DOUBLE PRECISION ALPHA
  137:       INTEGER INCX,N
  138:       CHARACTER UPLO
  139: *     ..
  140: *     .. Array Arguments ..
  141:       COMPLEX*16 AP(*),X(*)
  142: *     ..
  143: *
  144: *  =====================================================================
  145: *
  146: *     .. Parameters ..
  147:       COMPLEX*16 ZERO
  148:       PARAMETER (ZERO= (0.0D+0,0.0D+0))
  149: *     ..
  150: *     .. Local Scalars ..
  151:       COMPLEX*16 TEMP
  152:       INTEGER I,INFO,IX,J,JX,K,KK,KX
  153: *     ..
  154: *     .. External Functions ..
  155:       LOGICAL LSAME
  156:       EXTERNAL LSAME
  157: *     ..
  158: *     .. External Subroutines ..
  159:       EXTERNAL XERBLA
  160: *     ..
  161: *     .. Intrinsic Functions ..
  162:       INTRINSIC DBLE,DCONJG
  163: *     ..
  164: *
  165: *     Test the input parameters.
  166: *
  167:       INFO = 0
  168:       IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
  169:           INFO = 1
  170:       ELSE IF (N.LT.0) THEN
  171:           INFO = 2
  172:       ELSE IF (INCX.EQ.0) THEN
  173:           INFO = 5
  174:       END IF
  175:       IF (INFO.NE.0) THEN
  176:           CALL XERBLA('ZHPR  ',INFO)
  177:           RETURN
  178:       END IF
  179: *
  180: *     Quick return if possible.
  181: *
  182:       IF ((N.EQ.0) .OR. (ALPHA.EQ.DBLE(ZERO))) RETURN
  183: *
  184: *     Set the start point in X if the increment is not unity.
  185: *
  186:       IF (INCX.LE.0) THEN
  187:           KX = 1 - (N-1)*INCX
  188:       ELSE IF (INCX.NE.1) THEN
  189:           KX = 1
  190:       END IF
  191: *
  192: *     Start the operations. In this version the elements of the array AP
  193: *     are accessed sequentially with one pass through AP.
  194: *
  195:       KK = 1
  196:       IF (LSAME(UPLO,'U')) THEN
  197: *
  198: *        Form  A  when upper triangle is stored in AP.
  199: *
  200:           IF (INCX.EQ.1) THEN
  201:               DO 20 J = 1,N
  202:                   IF (X(J).NE.ZERO) THEN
  203:                       TEMP = ALPHA*DCONJG(X(J))
  204:                       K = KK
  205:                       DO 10 I = 1,J - 1
  206:                           AP(K) = AP(K) + X(I)*TEMP
  207:                           K = K + 1
  208:    10                 CONTINUE
  209:                       AP(KK+J-1) = DBLE(AP(KK+J-1)) + DBLE(X(J)*TEMP)
  210:                   ELSE
  211:                       AP(KK+J-1) = DBLE(AP(KK+J-1))
  212:                   END IF
  213:                   KK = KK + J
  214:    20         CONTINUE
  215:           ELSE
  216:               JX = KX
  217:               DO 40 J = 1,N
  218:                   IF (X(JX).NE.ZERO) THEN
  219:                       TEMP = ALPHA*DCONJG(X(JX))
  220:                       IX = KX
  221:                       DO 30 K = KK,KK + J - 2
  222:                           AP(K) = AP(K) + X(IX)*TEMP
  223:                           IX = IX + INCX
  224:    30                 CONTINUE
  225:                       AP(KK+J-1) = DBLE(AP(KK+J-1)) + DBLE(X(JX)*TEMP)
  226:                   ELSE
  227:                       AP(KK+J-1) = DBLE(AP(KK+J-1))
  228:                   END IF
  229:                   JX = JX + INCX
  230:                   KK = KK + J
  231:    40         CONTINUE
  232:           END IF
  233:       ELSE
  234: *
  235: *        Form  A  when lower triangle is stored in AP.
  236: *
  237:           IF (INCX.EQ.1) THEN
  238:               DO 60 J = 1,N
  239:                   IF (X(J).NE.ZERO) THEN
  240:                       TEMP = ALPHA*DCONJG(X(J))
  241:                       AP(KK) = DBLE(AP(KK)) + DBLE(TEMP*X(J))
  242:                       K = KK + 1
  243:                       DO 50 I = J + 1,N
  244:                           AP(K) = AP(K) + X(I)*TEMP
  245:                           K = K + 1
  246:    50                 CONTINUE
  247:                   ELSE
  248:                       AP(KK) = DBLE(AP(KK))
  249:                   END IF
  250:                   KK = KK + N - J + 1
  251:    60         CONTINUE
  252:           ELSE
  253:               JX = KX
  254:               DO 80 J = 1,N
  255:                   IF (X(JX).NE.ZERO) THEN
  256:                       TEMP = ALPHA*DCONJG(X(JX))
  257:                       AP(KK) = DBLE(AP(KK)) + DBLE(TEMP*X(JX))
  258:                       IX = JX
  259:                       DO 70 K = KK + 1,KK + N - J
  260:                           IX = IX + INCX
  261:                           AP(K) = AP(K) + X(IX)*TEMP
  262:    70                 CONTINUE
  263:                   ELSE
  264:                       AP(KK) = DBLE(AP(KK))
  265:                   END IF
  266:                   JX = JX + INCX
  267:                   KK = KK + N - J + 1
  268:    80         CONTINUE
  269:           END IF
  270:       END IF
  271: *
  272:       RETURN
  273: *
  274: *     End of ZHPR
  275: *
  276:       END

CVSweb interface <joel.bertrand@systella.fr>