exciting-0.9.218
[exciting.git] / src / LAPACK / dlarf.f
blob22edc899200eddad4ba5fbe11f41966957675a73
1 SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
3 * -- LAPACK auxiliary routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
7 * .. Scalar Arguments ..
8 CHARACTER SIDE
9 INTEGER INCV, LDC, M, N
10 DOUBLE PRECISION TAU
11 * ..
12 * .. Array Arguments ..
13 DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * )
14 * ..
16 * Purpose
17 * =======
19 * DLARF applies a real elementary reflector H to a real m by n matrix
20 * C, from either the left or the right. H is represented in the form
22 * H = I - tau * v * v'
24 * where tau is a real scalar and v is a real vector.
26 * If tau = 0, then H is taken to be the unit matrix.
28 * Arguments
29 * =========
31 * SIDE (input) CHARACTER*1
32 * = 'L': form H * C
33 * = 'R': form C * H
35 * M (input) INTEGER
36 * The number of rows of the matrix C.
38 * N (input) INTEGER
39 * The number of columns of the matrix C.
41 * V (input) DOUBLE PRECISION array, dimension
42 * (1 + (M-1)*abs(INCV)) if SIDE = 'L'
43 * or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
44 * The vector v in the representation of H. V is not used if
45 * TAU = 0.
47 * INCV (input) INTEGER
48 * The increment between elements of v. INCV <> 0.
50 * TAU (input) DOUBLE PRECISION
51 * The value tau in the representation of H.
53 * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
54 * On entry, the m by n matrix C.
55 * On exit, C is overwritten by the matrix H * C if SIDE = 'L',
56 * or C * H if SIDE = 'R'.
58 * LDC (input) INTEGER
59 * The leading dimension of the array C. LDC >= max(1,M).
61 * WORK (workspace) DOUBLE PRECISION array, dimension
62 * (N) if SIDE = 'L'
63 * or (M) if SIDE = 'R'
65 * =====================================================================
67 * .. Parameters ..
68 DOUBLE PRECISION ONE, ZERO
69 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
70 * ..
71 * .. External Subroutines ..
72 EXTERNAL DGEMV, DGER
73 * ..
74 * .. External Functions ..
75 LOGICAL LSAME
76 EXTERNAL LSAME
77 * ..
78 * .. Executable Statements ..
80 IF( LSAME( SIDE, 'L' ) ) THEN
82 * Form H * C
84 IF( TAU.NE.ZERO ) THEN
86 * w := C' * v
88 CALL DGEMV( 'Transpose', M, N, ONE, C, LDC, V, INCV, ZERO,
89 $ WORK, 1 )
91 * C := C - v * w'
93 CALL DGER( M, N, -TAU, V, INCV, WORK, 1, C, LDC )
94 END IF
95 ELSE
97 * Form C * H
99 IF( TAU.NE.ZERO ) THEN
101 * w := C * v
103 CALL DGEMV( 'No transpose', M, N, ONE, C, LDC, V, INCV,
104 $ ZERO, WORK, 1 )
106 * C := C - w * v'
108 CALL DGER( M, N, -TAU, WORK, 1, V, INCV, C, LDC )
109 END IF
110 END IF
111 RETURN
113 * End of DLARF