1       SUBROUTINE DLARFY( 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       DOUBLE PRECISION   TAU
11 *     ..
12 *     .. Array Arguments ..
13       DOUBLE PRECISION   C( LDC, * ), V( * ), WORK( * )
14 *     ..
15 *
16 *  Purpose
17 *  =======
18 *
19 *  DLARFY applies an elementary reflector, or Householder matrix, H,
20 *  to an n x n symmetric 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 *          symmetric 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) DOUBLE PRECISION 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) DOUBLE PRECISION
51 *          The value tau as described above.
52 *
53 *  C       (input/output) DOUBLE PRECISION 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) DOUBLE PRECISION array, dimension (N)
61 *
62 *  =====================================================================
63 *
64 *     .. Parameters ..
65       DOUBLE PRECISION   ONE, ZERO, HALF
66       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0, HALF = 0.5D+0 )
67 *     ..
68 *     .. Local Scalars ..
69       DOUBLE PRECISION   ALPHA
70 *     ..
71 *     .. External Subroutines ..
72       EXTERNAL           DAXPY, DSYMV, DSYR2
73 *     ..
74 *     .. External Functions ..
75       DOUBLE PRECISION   DDOT
76       EXTERNAL           DDOT
77 *     ..
78 *     .. Executable Statements ..
79 *
80       IF( TAU.EQ.ZERO )
81      $   RETURN
82 *
83 *     Form  w:= C * v
84 *
85       CALL DSYMV( UPLO, N, ONE, C, LDC, V, INCV, ZERO, WORK, 1 )
86 *
87       ALPHA = -HALF*TAU*DDOT( N, WORK, 1, V, INCV )
88       CALL DAXPY( N, ALPHA, V, INCV, WORK, 1 )
89 *
90 *     C := C - v * w' - w * v'
91 *
92       CALL DSYR2( UPLO, N, -TAU, V, INCV, WORK, 1, C, LDC )
93 *
94       RETURN
95 *
96 *     End of DLARFY
97 *
98       END