LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cunmtr.f
Go to the documentation of this file.
1*> \brief \b CUNMTR
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CUNMTR + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cunmtr.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cunmtr.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cunmtr.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CUNMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
20* WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER SIDE, TRANS, UPLO
24* INTEGER INFO, LDA, LDC, LWORK, M, N
25* ..
26* .. Array Arguments ..
27* COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ),
28* $ WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> CUNMTR overwrites the general complex M-by-N matrix C with
38*>
39*> SIDE = 'L' SIDE = 'R'
40*> TRANS = 'N': Q * C C * Q
41*> TRANS = 'C': Q**H * C C * Q**H
42*>
43*> where Q is a complex unitary matrix of order nq, with nq = m if
44*> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
45*> nq-1 elementary reflectors, as returned by CHETRD:
46*>
47*> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
48*>
49*> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
50*> \endverbatim
51*
52* Arguments:
53* ==========
54*
55*> \param[in] SIDE
56*> \verbatim
57*> SIDE is CHARACTER*1
58*> = 'L': apply Q or Q**H from the Left;
59*> = 'R': apply Q or Q**H from the Right.
60*> \endverbatim
61*>
62*> \param[in] UPLO
63*> \verbatim
64*> UPLO is CHARACTER*1
65*> = 'U': Upper triangle of A contains elementary reflectors
66*> from CHETRD;
67*> = 'L': Lower triangle of A contains elementary reflectors
68*> from CHETRD.
69*> \endverbatim
70*>
71*> \param[in] TRANS
72*> \verbatim
73*> TRANS is CHARACTER*1
74*> = 'N': No transpose, apply Q;
75*> = 'C': Conjugate transpose, apply Q**H.
76*> \endverbatim
77*>
78*> \param[in] M
79*> \verbatim
80*> M is INTEGER
81*> The number of rows of the matrix C. M >= 0.
82*> \endverbatim
83*>
84*> \param[in] N
85*> \verbatim
86*> N is INTEGER
87*> The number of columns of the matrix C. N >= 0.
88*> \endverbatim
89*>
90*> \param[in] A
91*> \verbatim
92*> A is COMPLEX array, dimension
93*> (LDA,M) if SIDE = 'L'
94*> (LDA,N) if SIDE = 'R'
95*> The vectors which define the elementary reflectors, as
96*> returned by CHETRD.
97*> \endverbatim
98*>
99*> \param[in] LDA
100*> \verbatim
101*> LDA is INTEGER
102*> The leading dimension of the array A.
103*> LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
104*> \endverbatim
105*>
106*> \param[in] TAU
107*> \verbatim
108*> TAU is COMPLEX array, dimension
109*> (M-1) if SIDE = 'L'
110*> (N-1) if SIDE = 'R'
111*> TAU(i) must contain the scalar factor of the elementary
112*> reflector H(i), as returned by CHETRD.
113*> \endverbatim
114*>
115*> \param[in,out] C
116*> \verbatim
117*> C is COMPLEX array, dimension (LDC,N)
118*> On entry, the M-by-N matrix C.
119*> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
120*> \endverbatim
121*>
122*> \param[in] LDC
123*> \verbatim
124*> LDC is INTEGER
125*> The leading dimension of the array C. LDC >= max(1,M).
126*> \endverbatim
127*>
128*> \param[out] WORK
129*> \verbatim
130*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
131*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
132*> \endverbatim
133*>
134*> \param[in] LWORK
135*> \verbatim
136*> LWORK is INTEGER
137*> The dimension of the array WORK.
138*> If SIDE = 'L', LWORK >= max(1,N);
139*> if SIDE = 'R', LWORK >= max(1,M).
140*> For optimum performance LWORK >= N*NB if SIDE = 'L', and
141*> LWORK >=M*NB if SIDE = 'R', where NB is the optimal
142*> blocksize.
143*>
144*> If LWORK = -1, then a workspace query is assumed; the routine
145*> only calculates the optimal size of the WORK array, returns
146*> this value as the first entry of the WORK array, and no error
147*> message related to LWORK is issued by XERBLA.
148*> \endverbatim
149*>
150*> \param[out] INFO
151*> \verbatim
152*> INFO is INTEGER
153*> = 0: successful exit
154*> < 0: if INFO = -i, the i-th argument had an illegal value
155*> \endverbatim
156*
157* Authors:
158* ========
159*
160*> \author Univ. of Tennessee
161*> \author Univ. of California Berkeley
162*> \author Univ. of Colorado Denver
163*> \author NAG Ltd.
164*
165*> \ingroup unmtr
166*
167* =====================================================================
168 SUBROUTINE cunmtr( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C,
169 $ LDC,
170 $ WORK, LWORK, INFO )
171*
172* -- LAPACK computational routine --
173* -- LAPACK is a software package provided by Univ. of Tennessee, --
174* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
175*
176* .. Scalar Arguments ..
177 CHARACTER SIDE, TRANS, UPLO
178 INTEGER INFO, LDA, LDC, LWORK, M, N
179* ..
180* .. Array Arguments ..
181 COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ),
182 $ WORK( * )
183* ..
184*
185* =====================================================================
186*
187* .. Local Scalars ..
188 LOGICAL LEFT, LQUERY, UPPER
189 INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
190* ..
191* .. External Functions ..
192 LOGICAL LSAME
193 INTEGER ILAENV
194 REAL SROUNDUP_LWORK
195 EXTERNAL ilaenv, lsame, sroundup_lwork
196* ..
197* .. External Subroutines ..
198 EXTERNAL cunmql, cunmqr, xerbla
199* ..
200* .. Intrinsic Functions ..
201 INTRINSIC max
202* ..
203* .. Executable Statements ..
204*
205* Test the input arguments
206*
207 info = 0
208 left = lsame( side, 'L' )
209 upper = lsame( uplo, 'U' )
210 lquery = ( lwork.EQ.-1 )
211*
212* NQ is the order of Q and NW is the minimum dimension of WORK
213*
214 IF( left ) THEN
215 nq = m
216 nw = max( 1, n )
217 ELSE
218 nq = n
219 nw = max( 1, m )
220 END IF
221 IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
222 info = -1
223 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
224 info = -2
225 ELSE IF( .NOT.lsame( trans, 'N' ) .AND.
226 $ .NOT.lsame( trans, 'C' ) )
227 $ THEN
228 info = -3
229 ELSE IF( m.LT.0 ) THEN
230 info = -4
231 ELSE IF( n.LT.0 ) THEN
232 info = -5
233 ELSE IF( lda.LT.max( 1, nq ) ) THEN
234 info = -7
235 ELSE IF( ldc.LT.max( 1, m ) ) THEN
236 info = -10
237 ELSE IF( lwork.LT.nw .AND. .NOT.lquery ) THEN
238 info = -12
239 END IF
240*
241 IF( info.EQ.0 ) THEN
242 IF( upper ) THEN
243 IF( left ) THEN
244 nb = ilaenv( 1, 'CUNMQL', side // trans, m-1, n, m-1,
245 $ -1 )
246 ELSE
247 nb = ilaenv( 1, 'CUNMQL', side // trans, m, n-1, n-1,
248 $ -1 )
249 END IF
250 ELSE
251 IF( left ) THEN
252 nb = ilaenv( 1, 'CUNMQR', side // trans, m-1, n, m-1,
253 $ -1 )
254 ELSE
255 nb = ilaenv( 1, 'CUNMQR', side // trans, m, n-1, n-1,
256 $ -1 )
257 END IF
258 END IF
259 lwkopt = nw*nb
260 work( 1 ) = sroundup_lwork(lwkopt)
261 END IF
262*
263 IF( info.NE.0 ) THEN
264 CALL xerbla( 'CUNMTR', -info )
265 RETURN
266 ELSE IF( lquery ) THEN
267 RETURN
268 END IF
269*
270* Quick return if possible
271*
272 IF( m.EQ.0 .OR. n.EQ.0 .OR. nq.EQ.1 ) THEN
273 work( 1 ) = 1
274 RETURN
275 END IF
276*
277 IF( left ) THEN
278 mi = m - 1
279 ni = n
280 ELSE
281 mi = m
282 ni = n - 1
283 END IF
284*
285 IF( upper ) THEN
286*
287* Q was determined by a call to CHETRD with UPLO = 'U'
288*
289 CALL cunmql( side, trans, mi, ni, nq-1, a( 1, 2 ), lda, tau,
290 $ c,
291 $ ldc, work, lwork, iinfo )
292 ELSE
293*
294* Q was determined by a call to CHETRD with UPLO = 'L'
295*
296 IF( left ) THEN
297 i1 = 2
298 i2 = 1
299 ELSE
300 i1 = 1
301 i2 = 2
302 END IF
303 CALL cunmqr( side, trans, mi, ni, nq-1, a( 2, 1 ), lda, tau,
304 $ c( i1, i2 ), ldc, work, lwork, iinfo )
305 END IF
306 work( 1 ) = sroundup_lwork(lwkopt)
307 RETURN
308*
309* End of CUNMTR
310*
311 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cunmql(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQL
Definition cunmql.f:166
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR
Definition cunmqr.f:166
subroutine cunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
CUNMTR
Definition cunmtr.f:171