Annotation of rpl/lapack/blas/zhpmv.f, revision 1.16

1.8       bertrand    1: *> \brief \b ZHPMV
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.13      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.8       bertrand    7: *
                      8: *  Definition:
                      9: *  ===========
                     10: *
                     11: *       SUBROUTINE ZHPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
1.13      bertrand   12: *
1.8       bertrand   13: *       .. Scalar Arguments ..
                     14: *       COMPLEX*16 ALPHA,BETA
                     15: *       INTEGER INCX,INCY,N
                     16: *       CHARACTER UPLO
                     17: *       ..
                     18: *       .. Array Arguments ..
                     19: *       COMPLEX*16 AP(*),X(*),Y(*)
                     20: *       ..
1.13      bertrand   21: *
1.8       bertrand   22: *
                     23: *> \par Purpose:
                     24: *  =============
                     25: *>
                     26: *> \verbatim
                     27: *>
                     28: *> ZHPMV  performs the matrix-vector operation
                     29: *>
                     30: *>    y := alpha*A*x + beta*y,
                     31: *>
                     32: *> where alpha and beta are scalars, x and y are n element vectors and
                     33: *> A is an 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 COMPLEX*16
                     63: *>           On entry, ALPHA specifies the scalar alpha.
                     64: *> \endverbatim
                     65: *>
                     66: *> \param[in] AP
                     67: *> \verbatim
1.14      bertrand   68: *>          AP is COMPLEX*16 array, dimension at least
1.8       bertrand   69: *>           ( ( n*( n + 1 ) )/2 ).
                     70: *>           Before entry with UPLO = 'U' or 'u', the array AP must
                     71: *>           contain the upper triangular part of the hermitian matrix
                     72: *>           packed sequentially, column by column, so that AP( 1 )
                     73: *>           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
                     74: *>           and a( 2, 2 ) respectively, and so on.
                     75: *>           Before entry with UPLO = 'L' or 'l', the array AP must
                     76: *>           contain the lower triangular part of the hermitian matrix
                     77: *>           packed sequentially, column by column, so that AP( 1 )
                     78: *>           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
                     79: *>           and a( 3, 1 ) respectively, and so on.
                     80: *>           Note that the imaginary parts of the diagonal elements need
                     81: *>           not be set and are assumed to be zero.
                     82: *> \endverbatim
                     83: *>
                     84: *> \param[in] X
                     85: *> \verbatim
1.14      bertrand   86: *>          X is COMPLEX*16 array, dimension at least
1.8       bertrand   87: *>           ( 1 + ( n - 1 )*abs( INCX ) ).
                     88: *>           Before entry, the incremented array X must contain the n
                     89: *>           element vector x.
                     90: *> \endverbatim
                     91: *>
                     92: *> \param[in] INCX
                     93: *> \verbatim
                     94: *>          INCX is INTEGER
                     95: *>           On entry, INCX specifies the increment for the elements of
                     96: *>           X. INCX must not be zero.
                     97: *> \endverbatim
                     98: *>
                     99: *> \param[in] BETA
                    100: *> \verbatim
                    101: *>          BETA is COMPLEX*16
                    102: *>           On entry, BETA specifies the scalar beta. When BETA is
                    103: *>           supplied as zero then Y need not be set on input.
                    104: *> \endverbatim
                    105: *>
                    106: *> \param[in,out] Y
                    107: *> \verbatim
1.14      bertrand  108: *>          Y is COMPLEX*16 array, dimension at least
1.8       bertrand  109: *>           ( 1 + ( n - 1 )*abs( INCY ) ).
                    110: *>           Before entry, the incremented array Y must contain the n
                    111: *>           element vector y. On exit, Y is overwritten by the updated
                    112: *>           vector y.
                    113: *> \endverbatim
                    114: *>
                    115: *> \param[in] INCY
                    116: *> \verbatim
                    117: *>          INCY is INTEGER
                    118: *>           On entry, INCY specifies the increment for the elements of
                    119: *>           Y. INCY must not be zero.
                    120: *> \endverbatim
                    121: *
                    122: *  Authors:
                    123: *  ========
                    124: *
1.13      bertrand  125: *> \author Univ. of Tennessee
                    126: *> \author Univ. of California Berkeley
                    127: *> \author Univ. of Colorado Denver
                    128: *> \author NAG Ltd.
1.8       bertrand  129: *
                    130: *> \ingroup complex16_blas_level2
                    131: *
                    132: *> \par Further Details:
                    133: *  =====================
                    134: *>
                    135: *> \verbatim
                    136: *>
                    137: *>  Level 2 Blas routine.
                    138: *>  The vector and matrix arguments are not referenced when N = 0, or M = 0
                    139: *>
                    140: *>  -- Written on 22-October-1986.
                    141: *>     Jack Dongarra, Argonne National Lab.
                    142: *>     Jeremy Du Croz, Nag Central Office.
                    143: *>     Sven Hammarling, Nag Central Office.
                    144: *>     Richard Hanson, Sandia National Labs.
                    145: *> \endverbatim
                    146: *>
                    147: *  =====================================================================
1.1       bertrand  148:       SUBROUTINE ZHPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
1.8       bertrand  149: *
1.16    ! bertrand  150: *  -- Reference BLAS level2 routine --
1.8       bertrand  151: *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
                    152: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    153: *
1.1       bertrand  154: *     .. Scalar Arguments ..
1.8       bertrand  155:       COMPLEX*16 ALPHA,BETA
1.1       bertrand  156:       INTEGER INCX,INCY,N
                    157:       CHARACTER UPLO
                    158: *     ..
                    159: *     .. Array Arguments ..
1.8       bertrand  160:       COMPLEX*16 AP(*),X(*),Y(*)
1.1       bertrand  161: *     ..
                    162: *
                    163: *  =====================================================================
                    164: *
                    165: *     .. Parameters ..
1.8       bertrand  166:       COMPLEX*16 ONE
1.1       bertrand  167:       PARAMETER (ONE= (1.0D+0,0.0D+0))
1.8       bertrand  168:       COMPLEX*16 ZERO
1.1       bertrand  169:       PARAMETER (ZERO= (0.0D+0,0.0D+0))
                    170: *     ..
                    171: *     .. Local Scalars ..
