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