LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
zungtr.f
Go to the documentation of this file.
1*> \brief \b ZUNGTR
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZUNGTR + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zungtr.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zungtr.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zungtr.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZUNGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO
23* INTEGER INFO, LDA, LWORK, N
24* ..
25* .. Array Arguments ..
26* COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> ZUNGTR generates a complex unitary matrix Q which is defined as the
36*> product of n-1 elementary reflectors of order N, as returned by
37*> ZHETRD:
38*>
39*> if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
40*>
41*> if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
42*> \endverbatim
43*
44* Arguments:
45* ==========
46*
47*> \param[in] UPLO
48*> \verbatim
49*> UPLO is CHARACTER*1
50*> = 'U': Upper triangle of A contains elementary reflectors
51*> from ZHETRD;
52*> = 'L': Lower triangle of A contains elementary reflectors
53*> from ZHETRD.
54*> \endverbatim
55*>
56*> \param[in] N
57*> \verbatim
58*> N is INTEGER
59*> The order of the matrix Q. N >= 0.
60*> \endverbatim
61*>
62*> \param[in,out] A
63*> \verbatim
64*> A is COMPLEX*16 array, dimension (LDA,N)
65*> On entry, the vectors which define the elementary reflectors,
66*> as returned by ZHETRD.
67*> On exit, the N-by-N unitary matrix Q.
68*> \endverbatim
69*>
70*> \param[in] LDA
71*> \verbatim
72*> LDA is INTEGER
73*> The leading dimension of the array A. LDA >= N.
74*> \endverbatim
75*>
76*> \param[in] TAU
77*> \verbatim
78*> TAU is COMPLEX*16 array, dimension (N-1)
79*> TAU(i) must contain the scalar factor of the elementary
80*> reflector H(i), as returned by ZHETRD.
81*> \endverbatim
82*>
83*> \param[out] WORK
84*> \verbatim
85*> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
86*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
87*> \endverbatim
88*>
89*> \param[in] LWORK
90*> \verbatim
91*> LWORK is INTEGER
92*> The dimension of the array WORK. LWORK >= N-1.
93*> For optimum performance LWORK >= (N-1)*NB, where NB is
94*> the optimal blocksize.
95*>
96*> If LWORK = -1, then a workspace query is assumed; the routine
97*> only calculates the optimal size of the WORK array, returns
98*> this value as the first entry of the WORK array, and no error
99*> message related to LWORK is issued by XERBLA.
100*> \endverbatim
101*>
102*> \param[out] INFO
103*> \verbatim
104*> INFO is INTEGER
105*> = 0: successful exit
106*> < 0: if INFO = -i, the i-th argument had an illegal value
107*> \endverbatim
108*
109* Authors:
110* ========
111*
112*> \author Univ. of Tennessee
113*> \author Univ. of California Berkeley
114*> \author Univ. of Colorado Denver
115*> \author NAG Ltd.
116*
117*> \ingroup ungtr
118*
119* =====================================================================
120 SUBROUTINE zungtr( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
121*
122* -- LAPACK computational routine --
123* -- LAPACK is a software package provided by Univ. of Tennessee, --
124* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125*
126* .. Scalar Arguments ..
127 CHARACTER UPLO
128 INTEGER INFO, LDA, LWORK, N
129* ..
130* .. Array Arguments ..
131 COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
132* ..
133*
134* =====================================================================
135*
136* .. Parameters ..
137 COMPLEX*16 ZERO, ONE
138 parameter( zero = ( 0.0d+0, 0.0d+0 ),
139 $ one = ( 1.0d+0, 0.0d+0 ) )
140* ..
141* .. Local Scalars ..
142 LOGICAL LQUERY, UPPER
143 INTEGER I, IINFO, J, LWKOPT, NB
144* ..
145* .. External Functions ..
146 LOGICAL LSAME
147 INTEGER ILAENV
148 EXTERNAL lsame, ilaenv
149* ..
150* .. External Subroutines ..
151 EXTERNAL xerbla, zungql, zungqr
152* ..
153* .. Intrinsic Functions ..
154 INTRINSIC max
155* ..
156* .. Executable Statements ..
157*
158* Test the input arguments
159*
160 info = 0
161 lquery = ( lwork.EQ.-1 )
162 upper = lsame( uplo, 'U' )
163 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
164 info = -1
165 ELSE IF( n.LT.0 ) THEN
166 info = -2
167 ELSE IF( lda.LT.max( 1, n ) ) THEN
168 info = -4
169 ELSE IF( lwork.LT.max( 1, n-1 ) .AND. .NOT.lquery ) THEN
170 info = -7
171 END IF
172*
173 IF( info.EQ.0 ) THEN
174 IF( upper ) THEN
175 nb = ilaenv( 1, 'ZUNGQL', ' ', n-1, n-1, n-1, -1 )
176 ELSE
177 nb = ilaenv( 1, 'ZUNGQR', ' ', n-1, n-1, n-1, -1 )
178 END IF
179 lwkopt = max( 1, n-1 )*nb
180 work( 1 ) = lwkopt
181 END IF
182*
183 IF( info.NE.0 ) THEN
184 CALL xerbla( 'ZUNGTR', -info )
185 RETURN
186 ELSE IF( lquery ) THEN
187 RETURN
188 END IF
189*
190* Quick return if possible
191*
192 IF( n.EQ.0 ) THEN
193 work( 1 ) = 1
194 RETURN
195 END IF
196*
197 IF( upper ) THEN
198*
199* Q was determined by a call to ZHETRD with UPLO = 'U'
200*
201* Shift the vectors which define the elementary reflectors one
202* column to the left, and set the last row and column of Q to
203* those of the unit matrix
204*
205 DO 20 j = 1, n - 1
206 DO 10 i = 1, j - 1
207 a( i, j ) = a( i, j+1 )
208 10 CONTINUE
209 a( n, j ) = zero
210 20 CONTINUE
211 DO 30 i = 1, n - 1
212 a( i, n ) = zero
213 30 CONTINUE
214 a( n, n ) = one
215*
216* Generate Q(1:n-1,1:n-1)
217*
218 CALL zungql( n-1, n-1, n-1, a, lda, tau, work, lwork,
219 $ iinfo )
220*
221 ELSE
222*
223* Q was determined by a call to ZHETRD with UPLO = 'L'.
224*
225* Shift the vectors which define the elementary reflectors one
226* column to the right, and set the first row and column of Q to
227* those of the unit matrix
228*
229 DO 50 j = n, 2, -1
230 a( 1, j ) = zero
231 DO 40 i = j + 1, n
232 a( i, j ) = a( i, j-1 )
233 40 CONTINUE
234 50 CONTINUE
235 a( 1, 1 ) = one
236 DO 60 i = 2, n
237 a( i, 1 ) = zero
238 60 CONTINUE
239 IF( n.GT.1 ) THEN
240*
241* Generate Q(2:n,2:n)
242*
243 CALL zungqr( n-1, n-1, n-1, a( 2, 2 ), lda, tau, work,
244 $ lwork, iinfo )
245 END IF
246 END IF
247 work( 1 ) = lwkopt
248 RETURN
249*
250* End of ZUNGTR
251*
252 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zungql(m, n, k, a, lda, tau, work, lwork, info)
ZUNGQL
Definition zungql.f:126
subroutine zungqr(m, n, k, a, lda, tau, work, lwork, info)
ZUNGQR
Definition zungqr.f:126
subroutine zungtr(uplo, n, a, lda, tau, work, lwork, info)
ZUNGTR
Definition zungtr.f:121