1.8       bertrand  172:       COMPLEX*16 TEMP1,TEMP2
1.1       bertrand  173:       INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY
                    174: *     ..
                    175: *     .. External Functions ..
                    176:       LOGICAL LSAME
                    177:       EXTERNAL LSAME
                    178: *     ..
                    179: *     .. External Subroutines ..
                    180:       EXTERNAL XERBLA
                    181: *     ..
                    182: *     .. Intrinsic Functions ..
                    183:       INTRINSIC DBLE,DCONJG
                    184: *     ..
                    185: *
                    186: *     Test the input parameters.
                    187: *
                    188:       INFO = 0
                    189:       IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
                    190:           INFO = 1
                    191:       ELSE IF (N.LT.0) THEN
                    192:           INFO = 2
                    193:       ELSE IF (INCX.EQ.0) THEN
                    194:           INFO = 6
                    195:       ELSE IF (INCY.EQ.0) THEN
                    196:           INFO = 9
                    197:       END IF
                    198:       IF (INFO.NE.0) THEN
                    199:           CALL XERBLA('ZHPMV ',INFO)
                    200:           RETURN
                    201:       END IF
                    202: *
                    203: *     Quick return if possible.
                    204: *
                    205:       IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
                    206: *
                    207: *     Set up the start points in  X  and  Y.
                    208: *
                    209:       IF (INCX.GT.0) THEN
                    210:           KX = 1
                    211:       ELSE
                    212:           KX = 1 - (N-1)*INCX
                    213:       END IF
                    214:       IF (INCY.GT.0) THEN
                    215:           KY = 1
                    216:       ELSE
                    217:           KY = 1 - (N-1)*INCY
                    218:       END IF
                    219: *
                    220: *     Start the operations. In this version the elements of the array AP
                    221: *     are accessed sequentially with one pass through AP.
                    222: *
                    223: *     First form  y := beta*y.
                    224: *
                    225:       IF (BETA.NE.ONE) THEN
                    226:           IF (INCY.EQ.1) THEN
                    227:               IF (BETA.EQ.ZERO) THEN
                    228:                   DO 10 I = 1,N
                    229:                       Y(I) = ZERO
                    230:    10             CONTINUE
                    231:               ELSE
                    232:                   DO 20 I = 1,N
                    233:                       Y(I) = BETA*Y(I)
                    234:    20             CONTINUE
                    235:               END IF
                    236:           ELSE
                    237:               IY = KY
                    238:               IF (BETA.EQ.ZERO) THEN
                    239:                   DO 30 I = 1,N
                    240:                       Y(IY) = ZERO
                    241:                       IY = IY + INCY
                    242:    30             CONTINUE
                    243:               ELSE
                    244:                   DO 40 I = 1,N
                    245:                       Y(IY) = BETA*Y(IY)
                    246:                       IY = IY + INCY
                    247:    40             CONTINUE
                    248:               END IF
                    249:           END IF
                    250:       END IF
                    251:       IF (ALPHA.EQ.ZERO) RETURN
                    252:       KK = 1
                    253:       IF (LSAME(UPLO,'U')) THEN
                    254: *
                    255: *        Form  y  when AP contains the upper triangle.
                    256: *
                    257:           IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
                    258:               DO 60 J = 1,N
                    259:                   TEMP1 = ALPHA*X(J)
                    260:                   TEMP2 = ZERO
                    261:                   K = KK
                    262:                   DO 50 I = 1,J - 1
                    263:                       Y(I) = Y(I) + TEMP1*AP(K)
                    264:                       TEMP2 = TEMP2 + DCONJG(AP(K))*X(I)
                    265:                       K = K + 1
                    266:    50             CONTINUE
                    267:                   Y(J) = Y(J) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2
                    268:                   KK = KK + J
                    269:    60         CONTINUE
                    270:           ELSE
                    271:               JX = KX
                    272:               JY = KY
                    273:               DO 80 J = 1,N
                    274:                   TEMP1 = ALPHA*X(JX)
                    275:                   TEMP2 = ZERO
                    276:                   IX = KX
                    277:                   IY = KY
                    278:                   DO 70 K = KK,KK + J - 2
                    279:                       Y(IY) = Y(IY) + TEMP1*AP(K)
                    280:                       TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX)
                    281:                       IX = IX + INCX
                    282:                       IY = IY + INCY
                    283:    70             CONTINUE
                    284:                   Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2
                    285:                   JX = JX + INCX
                    286:                   JY = JY + INCY
                    287:                   KK = KK + J
                    288:    80         CONTINUE
                    289:           END IF
                    290:       ELSE
                    291: *
                    292: *        Form  y  when AP contains the lower triangle.
                    293: *
                    294:           IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
                    295:               DO 100 J = 1,N
                    296:                   TEMP1 = ALPHA*X(J)
                    297:                   TEMP2 = ZERO
                    298:                   Y(J) = Y(J) + TEMP1*DBLE(AP(KK))
                    299:                   K = KK + 1
                    300:                   DO 90 I = J + 1,N
                    301:                       Y(I) = Y(I) + TEMP1*AP(K)
                    302:                       TEMP2 = TEMP2 + DCONJG(AP(K))*X(I)
                    303:                       K = K + 1
                    304:    90             CONTINUE
                    305:                   Y(J) = Y(J) + ALPHA*TEMP2
                    306:                   KK = KK + (N-J+1)
                    307:   100         CONTINUE
                    308:           ELSE
                    309:               JX = KX
                    310:               JY = KY
                    311:               DO 120 J = 1,N
                    312:                   TEMP1 = ALPHA*X(JX)
                    313:                   TEMP2 = ZERO
                    314:                   Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK))
                    315:                   IX = JX
                    316:                   IY = JY
                    317:                   DO 110 K = KK + 1,KK + N - J
                    318:                       IX = IX + INCX
                    319:                       IY = IY + INCY
                    320:                       Y(IY) = Y(IY) + TEMP1*AP(K)
                    321:                       TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX)
                    322:   110             CONTINUE
                    323:                   Y(JY) = Y(JY) + ALPHA*TEMP2
                    324:                   JX = JX + INCX
                    325:                   JY = JY + INCY
                    326:                   KK = KK + (N-J+1)
                    327:   120         CONTINUE
                    328:           END IF
                    329:       END IF
                    330: *
                    331:       RETURN
                    332: *
1.16    ! bertrand  333: *     End of ZHPMV
1.1       bertrand  334: *
                    335:       END

CVSweb interface <joel.bertrand@systella.fr>