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

◆ dlarft()

subroutine dlarft ( character  direct,
character  storev,
integer  n,
integer  k,
double precision, dimension( ldv, * )  v,
integer  ldv,
double precision, dimension( * )  tau,
double precision, dimension( ldt, * )  t,
integer  ldt 
)

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

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

Purpose:
 DLARFT forms the triangular factor T of a real 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**T

 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**T * 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 DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (K)
          TAU(i) must contain the scalar factor of the elementary
          reflector H(i).
[out]T
          T is DOUBLE PRECISION 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 dlarft.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 DOUBLE PRECISION T( LDT, * ), TAU( * ), V( LDV, * )
174* ..
175*
176* =====================================================================
177*
178* .. Parameters ..
179 DOUBLE PRECISION ONE, ZERO
180 parameter( one = 1.0d+0, zero = 0.0d+0 )
181* ..
182* .. Local Scalars ..
183 INTEGER I, J, PREVLASTV, LASTV
184* ..
185* .. External Subroutines ..
186 EXTERNAL dgemv, dtrmv
187* ..
188* .. External Functions ..
189 LOGICAL LSAME
190 EXTERNAL lsame
191* ..
192* .. Executable Statements ..
193*
194* Quick return if possible
195*
196 IF( n.EQ.0 )
197 $ RETURN
198*
199 IF( lsame( direct, 'F' ) ) THEN
200 prevlastv = n
201 DO i = 1, k
202 prevlastv = max( i, prevlastv )
203 IF( tau( i ).EQ.zero ) THEN
204*
205* H(i) = I
206*
207 DO j = 1, i
208 t( j, i ) = zero
209 END DO
210 ELSE
211*
212* general case
213*
214 IF( lsame( storev, 'C' ) ) THEN
215* Skip any trailing zeros.
216 DO lastv = n, i+1, -1
217 IF( v( lastv, i ).NE.zero ) EXIT
218 END DO
219 DO j = 1, i-1
220 t( j, i ) = -tau( i ) * v( i , j )
221 END DO
222 j = min( lastv, prevlastv )
223*
224* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**T * V(i:j,i)
225*
226 CALL dgemv( 'Transpose', j-i, i-1, -tau( i ),
227 $ v( i+1, 1 ), ldv, v( i+1, i ), 1, one,
228 $ t( 1, i ), 1 )
229 ELSE
230* Skip any trailing zeros.
231 DO lastv = n, i+1, -1
232 IF( v( i, lastv ).NE.zero ) EXIT
233 END DO
234 DO j = 1, i-1
235 t( j, i ) = -tau( i ) * v( j , i )
236 END DO
237 j = min( lastv, prevlastv )
238*
239* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**T
240*
241 CALL dgemv( 'No transpose', i-1, j-i, -tau( i ),
242 $ v( 1, i+1 ), ldv, v( i, i+1 ), ldv, one,
243 $ t( 1, i ), 1 )
244 END IF
245*
246* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i)
247*
248 CALL dtrmv( 'Upper', 'No transpose', 'Non-unit', i-1, t,
249 $ ldt, t( 1, i ), 1 )
250 t( i, i ) = tau( i )
251 IF( i.GT.1 ) THEN
252 prevlastv = max( prevlastv, lastv )
253 ELSE
254 prevlastv = lastv
255 END IF
256 END IF
257 END DO
258 ELSE
259 prevlastv = 1
260 DO i = k, 1, -1
261 IF( tau( i ).EQ.zero ) THEN
262*
263* H(i) = I
264*
265 DO j = i, k
266 t( j, i ) = zero
267 END DO
268 ELSE
269*
270* general case
271*
272 IF( i.LT.k ) THEN
273 IF( lsame( storev, 'C' ) ) THEN
274* Skip any leading zeros.
275 DO lastv = 1, i-1
276 IF( v( lastv, i ).NE.zero ) EXIT
277 END DO
278 DO j = i+1, k
279 t( j, i ) = -tau( i ) * v( n-k+i , j )
280 END DO
281 j = max( lastv, prevlastv )
282*
283* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**T * V(j:n-k+i,i)
284*
285 CALL dgemv( 'Transpose', n-k+i-j, k-i, -tau( i ),
286 $ v( j, i+1 ), ldv, v( j, i ), 1, one,
287 $ t( i+1, i ), 1 )
288 ELSE
289* Skip any leading zeros.
290 DO lastv = 1, i-1
291 IF( v( i, lastv ).NE.zero ) EXIT
292 END DO
293 DO j = i+1, k
294 t( j, i ) = -tau( i ) * v( j, n-k+i )
295 END DO
296 j = max( lastv, prevlastv )
297*
298* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**T
299*
300 CALL dgemv( 'No transpose', k-i, n-k+i-j,
301 $ -tau( i ), v( i+1, j ), ldv, v( i, j ), ldv,
302 $ one, t( i+1, i ), 1 )
303 END IF
304*
305* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i)
306*
307 CALL dtrmv( 'Lower', 'No transpose', 'Non-unit', k-i,
308 $ t( i+1, i+1 ), ldt, t( i+1, i ), 1 )
309 IF( i.GT.1 ) THEN
310 prevlastv = min( prevlastv, lastv )
311 ELSE
312 prevlastv = lastv
313 END IF
314 END IF
315 t( i, i ) = tau( i )
316 END IF
317 END DO
318 END IF
319 RETURN
320*
321* End of DLARFT
322*
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
Definition dgemv.f:158
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dtrmv(uplo, trans, diag, n, a, lda, x, incx)
DTRMV
Definition dtrmv.f:147
Here is the call graph for this function:
Here is the caller graph for this function: