1       SUBROUTINE CLARFY( UPLO, N, V, INCV, TAU, C, LDC, WORK )
  2 *
  3 *  -- LAPACK auxiliary test routine (version 3.1) --
  4 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
  5 *     November 2006
  6 *
  7 *     .. Scalar Arguments ..
  8       CHARACTER          UPLO
  9       INTEGER            INCV, LDC, N
 10       COMPLEX            TAU
 11 *     ..
 12 *     .. Array Arguments ..
 13       COMPLEX            C( LDC, * ), V( * ), WORK( * )
 14 *     ..
 15 *
 16 *  Purpose
 17 *  =======
 18 *
 19 *  CLARFY applies an elementary reflector, or Householder matrix, H,
 20 *  to an n x n Hermitian matrix C, from both the left and the right.
 21 *
 22 *  H is represented in the form
 23 *
 24 *     H = I - tau * v * v'
 25 *
 26 *  where  tau  is a scalar and  v  is a vector.
 27 *
 28 *  If  tau  is  zero, then  H  is taken to be the unit matrix.
 29 *
 30 *  Arguments
 31 *  =========
 32 *
 33 *  UPLO    (input) CHARACTER*1
 34 *          Specifies whether the upper or lower triangular part of the
 35 *          Hermitian matrix C is stored.
 36 *          = 'U':  Upper triangle
 37 *          = 'L':  Lower triangle
 38 *
 39 *  N       (input) INTEGER
 40 *          The number of rows and columns of the matrix C.  N >= 0.
 41 *
 42 *  V       (input) COMPLEX array, dimension
 43 *                  (1 + (N-1)*abs(INCV))
 44 *          The vector v as described above.
 45 *
 46 *  INCV    (input) INTEGER
 47 *          The increment between successive elements of v.  INCV must
 48 *          not be zero.
 49 *
 50 *  TAU     (input) COMPLEX
 51 *          The value tau as described above.
 52 *
 53 *  C       (input/output) COMPLEX array, dimension (LDC, N)
 54 *          On entry, the matrix C.
 55 *          On exit, C is overwritten by H * C * H'.
 56 *
 57 *  LDC     (input) INTEGER
 58 *          The leading dimension of the array C.  LDC >= max( 1, N ).
 59 *
 60 *  WORK    (workspace) COMPLEX array, dimension (N)
 61 *
 62 *  =====================================================================
 63 *
 64 *     .. Parameters ..
 65       COMPLEX            ONE, ZERO, HALF
 66       PARAMETER          ( ONE = ( 1.0E+00.0E+0 ),
 67      $                   ZERO = ( 0.0E+00.0E+0 ),
 68      $                   HALF = ( 0.5E+00.0E+0 ) )
 69 *     ..
 70 *     .. Local Scalars ..
 71       COMPLEX            ALPHA
 72 *     ..
 73 *     .. External Subroutines ..
 74       EXTERNAL           CAXPY, CHEMV, CHER2
 75 *     ..
 76 *     .. External Functions ..
 77       COMPLEX            CDOTC
 78       EXTERNAL           CDOTC
 79 *     ..
 80 *     .. Executable Statements ..
 81 *
 82       IF( TAU.EQ.ZERO )
 83      $   RETURN
 84 *
 85 *     Form  w:= C * v
 86 *
 87       CALL CHEMV( UPLO, N, ONE, C, LDC, V, INCV, ZERO, WORK, 1 )
 88 *
 89       ALPHA = -HALF*TAU*CDOTC( N, WORK, 1, V, INCV )
 90       CALL CAXPY( N, ALPHA, V, INCV, WORK, 1 )
 91 *
 92 *     C := C - v * w' - w * v'
 93 *
 94       CALL CHER2( UPLO, N, -TAU, V, INCV, WORK, 1, C, LDC )
 95 *
 96       RETURN
 97 *
 98 *     End of CLARFY
 99 *
100       END