|
39 | 39 | *> ZLARF1F applies a complex elementary reflector H to a real m by n matrix |
40 | 40 | *> C, from either the left or the right. H is represented in the form |
41 | 41 | *> |
42 | | -*> H = I - tau * v * v**T |
| 42 | +*> H = I - tau * v * v**H |
43 | 43 | *> |
44 | 44 | *> where tau is a complex scalar and v is a complex vector. |
45 | 45 | *> |
|
56 | 56 | *> \verbatim |
57 | 57 | *> SIDE is CHARACTER*1 |
58 | 58 | *> = 'L': form H * C |
59 | | -*> = 'R': form C * H |
60 | | -*> \endverbatim |
61 | 59 | *> |
62 | 60 | *> \param[in] M |
63 | 61 | *> \verbatim |
@@ -160,9 +158,6 @@ SUBROUTINE ZLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) |
160 | 158 | INTEGER ILADLR, ILADLC |
161 | 159 | EXTERNAL LSAME, ILADLR, ILADLC |
162 | 160 | * .. |
163 | | -* .. Intrinsic Functions .. |
164 | | - INTRINSIC DCONJG |
165 | | -* .. |
166 | 161 | * .. Executable Statements .. |
167 | 162 | * |
168 | 163 | APPLYLEFT = LSAME( SIDE, 'L' ) |
@@ -210,20 +205,26 @@ SUBROUTINE ZLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) |
210 | 205 | * |
211 | 206 | * w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1) |
212 | 207 | * |
213 | | - ! w(1:lastc,1) := C(2:lastv,1:lastc)**H * v(2:lastv,1) |
214 | | - CALL ZGEMV( 'Conj', LASTV-1, LASTC, ONE, C(1+1,1), LDC, |
215 | | - $ V(1+INCV), INCV, ZERO, WORK, 1) |
216 | | - ! w(1:lastc,1) += C(1,1:lastc) * v(1,1) = C(1,1:lastc) |
217 | | - DO I = 1, LASTC |
218 | | - WORK(I) = WORK(I) + DCONJG(C(1,I)) |
| 208 | + ! (I - tvv**H)C = C - tvv**H C |
| 209 | + ! First compute w**H = v**H c -> w = C**H v |
| 210 | + ! C = [ C_1 C_2 ]**T, v = [1 v_2]**T |
| 211 | + ! w = C_1**H + C_2**Hv_2 |
| 212 | + ! w = C_1**H |
| 213 | + DO I = 1, LASTC |
| 214 | + WORK(I) = DCONJG(C(1,I)) |
219 | 215 | END DO |
| 216 | + ! w += C_2**Hv_2 |
| 217 | + CALL ZGEMV( 'Conj', LASTV-1, LASTC, ONE, C(1+1,1), LDC, |
| 218 | + $ V(1+INCV), INCV, ONE, WORK, 1) |
220 | 219 | * |
221 | | -* C(1:lastv,1:lastc) := C(...) - tau * v(1:lastv,1) * w(1:lastc,1)**T |
| 220 | +* C(1:lastv,1:lastc) := C(...) - tau * v(1:lastv,1) * w(1:lastc,1)**H |
222 | 221 | * |
223 | 222 | ! C(1, 1:lastc) := C(...) - tau * v(1,1) * w(1:lastc,1)**T |
224 | | - ! = C(...) - tau * w(1:lastc,1) |
225 | | - CALL ZAXPY(LASTC, -TAU, WORK, 1, C, LDC) |
226 | | - ! C(2:lastv,1:lastc) := C(...) - tau * v(2:lastv,1)*w(1:lastc,1)**T |
| 223 | + ! = C(...) - tau * Conj(w(1:lastc,1)) |
| 224 | + DO I = 1, LASTC |
| 225 | + C(1,I) = C(1,I) - TAU * DCONJG(WORK(I)) |
| 226 | + END DO |
| 227 | + ! C(2:lastv,1:lastc) := C(...) - tau * v(2:lastv,1)*w(1:lastc,1)**H |
227 | 228 | CALL ZGERC(LASTV-1, LASTC, -TAU, V(1+INCV), INCV, WORK, |
228 | 229 | $ 1, C(1+1,1), LDC) |
229 | 230 | END IF |
|
0 commit comments