LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
zupgtr.f
Go to the documentation of this file.
1 *> \brief \b ZUPGTR
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZUPGTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zupgtr.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zupgtr.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zupgtr.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE ZUPGTR( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
22 *
23 * .. Scalar Arguments ..
24 * CHARACTER UPLO
25 * INTEGER INFO, LDQ, N
26 * ..
27 * .. Array Arguments ..
28 * COMPLEX*16 AP( * ), Q( LDQ, * ), TAU( * ), WORK( * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> ZUPGTR generates a complex unitary matrix Q which is defined as the
38 *> product of n-1 elementary reflectors H(i) of order n, as returned by
39 *> ZHPTRD using packed storage:
40 *>
41 *> if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
42 *>
43 *> if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
44 *> \endverbatim
45 *
46 * Arguments:
47 * ==========
48 *
49 *> \param[in] UPLO
50 *> \verbatim
51 *> UPLO is CHARACTER*1
52 *> = 'U': Upper triangular packed storage used in previous
53 *> call to ZHPTRD;
54 *> = 'L': Lower triangular packed storage used in previous
55 *> call to ZHPTRD.
56 *> \endverbatim
57 *>
58 *> \param[in] N
59 *> \verbatim
60 *> N is INTEGER
61 *> The order of the matrix Q. N >= 0.
62 *> \endverbatim
63 *>
64 *> \param[in] AP
65 *> \verbatim
66 *> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
67 *> The vectors which define the elementary reflectors, as
68 *> returned by ZHPTRD.
69 *> \endverbatim
70 *>
71 *> \param[in] TAU
72 *> \verbatim
73 *> TAU is COMPLEX*16 array, dimension (N-1)
74 *> TAU(i) must contain the scalar factor of the elementary
75 *> reflector H(i), as returned by ZHPTRD.
76 *> \endverbatim
77 *>
78 *> \param[out] Q
79 *> \verbatim
80 *> Q is COMPLEX*16 array, dimension (LDQ,N)
81 *> The N-by-N unitary matrix Q.
82 *> \endverbatim
83 *>
84 *> \param[in] LDQ
85 *> \verbatim
86 *> LDQ is INTEGER
87 *> The leading dimension of the array Q. LDQ >= max(1,N).
88 *> \endverbatim
89 *>
90 *> \param[out] WORK
91 *> \verbatim
92 *> WORK is COMPLEX*16 array, dimension (N-1)
93 *> \endverbatim
94 *>
95 *> \param[out] INFO
96 *> \verbatim
97 *> INFO is INTEGER
98 *> = 0: successful exit
99 *> < 0: if INFO = -i, the i-th argument had an illegal value
100 *> \endverbatim
101 *
102 * Authors:
103 * ========
104 *
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
108 *> \author NAG Ltd.
109 *
110 *> \date November 2011
111 *
112 *> \ingroup complex16OTHERcomputational
113 *
114 * =====================================================================
115  SUBROUTINE zupgtr( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
116 *
117 * -- LAPACK computational routine (version 3.4.0) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * November 2011
121 *
122 * .. Scalar Arguments ..
123  CHARACTER UPLO
124  INTEGER INFO, LDQ, N
125 * ..
126 * .. Array Arguments ..
127  COMPLEX*16 AP( * ), Q( ldq, * ), TAU( * ), WORK( * )
128 * ..
129 *
130 * =====================================================================
131 *
132 * .. Parameters ..
133  COMPLEX*16 CZERO, CONE
134  parameter ( czero = ( 0.0d+0, 0.0d+0 ),
135  $ cone = ( 1.0d+0, 0.0d+0 ) )
136 * ..
137 * .. Local Scalars ..
138  LOGICAL UPPER
139  INTEGER I, IINFO, IJ, J
140 * ..
141 * .. External Functions ..
142  LOGICAL LSAME
143  EXTERNAL lsame
144 * ..
145 * .. External Subroutines ..
146  EXTERNAL xerbla, zung2l, zung2r
147 * ..
148 * .. Intrinsic Functions ..
149  INTRINSIC max
150 * ..
151 * .. Executable Statements ..
152 *
153 * Test the input arguments
154 *
155  info = 0
156  upper = lsame( uplo, 'U' )
157  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
158  info = -1
159  ELSE IF( n.LT.0 ) THEN
160  info = -2
161  ELSE IF( ldq.LT.max( 1, n ) ) THEN
162  info = -6
163  END IF
164  IF( info.NE.0 ) THEN
165  CALL xerbla( 'ZUPGTR', -info )
166  RETURN
167  END IF
168 *
169 * Quick return if possible
170 *
171  IF( n.EQ.0 )
172  $ RETURN
173 *
174  IF( upper ) THEN
175 *
176 * Q was determined by a call to ZHPTRD with UPLO = 'U'
177 *
178 * Unpack the vectors which define the elementary reflectors and
179 * set the last row and column of Q equal to those of the unit
180 * matrix
181 *
182  ij = 2
183  DO 20 j = 1, n - 1
184  DO 10 i = 1, j - 1
185  q( i, j ) = ap( ij )
186  ij = ij + 1
187  10 CONTINUE
188  ij = ij + 2
189  q( n, j ) = czero
190  20 CONTINUE
191  DO 30 i = 1, n - 1
192  q( i, n ) = czero
193  30 CONTINUE
194  q( n, n ) = cone
195 *
196 * Generate Q(1:n-1,1:n-1)
197 *
198  CALL zung2l( n-1, n-1, n-1, q, ldq, tau, work, iinfo )
199 *
200  ELSE
201 *
202 * Q was determined by a call to ZHPTRD with UPLO = 'L'.
203 *
204 * Unpack the vectors which define the elementary reflectors and
205 * set the first row and column of Q equal to those of the unit
206 * matrix
207 *
208  q( 1, 1 ) = cone
209  DO 40 i = 2, n
210  q( i, 1 ) = czero
211  40 CONTINUE
212  ij = 3
213  DO 60 j = 2, n
214  q( 1, j ) = czero
215  DO 50 i = j + 1, n
216  q( i, j ) = ap( ij )
217  ij = ij + 1
218  50 CONTINUE
219  ij = ij + 2
220  60 CONTINUE
221  IF( n.GT.1 ) THEN
222 *
223 * Generate Q(2:n,2:n)
224 *
225  CALL zung2r( n-1, n-1, n-1, q( 2, 2 ), ldq, tau, work,
226  $ iinfo )
227  END IF
228  END IF
229  RETURN
230 *
231 * End of ZUPGTR
232 *
233  END
subroutine zung2r(M, N, K, A, LDA, TAU, WORK, INFO)
ZUNG2R
Definition: zung2r.f:116
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine zung2l(M, N, K, A, LDA, TAU, WORK, INFO)
ZUNG2L generates all or part of the unitary matrix Q from a QL factorization determined by cgeqlf (un...
Definition: zung2l.f:116
subroutine zupgtr(UPLO, N, AP, TAU, Q, LDQ, WORK, INFO)
ZUPGTR
Definition: zupgtr.f:116