LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zlarft()

subroutine zlarft ( character direct,
character storev,
integer n,
integer k,
complex*16, dimension( ldv, * ) v,
integer ldv,
complex*16, dimension( * ) tau,
complex*16, dimension( ldt, * ) t,
integer ldt )

ZLARFT forms the triangular factor T of a block reflector H = I - vtvH

Download ZLARFT + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLARFT forms the triangular factor T of a complex block reflector H
!> of order n, which is defined as a product of k elementary reflectors.
!>
!> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular;
!>
!> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular.
!>
!> If STOREV = 'C', the vector which defines the elementary reflector
!> H(i) is stored in the i-th column of the array V, and
!>
!>    H  =  I - V * T * V**H
!>
!> If STOREV = 'R', the vector which defines the elementary reflector
!> H(i) is stored in the i-th row of the array V, and
!>
!>    H  =  I - V**H * T * V
!> 
Parameters
[in]DIRECT
!>          DIRECT is CHARACTER*1
!>          Specifies the order in which the elementary reflectors are
!>          multiplied to form the block reflector:
!>          = 'F': H = H(1) H(2) . . . H(k) (Forward)
!>          = 'B': H = H(k) . . . H(2) H(1) (Backward)
!> 
[in]STOREV
!>          STOREV is CHARACTER*1
!>          Specifies how the vectors which define the elementary
!>          reflectors are stored (see also Further Details):
!>          = 'C': columnwise
!>          = 'R': rowwise
!> 
[in]N
!>          N is INTEGER
!>          The order of the block reflector H. N >= 0.
!> 
[in]K
!>          K is INTEGER
!>          The order of the triangular factor T (= the number of
!>          elementary reflectors). K >= 1.
!> 
[in]V
!>          V is COMPLEX*16 array, dimension
!>                               (LDV,K) if STOREV = 'C'
!>                               (LDV,N) if STOREV = 'R'
!>          The matrix V. See further details.
!> 
[in]LDV
!>          LDV is INTEGER
!>          The leading dimension of the array V.
!>          If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K.
!> 
[in]TAU
!>          TAU is COMPLEX*16 array, dimension (K)
!>          TAU(i) must contain the scalar factor of the elementary
!>          reflector H(i).
!> 
[out]T
!>          T is COMPLEX*16 array, dimension (LDT,K)
!>          The k by k triangular factor T of the block reflector.
!>          If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is
!>          lower triangular. The rest of the array is not used.
!> 
[in]LDT
!>          LDT is INTEGER
!>          The leading dimension of the array T. LDT >= K.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  The shape of the matrix V and the storage of the vectors which define
!>  the H(i) is best illustrated by the following example with n = 5 and
!>  k = 3. The elements equal to 1 are not stored.
!>
!>  DIRECT = 'F' and STOREV = 'C':         DIRECT = 'F' and STOREV = 'R':
!>
!>               V = (  1       )                 V = (  1 v1 v1 v1 v1 )
!>                   ( v1  1    )                     (     1 v2 v2 v2 )
!>                   ( v1 v2  1 )                     (        1 v3 v3 )
!>                   ( v1 v2 v3 )
!>                   ( v1 v2 v3 )
!>
!>  DIRECT = 'B' and STOREV = 'C':         DIRECT = 'B' and STOREV = 'R':
!>
!>               V = ( v1 v2 v3 )                 V = ( v1 v1  1       )
!>                   ( v1 v2 v3 )                     ( v2 v2 v2  1    )
!>                   (  1 v2 v3 )                     ( v3 v3 v3 v3  1 )
!>                   (     1 v3 )
!>                   (        1 )
!> 

Definition at line 160 of file zlarft.f.

