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