LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ clarft()

subroutine clarft ( character  DIRECT,
character  STOREV,
integer  N,
integer  K,
complex, dimension( ldv, * )  V,
integer  LDV,
complex, dimension( * )  TAU,
complex, dimension( ldt, * )  T,
integer  LDT 
)

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

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

Purpose:
 CLARFT 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 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 array, dimension (K)
          TAU(i) must contain the scalar factor of the elementary
          reflector H(i).
[out]T
          T is COMPLEX 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 162 of file clarft.f.

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