161*
162* -- LAPACK auxiliary routine --
163* -- LAPACK is a software package provided by Univ. of Tennessee, --
164* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
165*
166* .. Scalar Arguments ..
167 CHARACTER DIRECT, STOREV
168 INTEGER K, LDT, LDV, N
169* ..
170* .. Array Arguments ..
171 COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * )
172* ..
173*
174* =====================================================================
175*
176* .. Parameters ..
177 COMPLEX*16 ONE, ZERO
178 parameter( one = ( 1.0d+0, 0.0d+0 ),
179 $ zero = ( 0.0d+0, 0.0d+0 ) )
180* ..
181* .. Local Scalars ..
182 INTEGER I, J, PREVLASTV, LASTV
183* ..
184* .. External Subroutines ..
185 EXTERNAL zgemv, ztrmv, zgemm
186* ..
187* .. External Functions ..
188 LOGICAL LSAME
189 EXTERNAL lsame
190* ..
191* .. Executable Statements ..
192*
193* Quick return if possible
194*
195 IF( n.EQ.0 )
196 $ RETURN
197*
198 IF( lsame( direct, 'F' ) ) THEN
199 prevlastv = n
200 DO i = 1, k
201 prevlastv = max( prevlastv, i )
202 IF( tau( i ).EQ.zero ) THEN
203*
204* H(i) = I
205*
206 DO j = 1, i
207 t( j, i ) = zero
208 END DO
209 ELSE
210*
211* general case
212*
213 IF( lsame( storev, 'C' ) ) THEN
214* Skip any trailing zeros.
215 DO lastv = n, i+1, -1
216 IF( v( lastv, i ).NE.zero ) EXIT
217 END DO
218 DO j = 1, i-1
219 t( j, i ) = -tau( i ) * conjg( v( i , j ) )
220 END DO
221 j = min( lastv, prevlastv )
222*
223* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**H * V(i:j,i)
224*
225 CALL zgemv( 'Conjugate transpose', j-i, i-1,
226 $ -tau( i ), v( i+1, 1 ), ldv,
227 $ v( i+1, i ), 1, one, t( 1, i ), 1 )
228 ELSE
229* Skip any trailing zeros.
230 DO lastv = n, i+1, -1
231 IF( v( i, lastv ).NE.zero ) EXIT
232 END DO
233 DO j = 1, i-1
234 t( j, i ) = -tau( i ) * v( j , i )
235 END DO
236 j = min( lastv, prevlastv )
237*
238* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**H
239*
240 CALL zgemm( 'N', 'C', i-1, 1, j-i, -tau( i ),
241 $ v( 1, i+1 ), ldv, v( i, i+1 ), ldv,
242 $ one, t( 1, i ), ldt )
243 END IF
244*
245* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i)
246*
247 CALL ztrmv( 'Upper', 'No transpose', 'Non-unit', i-1, t,
248 $ ldt, t( 1, i ), 1 )
249 t( i, i ) = tau( i )
250 IF( i.GT.1 ) THEN
251 prevlastv = max( prevlastv, lastv )
252 ELSE
253 prevlastv = lastv
254 END IF
255 END IF
256 END DO
257 ELSE
258 prevlastv = 1
259 DO i = k, 1, -1
260 IF( tau( i ).EQ.zero ) THEN
261*
262* H(i) = I
263*
264 DO j = i, k
265 t( j, i ) = zero
266 END DO
267 ELSE
268*
269* general case
270*
271 IF( i.LT.k ) THEN
272 IF( lsame( storev, 'C' ) ) THEN
273* Skip any leading zeros.
274 DO lastv = 1, i-1
275 IF( v( lastv, i ).NE.zero ) EXIT
276 END DO
277 DO j = i+1, k
278 t( j, i ) = -tau( i ) * conjg( v( n-k+i , j ) )
279 END DO
280 j = max( lastv, prevlastv )
281*
282* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**H * V(j:n-k+i,i)
283*
284 CALL zgemv( 'Conjugate transpose', n-k+i-j, k-i,
285 $ -tau( i ), v( j, i+1 ), ldv, v( j, i ),
286 $ 1, one, t( i+1, i ), 1 )
287 ELSE
288* Skip any leading zeros.
289 DO lastv = 1, i-1
290 IF( v( i, lastv ).NE.zero ) EXIT
291 END DO
292 DO j = i+1, k
293 t( j, i ) = -tau( i ) * v( j, n-k+i )
294 END DO
295 j = max( lastv, prevlastv )
296*
297* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**H
298*
299 CALL zgemm( 'N', 'C', k-i, 1, n-k+i-j, -tau( i ),
300 $ v( i+1, j ), ldv, v( i, j ), ldv,
301 $ one, t( i+1, i ), ldt )
302 END IF
303*
304* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i)
305*
306 CALL ztrmv( 'Lower', 'No transpose', 'Non-unit', k-i,
307 $ t( i+1, i+1 ), ldt, t( i+1, i ), 1 )
308 IF( i.GT.1 ) THEN
309 prevlastv = min( prevlastv, lastv )
310 ELSE
311 prevlastv = lastv
312 END IF
313 END IF
314 t( i, i ) = tau( i )
315 END IF
316 END DO
317 END IF
318 RETURN
319*
320* End of ZLARFT
321*
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
Definition zgemm.f:188
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine ztrmv(uplo, trans, diag, n, a, lda, x, incx)
ZTRMV
Definition ztrmv.f:147
Here is the call graph for this function:
Here is the caller graph for this function: