1 *> \brief \b ZLARFX applies an elementary reflector to a general rectangular matrix, with loop unrolling when the reflector has order ≤ 10.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZLARFX + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarfx.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarfx.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarfx.f">
21 * SUBROUTINE ZLARFX( SIDE, M, N, V, TAU, C, LDC, WORK )
23 * .. Scalar Arguments ..
28 * .. Array Arguments ..
29 * COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
38 *> ZLARFX applies a complex elementary reflector H to a complex m by n
39 *> matrix C, from either the left or the right. H is represented in the
42 *> H = I - tau * v * v**H
44 *> where tau is a complex scalar and v is a complex vector.
46 *> If tau = 0, then H is taken to be the unit matrix
48 *> This version uses inline code if H has order < 11.
56 *> SIDE is CHARACTER*1
64 *> The number of rows of the matrix C.
70 *> The number of columns of the matrix C.
75 *> V is COMPLEX*16 array, dimension (M) if SIDE = 'L'
76 *> or (N) if SIDE = 'R'
77 *> The vector v in the representation of H.
83 *> The value tau in the representation of H.
88 *> C is COMPLEX*16 array, dimension (LDC,N)
89 *> On entry, the m by n matrix C.
90 *> On exit, C is overwritten by the matrix H * C if SIDE = 'L',
91 *> or C * H if SIDE = 'R'.
97 *> The leading dimension of the array C. LDA >= max(1,M).
102 *> WORK is COMPLEX*16 array, dimension (N) if SIDE = 'L'
103 *> or (M) if SIDE = 'R'
104 *> WORK is not referenced if H has order < 11.
110 *> \author Univ. of Tennessee
111 *> \author Univ. of California Berkeley
112 *> \author Univ. of Colorado Denver
115 *> \date September 2012
117 *> \ingroup complex16OTHERauxiliary
119 * =====================================================================
120 SUBROUTINE ZLARFX( SIDE, M, N, V, TAU, C, LDC, WORK )
122 * -- LAPACK auxiliary routine (version 3.4.2) --
123 * -- LAPACK is a software package provided by Univ. of Tennessee, --
124 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127 * .. Scalar Arguments ..
132 * .. Array Arguments ..
133 COMPLEX*16 C( LDC, * ), V( * ), WORK( * )
136 * =====================================================================
140 PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ),
141 $ ONE = ( 1.0D+0, 0.0D+0 ) )
143 * .. Local Scalars ..
145 COMPLEX*16 SUM, T1, T10, T2, T3, T4, T5, T6, T7, T8, T9,
146 $ V1, V10, V2, V3, V4, V5, V6, V7, V8, V9
148 * .. External Functions ..
152 * .. External Subroutines ..
155 * .. Intrinsic Functions ..
158 * .. Executable Statements ..
162 IF( LSAME( SIDE, 'L' ) ) THEN
164 * Form H * C, where H has order m.
166 GO TO ( 10, 30, 50, 70, 90, 110, 130, 150,
171 CALL ZLARF( SIDE, M, N, V, 1, TAU, C, LDC, WORK )
175 * Special code for 1 x 1 Householder
177 T1 = ONE - TAU*V( 1 )*DCONJG( V( 1 ) )
179 C( 1, J ) = T1*C( 1, J )
184 * Special code for 2 x 2 Householder
186 V1 = DCONJG( V( 1 ) )
187 T1 = TAU*DCONJG( V1 )
188 V2 = DCONJG( V( 2 ) )
189 T2 = TAU*DCONJG( V2 )
191 SUM = V1*C( 1, J ) + V2*C( 2, J )
192 C( 1, J ) = C( 1, J ) - SUM*T1
193 C( 2, J ) = C( 2, J ) - SUM*T2
198 * Special code for 3 x 3 Householder
200 V1 = DCONJG( V( 1 ) )
201 T1 = TAU*DCONJG( V1 )
202 V2 = DCONJG( V( 2 ) )
203 T2 = TAU*DCONJG( V2 )
204 V3 = DCONJG( V( 3 ) )
205 T3 = TAU*DCONJG( V3 )
207 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J )
208 C( 1, J ) = C( 1, J ) - SUM*T1
209 C( 2, J ) = C( 2, J ) - SUM*T2
210 C( 3, J ) = C( 3, J ) - SUM*T3
215 * Special code for 4 x 4 Householder
217 V1 = DCONJG( V( 1 ) )
218 T1 = TAU*DCONJG( V1 )
219 V2 = DCONJG( V( 2 ) )
220 T2 = TAU*DCONJG( V2 )
221 V3 = DCONJG( V( 3 ) )
222 T3 = TAU*DCONJG( V3 )
223 V4 = DCONJG( V( 4 ) )
224 T4 = TAU*DCONJG( V4 )
226 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
228 C( 1, J ) = C( 1, J ) - SUM*T1
229 C( 2, J ) = C( 2, J ) - SUM*T2
230 C( 3, J ) = C( 3, J ) - SUM*T3
231 C( 4, J ) = C( 4, J ) - SUM*T4
236 * Special code for 5 x 5 Householder
238 V1 = DCONJG( V( 1 ) )
239 T1 = TAU*DCONJG( V1 )
240 V2 = DCONJG( V( 2 ) )
241 T2 = TAU*DCONJG( V2 )
242 V3 = DCONJG( V( 3 ) )
243 T3 = TAU*DCONJG( V3 )
244 V4 = DCONJG( V( 4 ) )
245 T4 = TAU*DCONJG( V4 )
246 V5 = DCONJG( V( 5 ) )
247 T5 = TAU*DCONJG( V5 )
249 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
250 $ V4*C( 4, J ) + V5*C( 5, J )
251 C( 1, J ) = C( 1, J ) - SUM*T1
252 C( 2, J ) = C( 2, J ) - SUM*T2
253 C( 3, J ) = C( 3, J ) - SUM*T3
254 C( 4, J ) = C( 4, J ) - SUM*T4
255 C( 5, J ) = C( 5, J ) - SUM*T5
260 * Special code for 6 x 6 Householder
262 V1 = DCONJG( V( 1 ) )
263 T1 = TAU*DCONJG( V1 )
264 V2 = DCONJG( V( 2 ) )
265 T2 = TAU*DCONJG( V2 )
266 V3 = DCONJG( V( 3 ) )
267 T3 = TAU*DCONJG( V3 )
268 V4 = DCONJG( V( 4 ) )
269 T4 = TAU*DCONJG( V4 )
270 V5 = DCONJG( V( 5 ) )
271 T5 = TAU*DCONJG( V5 )
272 V6 = DCONJG( V( 6 ) )
273 T6 = TAU*DCONJG( V6 )
275 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
276 $ V4*C( 4, J ) + V5*C( 5, J ) + V6*C( 6, J )
277 C( 1, J ) = C( 1, J ) - SUM*T1
278 C( 2, J ) = C( 2, J ) - SUM*T2
279 C( 3, J ) = C( 3, J ) - SUM*T3
280 C( 4, J ) = C( 4, J ) - SUM*T4
281 C( 5, J ) = C( 5, J ) - SUM*T5
282 C( 6, J ) = C( 6, J ) - SUM*T6
287 * Special code for 7 x 7 Householder
289 V1 = DCONJG( V( 1 ) )
290 T1 = TAU*DCONJG( V1 )
291 V2 = DCONJG( V( 2 ) )
292 T2 = TAU*DCONJG( V2 )
293 V3 = DCONJG( V( 3 ) )
294 T3 = TAU*DCONJG( V3 )
295 V4 = DCONJG( V( 4 ) )
296 T4 = TAU*DCONJG( V4 )
297 V5 = DCONJG( V( 5 ) )
298 T5 = TAU*DCONJG( V5 )
299 V6 = DCONJG( V( 6 ) )
300 T6 = TAU*DCONJG( V6 )
301 V7 = DCONJG( V( 7 ) )
302 T7 = TAU*DCONJG( V7 )
304 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
305 $ V4*C( 4, J ) + V5*C( 5, J ) + V6*C( 6, J ) +
307 C( 1, J ) = C( 1, J ) - SUM*T1
308 C( 2, J ) = C( 2, J ) - SUM*T2
309 C( 3, J ) = C( 3, J ) - SUM*T3
310 C( 4, J ) = C( 4, J ) - SUM*T4
311 C( 5, J ) = C( 5, J ) - SUM*T5
312 C( 6, J ) = C( 6, J ) - SUM*T6
313 C( 7, J ) = C( 7, J ) - SUM*T7
318 * Special code for 8 x 8 Householder
320 V1 = DCONJG( V( 1 ) )
321 T1 = TAU*DCONJG( V1 )
322 V2 = DCONJG( V( 2 ) )
323 T2 = TAU*DCONJG( V2 )
324 V3 = DCONJG( V( 3 ) )
325 T3 = TAU*DCONJG( V3 )
326 V4 = DCONJG( V( 4 ) )
327 T4 = TAU*DCONJG( V4 )
328 V5 = DCONJG( V( 5 ) )
329 T5 = TAU*DCONJG( V5 )
330 V6 = DCONJG( V( 6 ) )
331 T6 = TAU*DCONJG( V6 )
332 V7 = DCONJG( V( 7 ) )
333 T7 = TAU*DCONJG( V7 )
334 V8 = DCONJG( V( 8 ) )
335 T8 = TAU*DCONJG( V8 )
337 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
338 $ V4*C( 4, J ) + V5*C( 5, J ) + V6*C( 6, J ) +
339 $ V7*C( 7, J ) + V8*C( 8, J )
340 C( 1, J ) = C( 1, J ) - SUM*T1
341 C( 2, J ) = C( 2, J ) - SUM*T2
342 C( 3, J ) = C( 3, J ) - SUM*T3
343 C( 4, J ) = C( 4, J ) - SUM*T4
344 C( 5, J ) = C( 5, J ) - SUM*T5
345 C( 6, J ) = C( 6, J ) - SUM*T6
346 C( 7, J ) = C( 7, J ) - SUM*T7
347 C( 8, J ) = C( 8, J ) - SUM*T8
352 * Special code for 9 x 9 Householder
354 V1 = DCONJG( V( 1 ) )
355 T1 = TAU*DCONJG( V1 )
356 V2 = DCONJG( V( 2 ) )
357 T2 = TAU*DCONJG( V2 )
358 V3 = DCONJG( V( 3 ) )
359 T3 = TAU*DCONJG( V3 )
360 V4 = DCONJG( V( 4 ) )
361 T4 = TAU*DCONJG( V4 )
362 V5 = DCONJG( V( 5 ) )
363 T5 = TAU*DCONJG( V5 )
364 V6 = DCONJG( V( 6 ) )
365 T6 = TAU*DCONJG( V6 )
366 V7 = DCONJG( V( 7 ) )
367 T7 = TAU*DCONJG( V7 )
368 V8 = DCONJG( V( 8 ) )
369 T8 = TAU*DCONJG( V8 )
370 V9 = DCONJG( V( 9 ) )
371 T9 = TAU*DCONJG( V9 )
373 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
374 $ V4*C( 4, J ) + V5*C( 5, J ) + V6*C( 6, J ) +
375 $ V7*C( 7, J ) + V8*C( 8, J ) + V9*C( 9, J )
376 C( 1, J ) = C( 1, J ) - SUM*T1
377 C( 2, J ) = C( 2, J ) - SUM*T2
378 C( 3, J ) = C( 3, J ) - SUM*T3
379 C( 4, J ) = C( 4, J ) - SUM*T4
380 C( 5, J ) = C( 5, J ) - SUM*T5
381 C( 6, J ) = C( 6, J ) - SUM*T6
382 C( 7, J ) = C( 7, J ) - SUM*T7
383 C( 8, J ) = C( 8, J ) - SUM*T8
384 C( 9, J ) = C( 9, J ) - SUM*T9
389 * Special code for 10 x 10 Householder
391 V1 = DCONJG( V( 1 ) )
392 T1 = TAU*DCONJG( V1 )
393 V2 = DCONJG( V( 2 ) )
394 T2 = TAU*DCONJG( V2 )
395 V3 = DCONJG( V( 3 ) )
396 T3 = TAU*DCONJG( V3 )
397 V4 = DCONJG( V( 4 ) )
398 T4 = TAU*DCONJG( V4 )
399 V5 = DCONJG( V( 5 ) )
400 T5 = TAU*DCONJG( V5 )
401 V6 = DCONJG( V( 6 ) )
402 T6 = TAU*DCONJG( V6 )
403 V7 = DCONJG( V( 7 ) )
404 T7 = TAU*DCONJG( V7 )
405 V8 = DCONJG( V( 8 ) )
406 T8 = TAU*DCONJG( V8 )
407 V9 = DCONJG( V( 9 ) )
408 T9 = TAU*DCONJG( V9 )
409 V10 = DCONJG( V( 10 ) )
410 T10 = TAU*DCONJG( V10 )
412 SUM = V1*C( 1, J ) + V2*C( 2, J ) + V3*C( 3, J ) +
413 $ V4*C( 4, J ) + V5*C( 5, J ) + V6*C( 6, J ) +
414 $ V7*C( 7, J ) + V8*C( 8, J ) + V9*C( 9, J ) +
416 C( 1, J ) = C( 1, J ) - SUM*T1
417 C( 2, J ) = C( 2, J ) - SUM*T2
418 C( 3, J ) = C( 3, J ) - SUM*T3
419 C( 4, J ) = C( 4, J ) - SUM*T4
420 C( 5, J ) = C( 5, J ) - SUM*T5
421 C( 6, J ) = C( 6, J ) - SUM*T6
422 C( 7, J ) = C( 7, J ) - SUM*T7
423 C( 8, J ) = C( 8, J ) - SUM*T8
424 C( 9, J ) = C( 9, J ) - SUM*T9
425 C( 10, J ) = C( 10, J ) - SUM*T10
430 * Form C * H, where H has order n.
432 GO TO ( 210, 230, 250, 270, 290, 310, 330, 350,
437 CALL ZLARF( SIDE, M, N, V, 1, TAU, C, LDC, WORK )
441 * Special code for 1 x 1 Householder
443 T1 = ONE - TAU*V( 1 )*DCONJG( V( 1 ) )
445 C( J, 1 ) = T1*C( J, 1 )
450 * Special code for 2 x 2 Householder
453 T1 = TAU*DCONJG( V1 )
455 T2 = TAU*DCONJG( V2 )
457 SUM = V1*C( J, 1 ) + V2*C( J, 2 )
458 C( J, 1 ) = C( J, 1 ) - SUM*T1
459 C( J, 2 ) = C( J, 2 ) - SUM*T2
464 * Special code for 3 x 3 Householder
467 T1 = TAU*DCONJG( V1 )
469 T2 = TAU*DCONJG( V2 )
471 T3 = TAU*DCONJG( V3 )
473 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 )
474 C( J, 1 ) = C( J, 1 ) - SUM*T1
475 C( J, 2 ) = C( J, 2 ) - SUM*T2
476 C( J, 3 ) = C( J, 3 ) - SUM*T3
481 * Special code for 4 x 4 Householder
484 T1 = TAU*DCONJG( V1 )
486 T2 = TAU*DCONJG( V2 )
488 T3 = TAU*DCONJG( V3 )
490 T4 = TAU*DCONJG( V4 )
492 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
494 C( J, 1 ) = C( J, 1 ) - SUM*T1
495 C( J, 2 ) = C( J, 2 ) - SUM*T2
496 C( J, 3 ) = C( J, 3 ) - SUM*T3
497 C( J, 4 ) = C( J, 4 ) - SUM*T4
502 * Special code for 5 x 5 Householder
505 T1 = TAU*DCONJG( V1 )
507 T2 = TAU*DCONJG( V2 )
509 T3 = TAU*DCONJG( V3 )
511 T4 = TAU*DCONJG( V4 )
513 T5 = TAU*DCONJG( V5 )
515 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
516 $ V4*C( J, 4 ) + V5*C( J, 5 )
517 C( J, 1 ) = C( J, 1 ) - SUM*T1
518 C( J, 2 ) = C( J, 2 ) - SUM*T2
519 C( J, 3 ) = C( J, 3 ) - SUM*T3
520 C( J, 4 ) = C( J, 4 ) - SUM*T4
521 C( J, 5 ) = C( J, 5 ) - SUM*T5
526 * Special code for 6 x 6 Householder
529 T1 = TAU*DCONJG( V1 )
531 T2 = TAU*DCONJG( V2 )
533 T3 = TAU*DCONJG( V3 )
535 T4 = TAU*DCONJG( V4 )
537 T5 = TAU*DCONJG( V5 )
539 T6 = TAU*DCONJG( V6 )
541 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
542 $ V4*C( J, 4 ) + V5*C( J, 5 ) + V6*C( J, 6 )
543 C( J, 1 ) = C( J, 1 ) - SUM*T1
544 C( J, 2 ) = C( J, 2 ) - SUM*T2
545 C( J, 3 ) = C( J, 3 ) - SUM*T3
546 C( J, 4 ) = C( J, 4 ) - SUM*T4
547 C( J, 5 ) = C( J, 5 ) - SUM*T5
548 C( J, 6 ) = C( J, 6 ) - SUM*T6
553 * Special code for 7 x 7 Householder
556 T1 = TAU*DCONJG( V1 )
558 T2 = TAU*DCONJG( V2 )
560 T3 = TAU*DCONJG( V3 )
562 T4 = TAU*DCONJG( V4 )
564 T5 = TAU*DCONJG( V5 )
566 T6 = TAU*DCONJG( V6 )
568 T7 = TAU*DCONJG( V7 )
570 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
571 $ V4*C( J, 4 ) + V5*C( J, 5 ) + V6*C( J, 6 ) +
573 C( J, 1 ) = C( J, 1 ) - SUM*T1
574 C( J, 2 ) = C( J, 2 ) - SUM*T2
575 C( J, 3 ) = C( J, 3 ) - SUM*T3
576 C( J, 4 ) = C( J, 4 ) - SUM*T4
577 C( J, 5 ) = C( J, 5 ) - SUM*T5
578 C( J, 6 ) = C( J, 6 ) - SUM*T6
579 C( J, 7 ) = C( J, 7 ) - SUM*T7
584 * Special code for 8 x 8 Householder
587 T1 = TAU*DCONJG( V1 )
589 T2 = TAU*DCONJG( V2 )
591 T3 = TAU*DCONJG( V3 )
593 T4 = TAU*DCONJG( V4 )
595 T5 = TAU*DCONJG( V5 )
597 T6 = TAU*DCONJG( V6 )
599 T7 = TAU*DCONJG( V7 )
601 T8 = TAU*DCONJG( V8 )
603 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
604 $ V4*C( J, 4 ) + V5*C( J, 5 ) + V6*C( J, 6 ) +
605 $ V7*C( J, 7 ) + V8*C( J, 8 )
606 C( J, 1 ) = C( J, 1 ) - SUM*T1
607 C( J, 2 ) = C( J, 2 ) - SUM*T2
608 C( J, 3 ) = C( J, 3 ) - SUM*T3
609 C( J, 4 ) = C( J, 4 ) - SUM*T4
610 C( J, 5 ) = C( J, 5 ) - SUM*T5
611 C( J, 6 ) = C( J, 6 ) - SUM*T6
612 C( J, 7 ) = C( J, 7 ) - SUM*T7
613 C( J, 8 ) = C( J, 8 ) - SUM*T8
618 * Special code for 9 x 9 Householder
621 T1 = TAU*DCONJG( V1 )
623 T2 = TAU*DCONJG( V2 )
625 T3 = TAU*DCONJG( V3 )
627 T4 = TAU*DCONJG( V4 )
629 T5 = TAU*DCONJG( V5 )
631 T6 = TAU*DCONJG( V6 )
633 T7 = TAU*DCONJG( V7 )
635 T8 = TAU*DCONJG( V8 )
637 T9 = TAU*DCONJG( V9 )
639 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
640 $ V4*C( J, 4 ) + V5*C( J, 5 ) + V6*C( J, 6 ) +
641 $ V7*C( J, 7 ) + V8*C( J, 8 ) + V9*C( J, 9 )
642 C( J, 1 ) = C( J, 1 ) - SUM*T1
643 C( J, 2 ) = C( J, 2 ) - SUM*T2
644 C( J, 3 ) = C( J, 3 ) - SUM*T3
645 C( J, 4 ) = C( J, 4 ) - SUM*T4
646 C( J, 5 ) = C( J, 5 ) - SUM*T5
647 C( J, 6 ) = C( J, 6 ) - SUM*T6
648 C( J, 7 ) = C( J, 7 ) - SUM*T7
649 C( J, 8 ) = C( J, 8 ) - SUM*T8
650 C( J, 9 ) = C( J, 9 ) - SUM*T9
655 * Special code for 10 x 10 Householder
658 T1 = TAU*DCONJG( V1 )
660 T2 = TAU*DCONJG( V2 )
662 T3 = TAU*DCONJG( V3 )
664 T4 = TAU*DCONJG( V4 )
666 T5 = TAU*DCONJG( V5 )
668 T6 = TAU*DCONJG( V6 )
670 T7 = TAU*DCONJG( V7 )
672 T8 = TAU*DCONJG( V8 )
674 T9 = TAU*DCONJG( V9 )
676 T10 = TAU*DCONJG( V10 )
678 SUM = V1*C( J, 1 ) + V2*C( J, 2 ) + V3*C( J, 3 ) +
679 $ V4*C( J, 4 ) + V5*C( J, 5 ) + V6*C( J, 6 ) +
680 $ V7*C( J, 7 ) + V8*C( J, 8 ) + V9*C( J, 9 ) +
682 C( J, 1 ) = C( J, 1 ) - SUM*T1
683 C( J, 2 ) = C( J, 2 ) - SUM*T2
684 C( J, 3 ) = C( J, 3 ) - SUM*T3
685 C( J, 4 ) = C( J, 4 ) - SUM*T4
686 C( J, 5 ) = C( J, 5 ) - SUM*T5
687 C( J, 6 ) = C( J, 6 ) - SUM*T6
688 C( J, 7 ) = C( J, 7 ) - SUM*T7
689 C( J, 8 ) = C( J, 8 ) - SUM*T8
690 C( J, 9 ) = C( J, 9 ) - SUM*T9
691 C( J, 10 ) = C( J, 10 ) - SUM*T10