1
SUBROUTINE ZLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
2
$ LDV, T, LDT, C, LDC, WORK, LDWORK )
4
* -- LAPACK routine (version 3.0) --
5
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6
* Courant Institute, Argonne National Lab, and Rice University
9
* .. Scalar Arguments ..
10
CHARACTER DIRECT, SIDE, STOREV, TRANS
11
INTEGER K, L, LDC, LDT, LDV, LDWORK, M, N
13
* .. Array Arguments ..
14
COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ),
21
* ZLARZB applies a complex block reflector H or its transpose H**H
22
* to a complex distributed M-by-N C from the left or the right.
24
* Currently, only STOREV = 'R' and DIRECT = 'B' are supported.
29
* SIDE (input) CHARACTER*1
30
* = 'L': apply H or H' from the Left
31
* = 'R': apply H or H' from the Right
33
* TRANS (input) CHARACTER*1
34
* = 'N': apply H (No transpose)
35
* = 'C': apply H' (Conjugate transpose)
37
* DIRECT (input) CHARACTER*1
38
* Indicates how H is formed from a product of elementary
40
* = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet)
41
* = 'B': H = H(k) . . . H(2) H(1) (Backward)
43
* STOREV (input) CHARACTER*1
44
* Indicates how the vectors which define the elementary
45
* reflectors are stored:
46
* = 'C': Columnwise (not supported yet)
50
* The number of rows of the matrix C.
53
* The number of columns of the matrix C.
56
* The order of the matrix T (= the number of elementary
57
* reflectors whose product defines the block reflector).
60
* The number of columns of the matrix V containing the
61
* meaningful part of the Householder reflectors.
62
* If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
64
* V (input) COMPLEX*16 array, dimension (LDV,NV).
65
* If STOREV = 'C', NV = K; if STOREV = 'R', NV = L.
68
* The leading dimension of the array V.
69
* If STOREV = 'C', LDV >= L; if STOREV = 'R', LDV >= K.
71
* T (input) COMPLEX*16 array, dimension (LDT,K)
72
* The triangular K-by-K matrix T in the representation of the
76
* The leading dimension of the array T. LDT >= K.
78
* C (input/output) COMPLEX*16 array, dimension (LDC,N)
79
* On entry, the M-by-N matrix C.
80
* On exit, C is overwritten by H*C or H'*C or C*H or C*H'.
83
* The leading dimension of the array C. LDC >= max(1,M).
85
* WORK (workspace) COMPLEX*16 array, dimension (LDWORK,K)
87
* LDWORK (input) INTEGER
88
* The leading dimension of the array WORK.
89
* If SIDE = 'L', LDWORK >= max(1,N);
90
* if SIDE = 'R', LDWORK >= max(1,M).
95
* Based on contributions by
96
* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
98
* =====================================================================
102
PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
104
* .. Local Scalars ..
108
* .. External Functions ..
112
* .. External Subroutines ..
113
EXTERNAL XERBLA, ZCOPY, ZGEMM, ZLACGV, ZTRMM
115
* .. Executable Statements ..
117
* Quick return if possible
119
IF( M.LE.0 .OR. N.LE.0 )
122
* Check for currently supported options
125
IF( .NOT.LSAME( DIRECT, 'B' ) ) THEN
127
ELSE IF( .NOT.LSAME( STOREV, 'R' ) ) THEN
131
CALL XERBLA( 'ZLARZB', -INFO )
135
IF( LSAME( TRANS, 'N' ) ) THEN
141
IF( LSAME( SIDE, 'L' ) ) THEN
143
* Form H * C or H' * C
145
* W( 1:n, 1:k ) = conjg( C( 1:k, 1:n )' )
148
CALL ZCOPY( N, C( J, 1 ), LDC, WORK( 1, J ), 1 )
151
* W( 1:n, 1:k ) = W( 1:n, 1:k ) + ...
152
* conjg( C( m-l+1:m, 1:n )' ) * V( 1:k, 1:l )'
155
$ CALL ZGEMM( 'Transpose', 'Conjugate transpose', N, K, L,
156
$ ONE, C( M-L+1, 1 ), LDC, V, LDV, ONE, WORK,
159
* W( 1:n, 1:k ) = W( 1:n, 1:k ) * T' or W( 1:m, 1:k ) * T
161
CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit', N, K, ONE, T,
162
$ LDT, WORK, LDWORK )
164
* C( 1:k, 1:n ) = C( 1:k, 1:n ) - conjg( W( 1:n, 1:k )' )
168
C( I, J ) = C( I, J ) - WORK( J, I )
172
* C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
173
* conjg( V( 1:k, 1:l )' ) * conjg( W( 1:n, 1:k )' )
176
$ CALL ZGEMM( 'Transpose', 'Transpose', L, N, K, -ONE, V, LDV,
177
$ WORK, LDWORK, ONE, C( M-L+1, 1 ), LDC )
179
ELSE IF( LSAME( SIDE, 'R' ) ) THEN
181
* Form C * H or C * H'
183
* W( 1:m, 1:k ) = C( 1:m, 1:k )
186
CALL ZCOPY( M, C( 1, J ), 1, WORK( 1, J ), 1 )
189
* W( 1:m, 1:k ) = W( 1:m, 1:k ) + ...
190
* C( 1:m, n-l+1:n ) * conjg( V( 1:k, 1:l )' )
193
$ CALL ZGEMM( 'No transpose', 'Transpose', M, K, L, ONE,
194
$ C( 1, N-L+1 ), LDC, V, LDV, ONE, WORK, LDWORK )
196
* W( 1:m, 1:k ) = W( 1:m, 1:k ) * conjg( T ) or
197
* W( 1:m, 1:k ) * conjg( T' )
200
CALL ZLACGV( K-J+1, T( J, J ), 1 )
202
CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit', M, K, ONE, T,
203
$ LDT, WORK, LDWORK )
205
CALL ZLACGV( K-J+1, T( J, J ), 1 )
208
* C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k )
212
C( I, J ) = C( I, J ) - WORK( I, J )
216
* C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
217
* W( 1:m, 1:k ) * conjg( V( 1:k, 1:l ) )
220
CALL ZLACGV( K, V( 1, J ), 1 )
223
$ CALL ZGEMM( 'No transpose', 'No transpose', M, L, K, -ONE,
224
$ WORK, LDWORK, V, LDV, ONE, C( 1, N-L+1 ), LDC )
226
CALL ZLACGV( K, V( 1, J ), 1 )