1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
*> \brief \b CLARZB
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition
* ==========
*
* SUBROUTINE CLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
* LDV, T, LDT, C, LDC, WORK, LDWORK )
*
* .. Scalar Arguments ..
* CHARACTER DIRECT, SIDE, STOREV, TRANS
* INTEGER K, L, LDC, LDT, LDV, LDWORK, M, N
* ..
* .. Array Arguments ..
* COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ),
* $ WORK( LDWORK, * )
* ..
*
* Purpose
* =======
*
*>\details \b Purpose:
*>\verbatim
*>
*> CLARZB applies a complex block reflector H or its transpose H**H
*> to a complex distributed M-by-N C from the left or the right.
*>
*> Currently, only STOREV = 'R' and DIRECT = 'B' are supported.
*>
*>\endverbatim
*
* Arguments
* =========
*
*> \param[in] SIDE
*> \verbatim
*> SIDE is CHARACTER*1
*> = 'L': apply H or H**H from the Left
*> = 'R': apply H or H**H from the Right
*> \endverbatim
*>
*> \param[in] TRANS
*> \verbatim
*> TRANS is CHARACTER*1
*> = 'N': apply H (No transpose)
*> = 'C': apply H**H (Conjugate transpose)
*> \endverbatim
*>
*> \param[in] DIRECT
*> \verbatim
*> DIRECT is CHARACTER*1
*> Indicates how H is formed from a product of elementary
*> reflectors
*> = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet)
*> = 'B': H = H(k) . . . H(2) H(1) (Backward)
*> \endverbatim
*>
*> \param[in] STOREV
*> \verbatim
*> STOREV is CHARACTER*1
*> Indicates how the vectors which define the elementary
*> reflectors are stored:
*> = 'C': Columnwise (not supported yet)
*> = 'R': Rowwise
*> \endverbatim
*>
*> \param[in] M
*> \verbatim
*> M is INTEGER
*> The number of rows of the matrix C.
*> \endverbatim
*>
*> \param[in] N
*> \verbatim
*> N is INTEGER
*> The number of columns of the matrix C.
*> \endverbatim
*>
*> \param[in] K
*> \verbatim
*> K is INTEGER
*> The order of the matrix T (= the number of elementary
*> reflectors whose product defines the block reflector).
*> \endverbatim
*>
*> \param[in] L
*> \verbatim
*> L is INTEGER
*> The number of columns of the matrix V containing the
*> meaningful part of the Householder reflectors.
*> If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
*> \endverbatim
*>
*> \param[in] V
*> \verbatim
*> V is COMPLEX array, dimension (LDV,NV).
*> If STOREV = 'C', NV = K; if STOREV = 'R', NV = L.
*> \endverbatim
*>
*> \param[in] LDV
*> \verbatim
*> LDV is INTEGER
*> The leading dimension of the array V.
*> If STOREV = 'C', LDV >= L; if STOREV = 'R', LDV >= K.
*> \endverbatim
*>
*> \param[in] T
*> \verbatim
*> T is COMPLEX array, dimension (LDT,K)
*> The triangular K-by-K matrix T in the representation of the
*> block reflector.
*> \endverbatim
*>
*> \param[in] LDT
*> \verbatim
*> LDT is INTEGER
*> The leading dimension of the array T. LDT >= K.
*> \endverbatim
*>
*> \param[in,out] C
*> \verbatim
*> C is COMPLEX array, dimension (LDC,N)
*> On entry, the M-by-N matrix C.
*> On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H.
*> \endverbatim
*>
*> \param[in] LDC
*> \verbatim
*> LDC is INTEGER
*> The leading dimension of the array C. LDC >= max(1,M).
*> \endverbatim
*>
*> \param[out] WORK
*> \verbatim
*> WORK is COMPLEX array, dimension (LDWORK,K)
*> \endverbatim
*>
*> \param[in] LDWORK
*> \verbatim
*> LDWORK is INTEGER
*> The leading dimension of the array WORK.
*> If SIDE = 'L', LDWORK >= max(1,N);
*> if SIDE = 'R', LDWORK >= max(1,M).
*> \endverbatim
*>
*
* Authors
* =======
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date November 2011
*
*> \ingroup complexOTHERcomputational
*
*
* Further Details
* ===============
*>\details \b Further \b Details
*> \verbatim
*>
*> Based on contributions by
*> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
*>
*> \endverbatim
*>
* =====================================================================
SUBROUTINE CLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
$ LDV, T, LDT, C, LDC, WORK, LDWORK )
*
* -- LAPACK computational routine (version 3.3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
CHARACTER DIRECT, SIDE, STOREV, TRANS
INTEGER K, L, LDC, LDT, LDV, LDWORK, M, N
* ..
* .. Array Arguments ..
COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ),
$ WORK( LDWORK, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX ONE
PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) )
* ..
* .. Local Scalars ..
CHARACTER TRANST
INTEGER I, INFO, J
* ..
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
* ..
* .. External Subroutines ..
EXTERNAL CCOPY, CGEMM, CLACGV, CTRMM, XERBLA
* ..
* .. Executable Statements ..
*
* Quick return if possible
*
IF( M.LE.0 .OR. N.LE.0 )
$ RETURN
*
* Check for currently supported options
*
INFO = 0
IF( .NOT.LSAME( DIRECT, 'B' ) ) THEN
INFO = -3
ELSE IF( .NOT.LSAME( STOREV, 'R' ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CLARZB', -INFO )
RETURN
END IF
*
IF( LSAME( TRANS, 'N' ) ) THEN
TRANST = 'C'
ELSE
TRANST = 'N'
END IF
*
IF( LSAME( SIDE, 'L' ) ) THEN
*
* Form H * C or H**H * C
*
* W( 1:n, 1:k ) = C( 1:k, 1:n )**H
*
DO 10 J = 1, K
CALL CCOPY( N, C( J, 1 ), LDC, WORK( 1, J ), 1 )
10 CONTINUE
*
* W( 1:n, 1:k ) = W( 1:n, 1:k ) + ...
* C( m-l+1:m, 1:n )**H * V( 1:k, 1:l )**T
*
IF( L.GT.0 )
$ CALL CGEMM( 'Transpose', 'Conjugate transpose', N, K, L,
$ ONE, C( M-L+1, 1 ), LDC, V, LDV, ONE, WORK,
$ LDWORK )
*
* W( 1:n, 1:k ) = W( 1:n, 1:k ) * T**T or W( 1:m, 1:k ) * T
*
CALL CTRMM( 'Right', 'Lower', TRANST, 'Non-unit', N, K, ONE, T,
$ LDT, WORK, LDWORK )
*
* C( 1:k, 1:n ) = C( 1:k, 1:n ) - W( 1:n, 1:k )**H
*
DO 30 J = 1, N
DO 20 I = 1, K
C( I, J ) = C( I, J ) - WORK( J, I )
20 CONTINUE
30 CONTINUE
*
* C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
* V( 1:k, 1:l )**H * W( 1:n, 1:k )**H
*
IF( L.GT.0 )
$ CALL CGEMM( 'Transpose', 'Transpose', L, N, K, -ONE, V, LDV,
$ WORK, LDWORK, ONE, C( M-L+1, 1 ), LDC )
*
ELSE IF( LSAME( SIDE, 'R' ) ) THEN
*
* Form C * H or C * H**H
*
* W( 1:m, 1:k ) = C( 1:m, 1:k )
*
DO 40 J = 1, K
CALL CCOPY( M, C( 1, J ), 1, WORK( 1, J ), 1 )
40 CONTINUE
*
* W( 1:m, 1:k ) = W( 1:m, 1:k ) + ...
* C( 1:m, n-l+1:n ) * V( 1:k, 1:l )**H
*
IF( L.GT.0 )
$ CALL CGEMM( 'No transpose', 'Transpose', M, K, L, ONE,
$ C( 1, N-L+1 ), LDC, V, LDV, ONE, WORK, LDWORK )
*
* W( 1:m, 1:k ) = W( 1:m, 1:k ) * conjg( T ) or
* W( 1:m, 1:k ) * T**H
*
DO 50 J = 1, K
CALL CLACGV( K-J+1, T( J, J ), 1 )
50 CONTINUE
CALL CTRMM( 'Right', 'Lower', TRANS, 'Non-unit', M, K, ONE, T,
$ LDT, WORK, LDWORK )
DO 60 J = 1, K
CALL CLACGV( K-J+1, T( J, J ), 1 )
60 CONTINUE
*
* C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k )
*
DO 80 J = 1, K
DO 70 I = 1, M
C( I, J ) = C( I, J ) - WORK( I, J )
70 CONTINUE
80 CONTINUE
*
* C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
* W( 1:m, 1:k ) * conjg( V( 1:k, 1:l ) )
*
DO 90 J = 1, L
CALL CLACGV( K, V( 1, J ), 1 )
90 CONTINUE
IF( L.GT.0 )
$ CALL CGEMM( 'No transpose', 'No transpose', M, L, K, -ONE,
$ WORK, LDWORK, V, LDV, ONE, C( 1, N-L+1 ), LDC )
DO 100 J = 1, L
CALL CLACGV( K, V( 1, J ), 1 )
100 CONTINUE
*
END IF
*
RETURN
*
* End of CLARZB
*
END
|