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