kusano 2b45e8
      SUBROUTINE ZHEMVF ( UPLO, N, ALPHA, A, LDA, X, INCX,
kusano 2b45e8
     $                   BETA, Y, INCY )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      COMPLEX*16         ALPHA, BETA
kusano 2b45e8
      INTEGER            INCX, INCY, LDA, N
kusano 2b45e8
      CHARACTER*1        UPLO
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( LDA, * ), X( * ), Y( * )
kusano 2b45e8
*     ..
kusano 2b45e8
*
kusano 2b45e8
*  Purpose
kusano 2b45e8
*  =======
kusano 2b45e8
*
kusano 2b45e8
*  ZHEMV  performs the matrix-vector  operation
kusano 2b45e8
*
kusano 2b45e8
*     y := alpha*A*x + beta*y,
kusano 2b45e8
*
kusano 2b45e8
*  where alpha and beta are scalars, x and y are n element vectors and
kusano 2b45e8
*  A is an n by n hermitian matrix.
kusano 2b45e8
*
kusano 2b45e8
*  Parameters
kusano 2b45e8
*  ==========
kusano 2b45e8
*
kusano 2b45e8
*  UPLO   - CHARACTER*1.
kusano 2b45e8
*           On entry, UPLO specifies whether the upper or lower
kusano 2b45e8
*           triangular part of the array A is to be referenced as
kusano 2b45e8
*           follows:
kusano 2b45e8
*
kusano 2b45e8
*              UPLO = 'U' or 'u'   Only the upper triangular part of A
kusano 2b45e8
*                                  is to be referenced.
kusano 2b45e8
*
kusano 2b45e8
*              UPLO = 'L' or 'l'   Only the lower triangular part of A
kusano 2b45e8
*                                  is to be referenced.
kusano 2b45e8
*
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  N      - INTEGER.
kusano 2b45e8
*           On entry, N specifies the order of the matrix A.
kusano 2b45e8
*           N must be at least zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  ALPHA  - COMPLEX*16      .
kusano 2b45e8
*           On entry, ALPHA specifies the scalar alpha.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  A      - COMPLEX*16       array of DIMENSION ( LDA, n ).
kusano 2b45e8
*           Before entry with  UPLO = 'U' or 'u', the leading n by n
kusano 2b45e8
*           upper triangular part of the array A must contain the upper
kusano 2b45e8
*           triangular part of the hermitian matrix and the strictly
kusano 2b45e8
*           lower triangular part of A is not referenced.
kusano 2b45e8
*           Before entry with UPLO = 'L' or 'l', the leading n by n
kusano 2b45e8
*           lower triangular part of the array A must contain the lower
kusano 2b45e8
*           triangular part of the hermitian matrix and the strictly
kusano 2b45e8
*           upper triangular part of A is not referenced.
kusano 2b45e8
*           Note that the imaginary parts of the diagonal elements need
kusano 2b45e8
*           not be set and are assumed to be zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  LDA    - INTEGER.
kusano 2b45e8
*           On entry, LDA specifies the first dimension of A as declared
kusano 2b45e8
*           in the calling (sub) program. LDA must be at least
kusano 2b45e8
*           max( 1, n ).
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  X      - COMPLEX*16       array of dimension at least
kusano 2b45e8
*           ( 1 + ( n - 1 )*abs( INCX ) ).
kusano 2b45e8
*           Before entry, the incremented array X must contain the n
kusano 2b45e8
*           element vector x.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  INCX   - INTEGER.
kusano 2b45e8
*           On entry, INCX specifies the increment for the elements of
kusano 2b45e8
*           X. INCX must not be zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  BETA   - COMPLEX*16      .
kusano 2b45e8
*           On entry, BETA specifies the scalar beta. When BETA is
kusano 2b45e8
*           supplied as zero then Y need not be set on input.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*  Y      - COMPLEX*16       array of dimension at least
kusano 2b45e8
*           ( 1 + ( n - 1 )*abs( INCY ) ).
kusano 2b45e8
*           Before entry, the incremented array Y must contain the n
kusano 2b45e8
*           element vector y. On exit, Y is overwritten by the updated
kusano 2b45e8
*           vector y.
kusano 2b45e8
*
kusano 2b45e8
*  INCY   - INTEGER.
kusano 2b45e8
*           On entry, INCY specifies the increment for the elements of
kusano 2b45e8
*           Y. INCY must not be zero.
kusano 2b45e8
*           Unchanged on exit.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*  Level 2 Blas routine.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 22-October-1986.
kusano 2b45e8
*     Jack Dongarra, Argonne National Lab.
kusano 2b45e8
*     Jeremy Du Croz, Nag Central Office.
kusano 2b45e8
*     Sven Hammarling, Nag Central Office.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ONE
kusano 2b45e8
      PARAMETER        ( ONE  = ( 1.0D+0, 0.0D+0 ) )
