1 *> \brief \b SLARZB applies a block reflector or its transpose to a general matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLARZB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarzb.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarzb.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarzb.f">
21 * SUBROUTINE SLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
22 * LDV, T, LDT, C, LDC, WORK, LDWORK )
24 * .. Scalar Arguments ..
25 * CHARACTER DIRECT, SIDE, STOREV, TRANS
26 * INTEGER K, L, LDC, LDT, LDV, LDWORK, M, N
28 * .. Array Arguments ..
29 * REAL C( LDC, * ), T( LDT, * ), V( LDV, * ),
39 *> SLARZB applies a real block reflector H or its transpose H**T to
40 *> a real distributed M-by-N C from the left or the right.
42 *> Currently, only STOREV = 'R' and DIRECT = 'B' are supported.
50 *> SIDE is CHARACTER*1
51 *> = 'L': apply H or H**T from the Left
52 *> = 'R': apply H or H**T from the Right
57 *> TRANS is CHARACTER*1
58 *> = 'N': apply H (No transpose)
59 *> = 'C': apply H**T (Transpose)
64 *> DIRECT is CHARACTER*1
65 *> Indicates how H is formed from a product of elementary
67 *> = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet)
68 *> = 'B': H = H(k) . . . H(2) H(1) (Backward)
73 *> STOREV is CHARACTER*1
74 *> Indicates how the vectors which define the elementary
75 *> reflectors are stored:
76 *> = 'C': Columnwise (not supported yet)
83 *> The number of rows of the matrix C.
89 *> The number of columns of the matrix C.
95 *> The order of the matrix T (= the number of elementary
96 *> reflectors whose product defines the block reflector).
102 *> The number of columns of the matrix V containing the
103 *> meaningful part of the Householder reflectors.
104 *> If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
109 *> V is REAL array, dimension (LDV,NV).
110 *> If STOREV = 'C', NV = K; if STOREV = 'R', NV = L.
116 *> The leading dimension of the array V.
117 *> If STOREV = 'C', LDV >= L; if STOREV = 'R', LDV >= K.
122 *> T is REAL array, dimension (LDT,K)
123 *> The triangular K-by-K matrix T in the representation of the
130 *> The leading dimension of the array T. LDT >= K.
135 *> C is REAL array, dimension (LDC,N)
136 *> On entry, the M-by-N matrix C.
137 *> On exit, C is overwritten by H*C or H**T*C or C*H or C*H**T.
143 *> The leading dimension of the array C. LDC >= max(1,M).
148 *> WORK is REAL array, dimension (LDWORK,K)
154 *> The leading dimension of the array WORK.
155 *> If SIDE = 'L', LDWORK >= max(1,N);
156 *> if SIDE = 'R', LDWORK >= max(1,M).
162 *> \author Univ. of Tennessee
163 *> \author Univ. of California Berkeley
164 *> \author Univ. of Colorado Denver
167 *> \date September 2012
169 *> \ingroup realOTHERcomputational
171 *> \par Contributors:
174 *> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
176 *> \par Further Details:
177 * =====================
182 * =====================================================================
183 SUBROUTINE SLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
184 $ LDV, T, LDT, C, LDC, WORK, LDWORK )
186 * -- LAPACK computational routine (version 3.4.2) --
187 * -- LAPACK is a software package provided by Univ. of Tennessee, --
188 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
191 * .. Scalar Arguments ..
192 CHARACTER DIRECT, SIDE, STOREV, TRANS
193 INTEGER K, L, LDC, LDT, LDV, LDWORK, M, N
195 * .. Array Arguments ..
196 REAL C( LDC, * ), T( LDT, * ), V( LDV, * ),
200 * =====================================================================
204 PARAMETER ( ONE = 1.0E+0 )
206 * .. Local Scalars ..
210 * .. External Functions ..
214 * .. External Subroutines ..
215 EXTERNAL SCOPY, SGEMM, STRMM, XERBLA
217 * .. Executable Statements ..
219 * Quick return if possible
221 IF( M.LE.0 .OR. N.LE.0 )
224 * Check for currently supported options
227 IF( .NOT.LSAME( DIRECT, 'B' ) ) THEN
229 ELSE IF( .NOT.LSAME( STOREV, 'R' ) ) THEN
233 CALL XERBLA( 'SLARZB', -INFO )
237 IF( LSAME( TRANS, 'N' ) ) THEN
243 IF( LSAME( SIDE, 'L' ) ) THEN
245 * Form H * C or H**T * C
247 * W( 1:n, 1:k ) = C( 1:k, 1:n )**T
250 CALL SCOPY( N, C( J, 1 ), LDC, WORK( 1, J ), 1 )
253 * W( 1:n, 1:k ) = W( 1:n, 1:k ) + ...
254 * C( m-l+1:m, 1:n )**T * V( 1:k, 1:l )**T
257 $ CALL SGEMM( 'Transpose', 'Transpose', N, K, L, ONE,
258 $ C( M-L+1, 1 ), LDC, V, LDV, ONE, WORK, LDWORK )
260 * W( 1:n, 1:k ) = W( 1:n, 1:k ) * T**T or W( 1:m, 1:k ) * T
262 CALL STRMM( 'Right', 'Lower', TRANST, 'Non-unit', N, K, ONE, T,
263 $ LDT, WORK, LDWORK )
265 * C( 1:k, 1:n ) = C( 1:k, 1:n ) - W( 1:n, 1:k )**T
269 C( I, J ) = C( I, J ) - WORK( J, I )
273 * C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
274 * V( 1:k, 1:l )**T * W( 1:n, 1:k )**T
277 $ CALL SGEMM( 'Transpose', 'Transpose', L, N, K, -ONE, V, LDV,
278 $ WORK, LDWORK, ONE, C( M-L+1, 1 ), LDC )
280 ELSE IF( LSAME( SIDE, 'R' ) ) THEN
282 * Form C * H or C * H**T
284 * W( 1:m, 1:k ) = C( 1:m, 1:k )
287 CALL SCOPY( M, C( 1, J ), 1, WORK( 1, J ), 1 )
290 * W( 1:m, 1:k ) = W( 1:m, 1:k ) + ...
291 * C( 1:m, n-l+1:n ) * V( 1:k, 1:l )**T
294 $ CALL SGEMM( 'No transpose', 'Transpose', M, K, L, ONE,
295 $ C( 1, N-L+1 ), LDC, V, LDV, ONE, WORK, LDWORK )
297 * W( 1:m, 1:k ) = W( 1:m, 1:k ) * T or W( 1:m, 1:k ) * T**T
299 CALL STRMM( 'Right', 'Lower', TRANS, 'Non-unit', M, K, ONE, T,
300 $ LDT, WORK, LDWORK )
302 * C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k )
306 C( I, J ) = C( I, J ) - WORK( I, J )
310 * C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
311 * W( 1:m, 1:k ) * V( 1:k, 1:l )
314 $ CALL SGEMM( 'No transpose', 'No transpose', M, L, K, -ONE,
315 $ WORK, LDWORK, V, LDV, ONE, C( 1, N-L+1 ), LDC )