1
SUBROUTINE ZLATRZ( M, N, L, A, LDA, TAU, WORK )
3
* -- LAPACK routine (version 3.0) --
4
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5
* Courant Institute, Argonne National Lab, and Rice University
8
* .. Scalar Arguments ..
11
* .. Array Arguments ..
12
COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
18
* ZLATRZ factors the M-by-(M+L) complex upper trapezoidal matrix
19
* [ A1 A2 ] = [ A(1:M,1:M) A(1:M,N-L+1:N) ] as ( R 0 ) * Z by means
20
* of unitary transformations, where Z is an (M+L)-by-(M+L) unitary
21
* matrix and, R and A1 are M-by-M upper triangular matrices.
27
* The number of rows of the matrix A. M >= 0.
30
* The number of columns of the matrix A. N >= 0.
33
* The number of columns of the matrix A containing the
34
* meaningful part of the Householder vectors. N-M >= L >= 0.
36
* A (input/output) COMPLEX*16 array, dimension (LDA,N)
37
* On entry, the leading M-by-N upper trapezoidal part of the
38
* array A must contain the matrix to be factorized.
39
* On exit, the leading M-by-M upper triangular part of A
40
* contains the upper triangular matrix R, and elements N-L+1 to
41
* N of the first M rows of A, with the array TAU, represent the
42
* unitary matrix Z as a product of M elementary reflectors.
45
* The leading dimension of the array A. LDA >= max(1,M).
47
* TAU (output) COMPLEX*16 array, dimension (M)
48
* The scalar factors of the elementary reflectors.
50
* WORK (workspace) COMPLEX*16 array, dimension (M)
55
* Based on contributions by
56
* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
58
* The factorization is obtained by Householder's method. The kth
59
* transformation matrix, Z( k ), which is used to introduce zeros into
60
* the ( m - k + 1 )th row of A, is given in the form
67
* T( k ) = I - tau*u( k )*u( k )', u( k ) = ( 1 ),
71
* tau is a scalar and z( k ) is an l element vector. tau and z( k )
72
* are chosen to annihilate the elements of the kth row of A2.
74
* The scalar tau is returned in the kth element of TAU and the vector
75
* u( k ) in the kth row of A2, such that the elements of z( k ) are
76
* in a( k, l + 1 ), ..., a( k, n ). The elements of R are returned in
77
* the upper triangular part of A1.
81
* Z = Z( 1 ) * Z( 2 ) * ... * Z( m ).
83
* =====================================================================
87
PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )
93
* .. External Subroutines ..
94
EXTERNAL ZLACGV, ZLARFG, ZLARZ
96
* .. Intrinsic Functions ..
99
* .. Executable Statements ..
101
* Quick return if possible
105
ELSE IF( M.EQ.N ) THEN
114
* Generate elementary reflector H(i) to annihilate
115
* [ A(i,i) A(i,n-l+1:n) ]
117
CALL ZLACGV( L, A( I, N-L+1 ), LDA )
118
ALPHA = DCONJG( A( I, I ) )
119
CALL ZLARFG( L+1, ALPHA, A( I, N-L+1 ), LDA, TAU( I ) )
120
TAU( I ) = DCONJG( TAU( I ) )
122
* Apply H(i) to A(1:i-1,i:n) from the right
124
CALL ZLARZ( 'Right', I-1, N-I+1, L, A( I, N-L+1 ), LDA,
125
$ DCONJG( TAU( I ) ), A( 1, I ), LDA, WORK )
126
A( I, I ) = DCONJG( ALPHA )