kusano 2b45e8
      COMPLEX*16         ZERO
kusano 2b45e8
      PARAMETER        ( ZERO = ( 0.0D+0, 0.0D+0 ) )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         TEMP1, TEMP2
kusano 2b45e8
      INTEGER            I, INFO, IX, IY, J, JX, JY, KX, KY
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LSAME
kusano 2b45e8
      EXTERNAL           LSAME
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           XERBLA
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          DCONJG, MAX, DBLE
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
*     Test the input parameters.
kusano 2b45e8
*
kusano 2b45e8
      INFO = 0
kusano 2b45e8
      IF     ( .NOT.LSAME( UPLO, 'U' ).AND.
kusano 2b45e8
     $         .NOT.LSAME( UPLO, 'L' ).AND.
kusano 2b45e8
     $         .NOT.LSAME( UPLO, 'V' ).AND.
kusano 2b45e8
     $         .NOT.LSAME( UPLO, 'M' ))THEN
kusano 2b45e8
         INFO = 1
kusano 2b45e8
      ELSE IF( N.LT.0 )THEN
kusano 2b45e8
         INFO = 2
kusano 2b45e8
      ELSE IF( LDA.LT.MAX( 1, N ) )THEN
kusano 2b45e8
         INFO = 5
kusano 2b45e8
      ELSE IF( INCX.EQ.0 )THEN
kusano 2b45e8
         INFO = 7
kusano 2b45e8
      ELSE IF( INCY.EQ.0 )THEN
kusano 2b45e8
         INFO = 10
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INFO.NE.0 )THEN
kusano 2b45e8
         CALL XERBLA( 'ZHEMV ', INFO )
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Quick return if possible.
kusano 2b45e8
*
kusano 2b45e8
      IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
kusano 2b45e8
     $   RETURN
kusano 2b45e8
*
kusano 2b45e8
*     Set up the start points in  X  and  Y.
kusano 2b45e8
*
kusano 2b45e8
      IF( INCX.GT.0 )THEN
kusano 2b45e8
         KX = 1
kusano 2b45e8
      ELSE
kusano 2b45e8
         KX = 1 - ( N - 1 )*INCX
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INCY.GT.0 )THEN
kusano 2b45e8
         KY = 1
kusano 2b45e8
      ELSE
kusano 2b45e8
         KY = 1 - ( N - 1 )*INCY
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Start the operations. In this version the elements of A are
kusano 2b45e8
*     accessed sequentially with one pass through the triangular part
kusano 2b45e8
*     of A.
kusano 2b45e8
*
kusano 2b45e8
*     First form  y := beta*y.
kusano 2b45e8
*
kusano 2b45e8
      IF( BETA.NE.ONE )THEN
kusano 2b45e8
         IF( INCY.EQ.1 )THEN
kusano 2b45e8
            IF( BETA.EQ.ZERO )THEN
kusano 2b45e8
               DO 10, I = 1, N
kusano 2b45e8
                  Y( I ) = ZERO
kusano 2b45e8
   10          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 20, I = 1, N
kusano 2b45e8
                  Y( I ) = BETA*Y( I )
kusano 2b45e8
   20          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         ELSE
kusano 2b45e8
            IY = KY
kusano 2b45e8
            IF( BETA.EQ.ZERO )THEN
kusano 2b45e8
               DO 30, I = 1, N
kusano 2b45e8
                  Y( IY ) = ZERO
kusano 2b45e8
                  IY      = IY   + INCY
kusano 2b45e8
   30          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 40, I = 1, N
kusano 2b45e8
                  Y( IY ) = BETA*Y( IY )
kusano 2b45e8
                  IY      = IY           + INCY
kusano 2b45e8
   40          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         END IF
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( ALPHA.EQ.ZERO )
kusano 2b45e8
     $   RETURN
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
      IF( LSAME( UPLO, 'U' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*        Form  y  when A is stored in upper triangle.
kusano 2b45e8
*
kusano 2b45e8
         IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
kusano 2b45e8
            DO 60, J = 1, N
kusano 2b45e8
               TEMP1 = ALPHA*X( J )
kusano 2b45e8
               TEMP2 = ZERO
kusano 2b45e8
               DO 50, I = 1, J - 1
kusano 2b45e8
                  Y( I ) = Y( I ) + TEMP1*A( I, J )
kusano 2b45e8
                  TEMP2  = TEMP2  + DCONJG( A( I, J ) )*X( I )
kusano 2b45e8
   50          CONTINUE
kusano 2b45e8
               Y( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP2
kusano 2b45e8
   60       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
            JX = KX
kusano 2b45e8
            JY = KY
kusano 2b45e8
            DO 80, J = 1, N
kusano 2b45e8
               TEMP1 = ALPHA*X( JX )
kusano 2b45e8
               TEMP2 = ZERO
kusano 2b45e8
               IX    = KX
kusano 2b45e8
               IY    = KY
kusano 2b45e8
               DO 70, I = 1, J - 1
kusano 2b45e8
                  Y( IY ) = Y( IY ) + TEMP1*A( I, J )
kusano 2b45e8
                  TEMP2   = TEMP2   + DCONJG( A( I, J ) )*X( IX )
kusano 2b45e8
                  IX      = IX      + INCX
kusano 2b45e8
                  IY      = IY      + INCY
kusano 2b45e8
   70          CONTINUE
kusano 2b45e8
               Y( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP2
kusano 2b45e8
               JX      = JX      + INCX
kusano 2b45e8
               JY      = JY      + INCY
kusano 2b45e8
   80       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
         RETURN
kusano 2b45e8
         ENDIF
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
      IF( LSAME( UPLO, 'L' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*        Form  y  when A is stored in lower triangle.
kusano 2b45e8
*
kusano 2b45e8
         IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
kusano 2b45e8
            DO 100, J = 1, N
kusano 2b45e8
               TEMP1  = ALPHA*X( J )
kusano 2b45e8
               TEMP2  = ZERO
kusano 2b45e8
               Y( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) )
kusano 2b45e8
               DO 90, I = J + 1, N
kusano 2b45e8
                  Y( I ) = Y( I ) + TEMP1*A( I, J )
kusano 2b45e8
                  TEMP2  = TEMP2  + DCONJG( A( I, J ) )*X( I )
kusano 2b45e8
   90          CONTINUE
kusano 2b45e8
               Y( J ) = Y( J ) + ALPHA*TEMP2
kusano 2b45e8
  100       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
            JX = KX
kusano 2b45e8
            JY = KY
kusano 2b45e8
            DO 120, J = 1, N
kusano 2b45e8
               TEMP1   = ALPHA*X( JX )
kusano 2b45e8
               TEMP2   = ZERO
kusano 2b45e8
               Y( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) )
kusano 2b45e8
               IX      = JX
kusano 2b45e8
               IY      = JY
kusano 2b45e8
               DO 110, I = J + 1, N
kusano 2b45e8
                  IX      = IX      + INCX
kusano 2b45e8
                  IY      = IY      + INCY
kusano 2b45e8
                  Y( IY ) = Y( IY ) + TEMP1*A( I, J )
kusano 2b45e8
                  TEMP2   = TEMP2   + DCONJG( A( I, J ) )*X( IX )
kusano 2b45e8
  110          CONTINUE
kusano 2b45e8
               Y( JY ) = Y( JY ) + ALPHA*TEMP2
kusano 2b45e8
               JX      = JX      + INCX
kusano 2b45e8
               JY      = JY      + INCY
kusano 2b45e8
  120       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
      IF( LSAME( UPLO, 'V' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*        Form  y  when A is stored in upper triangle.
kusano 2b45e8
*
kusano 2b45e8
         IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
kusano 2b45e8
            DO 160, J = 1, N
kusano 2b45e8
               TEMP1 = ALPHA*X( J )
kusano 2b45e8
               TEMP2 = ZERO
kusano 2b45e8
               DO 150, I = 1, J - 1
kusano 2b45e8
                  Y( I ) = Y( I ) + TEMP1* DCONJG(A( I, J ))
kusano 2b45e8
                  TEMP2  = TEMP2  + A( I, J )*X( I )
kusano 2b45e8
  150          CONTINUE
kusano 2b45e8
               Y( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP2
kusano 2b45e8
  160       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
            JX = KX
kusano 2b45e8
            JY = KY
kusano 2b45e8
            DO 180, J = 1, N
kusano 2b45e8
               TEMP1 = ALPHA*X( JX )
kusano 2b45e8
               TEMP2 = ZERO
kusano 2b45e8
               IX    = KX
kusano 2b45e8
               IY    = KY
kusano 2b45e8
               DO 170, I = 1, J - 1
kusano 2b45e8
                  Y( IY ) = Y( IY ) + TEMP1* DCONJG(A( I, J ))
kusano 2b45e8
                  TEMP2   = TEMP2   + A( I, J )*X( IX )
kusano 2b45e8
                  IX      = IX      + INCX
kusano 2b45e8
                  IY      = IY      + INCY
kusano 2b45e8
  170          CONTINUE
kusano 2b45e8
               Y( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP2
kusano 2b45e8
               JX      = JX      + INCX
kusano 2b45e8
               JY      = JY      + INCY
kusano 2b45e8
  180       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
         RETURN
kusano 2b45e8
         ENDIF
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
      IF( LSAME( UPLO, 'M' ) )THEN
kusano 2b45e8
*
kusano 2b45e8
*        Form  y  when A is stored in lower triangle.
kusano 2b45e8
*
kusano 2b45e8
         IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
kusano 2b45e8
            DO 200, J = 1, N
kusano 2b45e8
               TEMP1  = ALPHA*X( J )
kusano 2b45e8
               TEMP2  = ZERO
kusano 2b45e8
               Y( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) )
kusano 2b45e8
               DO 190, I = J + 1, N
kusano 2b45e8
                  Y( I ) = Y( I ) + TEMP1*DCONJG(A( I, J ))
kusano 2b45e8
                  TEMP2  = TEMP2  + A( I, J )*X( I )
kusano 2b45e8
  190          CONTINUE
kusano 2b45e8
               Y( J ) = Y( J ) + ALPHA*TEMP2
kusano 2b45e8
  200       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
            JX = KX
kusano 2b45e8
            JY = KY
kusano 2b45e8
            DO 220, J = 1, N
kusano 2b45e8
               TEMP1   = ALPHA*X( JX )
kusano 2b45e8
               TEMP2   = ZERO
kusano 2b45e8
               Y( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) )
kusano 2b45e8
               IX      = JX
kusano 2b45e8
               IY      = JY
kusano 2b45e8
               DO 210, I = J + 1, N
kusano 2b45e8
                  IX      = IX      + INCX
kusano 2b45e8
                  IY      = IY      + INCY
kusano 2b45e8
                  Y( IY ) = Y( IY ) + TEMP1*DCONJG(A( I, J ))
kusano 2b45e8
                  TEMP2   = TEMP2   + A( I, J )*X( IX )
kusano 2b45e8
  210          CONTINUE
kusano 2b45e8
               Y( JY ) = Y( JY ) + ALPHA*TEMP2
kusano 2b45e8
               JX      = JX      + INCX
kusano 2b45e8
               JY      = JY      + INCY
kusano 2b45e8
  220       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of ZHEMV .
kusano 2b45e8
*
kusano 2b45e8
      END