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