3 * =========== DOCUMENTATION
===========
5 * Online html documentation available at
6 * http
://www
.netlib
.org
/lapack
/explore
-html
/
9 *> Download ZLARFB
+ dependencies
10 *> <a href
="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarfb.f">
12 *> <a href
="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarfb.f">
14 *> <a href
="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarfb.f">
21 * SUBROUTINE ZLARFB
( SIDE
, TRANS
, DIRECT
, STOREV
, M
, N
, K
, V
, LDV
,
22 * T
, LDT
, C
, LDC
, WORK
, LDWORK
)
24 * .. Scalar Arguments
..
25 * CHARACTER DIRECT
, SIDE
, STOREV
, TRANS
26 * INTEGER K
, LDC
, LDT
, LDV
, LDWORK
, M
, N
28 * .. Array Arguments
..
29 * COMPLEX*16 C
( LDC
, * ), T
( LDT
, * ), V
( LDV
, * ),
39 *> ZLARFB applies a
complex block reflector H or its transpose H**H
to a
40 *> complex M
-by
-N matrix C
, from either the left or the right
.
48 *> SIDE is CHARACTER*1
49 *> = 'L': apply H or H**H from the Left
50 *> = 'R': apply H or H**H from the Right
55 *> TRANS is CHARACTER*1
56 *> = 'N': apply H
(No transpose
)
57 *> = 'C': apply H**H
(Conjugate transpose
)
62 *> DIRECT is CHARACTER*1
63 *> Indicates how H is formed from a product of elementary
65 *> = 'F': H
= H
(1) H
(2) . . . H
(k
) (Forward
)
66 *> = 'B': H
= H
(k
) . . . H
(2) H
(1) (Backward
)
71 *> STOREV is CHARACTER*1
72 *> Indicates how the vectors which define the elementary
73 *> reflectors are stored
:
81 *> The number of rows of the matrix C
.
87 *> The number of columns of the matrix C
.
93 *> The order of the matrix T
(= the number of elementary
94 *> reflectors whose product defines the block reflector
).
99 *> V is COMPLEX*16 array
, dimension
100 *> (LDV
,K
) if STOREV
= 'C'
101 *> (LDV
,M
) if STOREV
= 'R' and SIDE
= 'L'
102 *> (LDV
,N
) if STOREV
= 'R' and SIDE
= 'R'
103 *> See Further Details
.
109 *> The leading
dimension of the array V
.
110 *> If STOREV
= 'C' and SIDE
= 'L', LDV
>= max
(1,M
);
111 *> if STOREV
= 'C' and SIDE
= 'R', LDV
>= max
(1,N
);
112 *> if STOREV
= 'R', LDV
>= K
.
117 *> T is COMPLEX*16 array
, dimension (LDT
,K
)
118 *> The triangular K
-by
-K matrix T in the representation of the
125 *> The leading
dimension of the array T
. LDT
>= K
.
130 *> C is COMPLEX*16 array
, dimension (LDC
,N
)
131 *> On entry
, the M
-by
-N matrix C
.
132 *> On exit
, C is overwritten by H*C or H**H*C or C*H or C*H**H
.
138 *> The leading
dimension of the array C
. LDC
>= max
(1,M
).
143 *> WORK is COMPLEX*16 array
, dimension (LDWORK
,K
)
149 *> The leading
dimension of the array WORK
.
150 *> If SIDE
= 'L', LDWORK
>= max
(1,N
);
151 *> if SIDE
= 'R', LDWORK
>= max
(1,M
).
157 *> \author Univ
. of Tennessee
158 *> \author Univ
. of California Berkeley
159 *> \author Univ
. of Colorado Denver
162 *> \
date November
2011
164 *> \ingroup complex16OTHERauxiliary
166 *> \par Further Details
:
167 * =====================
171 *> The shape of the matrix V and the storage of the vectors which define
172 *> the H
(i
) is best illustrated by the following example with n
= 5 and
173 *> k
= 3. The elements equal
to 1 are not stored
; the corresponding
174 *> array elements are modified but restored on exit
. The rest of the
175 *> array is not used
.
177 *> DIRECT
= 'F' and STOREV
= 'C': DIRECT
= 'F' and STOREV
= 'R':
179 *> V
= ( 1 ) V
= ( 1 v1 v1 v1 v1
)
180 *> ( v1
1 ) ( 1 v2 v2 v2
)
181 *> ( v1 v2
1 ) ( 1 v3 v3
)
185 *> DIRECT
= 'B' and STOREV
= 'C': DIRECT
= 'B' and STOREV
= 'R':
187 *> V
= ( v1 v2 v3
) V
= ( v1 v1
1 )
188 *> ( v1 v2 v3
) ( v2 v2 v2
1 )
189 *> ( 1 v2 v3
) ( v3 v3 v3 v3
1 )
194 * =====================================================================
195 SUBROUTINE ZLARFB
( SIDE
, TRANS
, DIRECT
, STOREV
, M
, N
, K
, V
, LDV
,
196 $ T
, LDT
, C
, LDC
, WORK
, LDWORK
)
198 * -- LAPACK auxiliary routine
(version
3.4.0) --
199 * -- LAPACK is a software package provided by Univ
. of Tennessee
, --
200 * -- Univ
. of California Berkeley
, Univ
. of Colorado Denver and NAG Ltd
..--
203 * .. Scalar Arguments
..
204 CHARACTER DIRECT
, SIDE
, STOREV
, TRANS
205 INTEGER K
, LDC
, LDT
, LDV
, LDWORK
, M
, N
207 * .. Array Arguments
..
208 COMPLEX*16 C
( LDC
, * ), T
( LDT
, * ), V
( LDV
, * ),
212 * =====================================================================
216 PARAMETER ( ONE
= ( 1.0D
+0, 0.0D
+0 ) )
218 * .. Local Scalars
..
220 INTEGER I
, J
, LASTV
, LASTC
222 * .. External Functions
..
224 INTEGER ILAZLR
, ILAZLC
225 EXTERNAL LSAME
, ILAZLR
, ILAZLC
227 * .. External Subroutines
..
228 EXTERNAL ZCOPY
, ZGEMM
, ZLACGV
, ZTRMM
230 * .. Intrinsic Functions
..
233 * .. Executable Statements
..
235 * Quick
return if possible
237 IF( M
.LE
.0 .OR
. N
.LE
.0 )
240 IF( LSAME
( TRANS
, 'N' ) ) THEN
246 IF( LSAME
( STOREV
, 'C' ) ) THEN
248 IF( LSAME
( DIRECT
, 'F' ) ) THEN
250 * Let V
= ( V1
) (first K rows
)
252 * where V1 is unit lower triangular
.
254 IF( LSAME
( SIDE
, 'L' ) ) THEN
256 * Form H
* C or H**H
* C where C
= ( C1
)
259 LASTV
= MAX
( K
, ILAZLR
( M
, K
, V
, LDV
) )
260 LASTC
= ILAZLC
( LASTV
, N
, C
, LDC
)
262 * W
:= C**H
* V
= (C1**H
* V1
+ C2**H
* V2
) (stored in WORK
)
267 CALL ZCOPY
( LASTC
, C
( J
, 1 ), LDC
, WORK
( 1, J
), 1 )
268 CALL ZLACGV
( LASTC
, WORK
( 1, J
), 1 )
273 CALL ZTRMM
( 'Right', 'Lower', 'No transpose', 'Unit',
274 $ LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
275 IF( LASTV
.GT
.K
) THEN
279 CALL ZGEMM
( 'Conjugate transpose', 'No transpose',
280 $ LASTC
, K
, LASTV
-K
, ONE
, C
( K
+1, 1 ), LDC
,
281 $ V
( K
+1, 1 ), LDV
, ONE
, WORK
, LDWORK
)
284 * W
:= W
* T**H or W
* T
286 CALL ZTRMM
( 'Right', 'Upper', TRANST
, 'Non-unit',
287 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
293 * C2
:= C2
- V2
* W**H
295 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
297 $
-ONE
, V
( K
+1, 1 ), LDV
, WORK
, LDWORK
,
298 $ ONE
, C
( K
+1, 1 ), LDC
)
303 CALL ZTRMM
( 'Right', 'Lower', 'Conjugate transpose',
304 $
'Unit', LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
310 C
( J
, I
) = C
( J
, I
) - DCONJG
( WORK
( I
, J
) )
314 ELSE IF( LSAME
( SIDE
, 'R' ) ) THEN
316 * Form C
* H or C
* H**H where C
= ( C1 C2
)
318 LASTV
= MAX
( K
, ILAZLR
( N
, K
, V
, LDV
) )
319 LASTC
= ILAZLR
( M
, LASTV
, C
, LDC
)
321 * W
:= C
* V
= (C1*V1
+ C2*V2
) (stored in WORK
)
326 CALL ZCOPY
( LASTC
, C
( 1, J
), 1, WORK
( 1, J
), 1 )
331 CALL ZTRMM
( 'Right', 'Lower', 'No transpose', 'Unit',
332 $ LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
333 IF( LASTV
.GT
.K
) THEN
337 CALL ZGEMM
( 'No transpose', 'No transpose',
339 $ ONE
, C
( 1, K
+1 ), LDC
, V
( K
+1, 1 ), LDV
,
340 $ ONE
, WORK
, LDWORK
)
343 * W
:= W
* T or W
* T**H
345 CALL ZTRMM
( 'Right', 'Upper', TRANS
, 'Non-unit',
346 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
350 IF( LASTV
.GT
.K
) THEN
352 * C2
:= C2
- W
* V2**H
354 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
356 $
-ONE
, WORK
, LDWORK
, V
( K
+1, 1 ), LDV
,
357 $ ONE
, C
( 1, K
+1 ), LDC
)
362 CALL ZTRMM
( 'Right', 'Lower', 'Conjugate transpose',
363 $
'Unit', LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
369 C
( I
, J
) = C
( I
, J
) - WORK
( I
, J
)
377 * ( V2
) (last K rows
)
378 * where V2 is unit upper triangular
.
380 IF( LSAME
( SIDE
, 'L' ) ) THEN
382 * Form H
* C or H**H
* C where C
= ( C1
)
385 LASTV
= MAX
( K
, ILAZLR
( M
, K
, V
, LDV
) )
386 LASTC
= ILAZLC
( LASTV
, N
, C
, LDC
)
388 * W
:= C**H
* V
= (C1**H
* V1
+ C2**H
* V2
) (stored in WORK
)
393 CALL ZCOPY
( LASTC
, C
( LASTV
-K
+J
, 1 ), LDC
,
395 CALL ZLACGV
( LASTC
, WORK
( 1, J
), 1 )
400 CALL ZTRMM
( 'Right', 'Upper', 'No transpose', 'Unit',
401 $ LASTC
, K
, ONE
, V
( LASTV
-K
+1, 1 ), LDV
,
403 IF( LASTV
.GT
.K
) THEN
407 CALL ZGEMM
( 'Conjugate transpose', 'No transpose',
409 $ ONE
, C
, LDC
, V
, LDV
,
410 $ ONE
, WORK
, LDWORK
)
413 * W
:= W
* T**H or W
* T
415 CALL ZTRMM
( 'Right', 'Lower', TRANST
, 'Non-unit',
416 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
420 IF( LASTV
.GT
.K
) THEN
422 * C1
:= C1
- V1
* W**H
424 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
426 $
-ONE
, V
, LDV
, WORK
, LDWORK
,
432 CALL ZTRMM
( 'Right', 'Upper', 'Conjugate transpose',
433 $
'Unit', LASTC
, K
, ONE
, V
( LASTV
-K
+1, 1 ), LDV
,
440 C
( LASTV
-K
+J
, I
) = C
( LASTV
-K
+J
, I
) -
441 $ DCONJG
( WORK
( I
, J
) )
445 ELSE IF( LSAME
( SIDE
, 'R' ) ) THEN
447 * Form C
* H or C
* H**H where C
= ( C1 C2
)
449 LASTV
= MAX
( K
, ILAZLR
( N
, K
, V
, LDV
) )
450 LASTC
= ILAZLR
( M
, LASTV
, C
, LDC
)
452 * W
:= C
* V
= (C1*V1
+ C2*V2
) (stored in WORK
)
457 CALL ZCOPY
( LASTC
, C
( 1, LASTV
-K
+J
), 1,
463 CALL ZTRMM
( 'Right', 'Upper', 'No transpose', 'Unit',
464 $ LASTC
, K
, ONE
, V
( LASTV
-K
+1, 1 ), LDV
,
466 IF( LASTV
.GT
.K
) THEN
470 CALL ZGEMM
( 'No transpose', 'No transpose',
472 $ ONE
, C
, LDC
, V
, LDV
, ONE
, WORK
, LDWORK
)
475 * W
:= W
* T or W
* T**H
477 CALL ZTRMM
( 'Right', 'Lower', TRANS
, 'Non-unit',
478 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
482 IF( LASTV
.GT
.K
) THEN
484 * C1
:= C1
- W
* V1**H
486 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
487 $ LASTC
, LASTV
-K
, K
, -ONE
, WORK
, LDWORK
, V
, LDV
,
493 CALL ZTRMM
( 'Right', 'Upper', 'Conjugate transpose',
494 $
'Unit', LASTC
, K
, ONE
, V
( LASTV
-K
+1, 1 ), LDV
,
501 C
( I
, LASTV
-K
+J
) = C
( I
, LASTV
-K
+J
)
508 ELSE IF( LSAME
( STOREV
, 'R' ) ) THEN
510 IF( LSAME
( DIRECT
, 'F' ) ) THEN
512 * Let V
= ( V1 V2
) (V1
: first K columns
)
513 * where V1 is unit upper triangular
.
515 IF( LSAME
( SIDE
, 'L' ) ) THEN
517 * Form H
* C or H**H
* C where C
= ( C1
)
520 LASTV
= MAX
( K
, ILAZLC
( K
, M
, V
, LDV
) )
521 LASTC
= ILAZLC
( LASTV
, N
, C
, LDC
)
523 * W
:= C**H
* V**H
= (C1**H
* V1**H
+ C2**H
* V2**H
) (stored in WORK
)
528 CALL ZCOPY
( LASTC
, C
( J
, 1 ), LDC
, WORK
( 1, J
), 1 )
529 CALL ZLACGV
( LASTC
, WORK
( 1, J
), 1 )
534 CALL ZTRMM
( 'Right', 'Upper', 'Conjugate transpose',
535 $
'Unit', LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
536 IF( LASTV
.GT
.K
) THEN
538 * W
:= W
+ C2**H*V2**H
540 CALL ZGEMM
( 'Conjugate transpose',
541 $
'Conjugate transpose', LASTC
, K
, LASTV
-K
,
542 $ ONE
, C
( K
+1, 1 ), LDC
, V
( 1, K
+1 ), LDV
,
543 $ ONE
, WORK
, LDWORK
)
546 * W
:= W
* T**H or W
* T
548 CALL ZTRMM
( 'Right', 'Upper', TRANST
, 'Non-unit',
549 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
551 * C
:= C
- V**H
* W**H
553 IF( LASTV
.GT
.K
) THEN
555 * C2
:= C2
- V2**H
* W**H
557 CALL ZGEMM
( 'Conjugate transpose',
558 $
'Conjugate transpose', LASTV
-K
, LASTC
, K
,
559 $
-ONE
, V
( 1, K
+1 ), LDV
, WORK
, LDWORK
,
560 $ ONE
, C
( K
+1, 1 ), LDC
)
565 CALL ZTRMM
( 'Right', 'Upper', 'No transpose', 'Unit',
566 $ LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
572 C
( J
, I
) = C
( J
, I
) - DCONJG
( WORK
( I
, J
) )
576 ELSE IF( LSAME
( SIDE
, 'R' ) ) THEN
578 * Form C
* H or C
* H**H where C
= ( C1 C2
)
580 LASTV
= MAX
( K
, ILAZLC
( K
, N
, V
, LDV
) )
581 LASTC
= ILAZLR
( M
, LASTV
, C
, LDC
)
583 * W
:= C
* V**H
= (C1*V1**H
+ C2*V2**H
) (stored in WORK
)
588 CALL ZCOPY
( LASTC
, C
( 1, J
), 1, WORK
( 1, J
), 1 )
593 CALL ZTRMM
( 'Right', 'Upper', 'Conjugate transpose',
594 $
'Unit', LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
595 IF( LASTV
.GT
.K
) THEN
597 * W
:= W
+ C2
* V2**H
599 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
600 $ LASTC
, K
, LASTV
-K
, ONE
, C
( 1, K
+1 ), LDC
,
601 $ V
( 1, K
+1 ), LDV
, ONE
, WORK
, LDWORK
)
604 * W
:= W
* T or W
* T**H
606 CALL ZTRMM
( 'Right', 'Upper', TRANS
, 'Non-unit',
607 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
611 IF( LASTV
.GT
.K
) THEN
615 CALL ZGEMM
( 'No transpose', 'No transpose',
617 $
-ONE
, WORK
, LDWORK
, V
( 1, K
+1 ), LDV
,
618 $ ONE
, C
( 1, K
+1 ), LDC
)
623 CALL ZTRMM
( 'Right', 'Upper', 'No transpose', 'Unit',
624 $ LASTC
, K
, ONE
, V
, LDV
, WORK
, LDWORK
)
630 C
( I
, J
) = C
( I
, J
) - WORK
( I
, J
)
638 * Let V
= ( V1 V2
) (V2
: last K columns
)
639 * where V2 is unit lower triangular
.
641 IF( LSAME
( SIDE
, 'L' ) ) THEN
643 * Form H
* C or H**H
* C where C
= ( C1
)
646 LASTV
= MAX
( K
, ILAZLC
( K
, M
, V
, LDV
) )
647 LASTC
= ILAZLC
( LASTV
, N
, C
, LDC
)
649 * W
:= C**H
* V**H
= (C1**H
* V1**H
+ C2**H
* V2**H
) (stored in WORK
)
654 CALL ZCOPY
( LASTC
, C
( LASTV
-K
+J
, 1 ), LDC
,
656 CALL ZLACGV
( LASTC
, WORK
( 1, J
), 1 )
661 CALL ZTRMM
( 'Right', 'Lower', 'Conjugate transpose',
662 $
'Unit', LASTC
, K
, ONE
, V
( 1, LASTV
-K
+1 ), LDV
,
664 IF( LASTV
.GT
.K
) THEN
666 * W
:= W
+ C1**H
* V1**H
668 CALL ZGEMM
( 'Conjugate transpose',
669 $
'Conjugate transpose', LASTC
, K
, LASTV
-K
,
670 $ ONE
, C
, LDC
, V
, LDV
, ONE
, WORK
, LDWORK
)
673 * W
:= W
* T**H or W
* T
675 CALL ZTRMM
( 'Right', 'Lower', TRANST
, 'Non-unit',
676 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
678 * C
:= C
- V**H
* W**H
680 IF( LASTV
.GT
.K
) THEN
682 * C1
:= C1
- V1**H
* W**H
684 CALL ZGEMM
( 'Conjugate transpose',
685 $
'Conjugate transpose', LASTV
-K
, LASTC
, K
,
686 $
-ONE
, V
, LDV
, WORK
, LDWORK
, ONE
, C
, LDC
)
691 CALL ZTRMM
( 'Right', 'Lower', 'No transpose', 'Unit',
692 $ LASTC
, K
, ONE
, V
( 1, LASTV
-K
+1 ), LDV
,
699 C
( LASTV
-K
+J
, I
) = C
( LASTV
-K
+J
, I
) -
700 $ DCONJG
( WORK
( I
, J
) )
704 ELSE IF( LSAME
( SIDE
, 'R' ) ) THEN
706 * Form C
* H or C
* H**H where C
= ( C1 C2
)
708 LASTV
= MAX
( K
, ILAZLC
( K
, N
, V
, LDV
) )
709 LASTC
= ILAZLR
( M
, LASTV
, C
, LDC
)
711 * W
:= C
* V**H
= (C1*V1**H
+ C2*V2**H
) (stored in WORK
)
716 CALL ZCOPY
( LASTC
, C
( 1, LASTV
-K
+J
), 1,
722 CALL ZTRMM
( 'Right', 'Lower', 'Conjugate transpose',
723 $
'Unit', LASTC
, K
, ONE
, V
( 1, LASTV
-K
+1 ), LDV
,
725 IF( LASTV
.GT
.K
) THEN
727 * W
:= W
+ C1
* V1**H
729 CALL ZGEMM
( 'No transpose', 'Conjugate transpose',
730 $ LASTC
, K
, LASTV
-K
, ONE
, C
, LDC
, V
, LDV
, ONE
,
734 * W
:= W
* T or W
* T**H
736 CALL ZTRMM
( 'Right', 'Lower', TRANS
, 'Non-unit',
737 $ LASTC
, K
, ONE
, T
, LDT
, WORK
, LDWORK
)
741 IF( LASTV
.GT
.K
) THEN
745 CALL ZGEMM
( 'No transpose', 'No transpose',
746 $ LASTC
, LASTV
-K
, K
, -ONE
, WORK
, LDWORK
, V
, LDV
,
752 CALL ZTRMM
( 'Right', 'Lower', 'No transpose', 'Unit',
753 $ LASTC
, K
, ONE
, V
( 1, LASTV
-K
+1 ), LDV
,
760 C
( I
, LASTV
-K
+J
) = C
( I
, LASTV
-K
+J
)