3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SORMHR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sormhr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sormhr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sormhr.f">
21 * SUBROUTINE SORMHR( SIDE, TRANS, M, N, ILO, IHI, A, LDA, TAU, C,
22 * LDC, WORK, LWORK, INFO )
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS
26 * INTEGER IHI, ILO, INFO, LDA, LDC, LWORK, M, N
28 * .. Array Arguments ..
29 * REAL A( LDA, * ), C( LDC, * ), TAU( * ),
39 *> SORMHR overwrites the general real M-by-N matrix C with
41 *> SIDE = 'L' SIDE = 'R'
42 *> TRANS = 'N': Q * C C * Q
43 *> TRANS = 'T': Q**T * C C * Q**T
45 *> where Q is a real orthogonal matrix of order nq, with nq = m if
46 *> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
47 *> IHI-ILO elementary reflectors, as returned by SGEHRD:
49 *> Q = H(ilo) H(ilo+1) . . . H(ihi-1).
57 *> SIDE is CHARACTER*1
58 *> = 'L': apply Q or Q**T from the Left;
59 *> = 'R': apply Q or Q**T from the Right.
64 *> TRANS is CHARACTER*1
65 *> = 'N': No transpose, apply Q;
66 *> = 'T': Transpose, apply Q**T.
72 *> The number of rows of the matrix C. M >= 0.
78 *> The number of columns of the matrix C. N >= 0.
90 *> ILO and IHI must have the same values as in the previous call
91 *> of SGEHRD. Q is equal to the unit matrix except in the
92 *> submatrix Q(ilo+1:ihi,ilo+1:ihi).
93 *> If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and
94 *> ILO = 1 and IHI = 0, if M = 0;
95 *> if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and
96 *> ILO = 1 and IHI = 0, if N = 0.
101 *> A is REAL array, dimension
102 *> (LDA,M) if SIDE = 'L'
103 *> (LDA,N) if SIDE = 'R'
104 *> The vectors which define the elementary reflectors, as
105 *> returned by SGEHRD.
111 *> The leading dimension of the array A.
112 *> LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
117 *> TAU is REAL array, dimension
118 *> (M-1) if SIDE = 'L'
119 *> (N-1) if SIDE = 'R'
120 *> TAU(i) must contain the scalar factor of the elementary
121 *> reflector H(i), as returned by SGEHRD.
126 *> C is REAL array, dimension (LDC,N)
127 *> On entry, the M-by-N matrix C.
128 *> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
134 *> The leading dimension of the array C. LDC >= max(1,M).
139 *> WORK is REAL array, dimension (MAX(1,LWORK))
140 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
146 *> The dimension of the array WORK.
147 *> If SIDE = 'L', LWORK >= max(1,N);
148 *> if SIDE = 'R', LWORK >= max(1,M).
149 *> For optimum performance LWORK >= N*NB if SIDE = 'L', and
150 *> LWORK >= M*NB if SIDE = 'R', where NB is the optimal
153 *> If LWORK = -1, then a workspace query is assumed; the routine
154 *> only calculates the optimal size of the WORK array, returns
155 *> this value as the first entry of the WORK array, and no error
156 *> message related to LWORK is issued by XERBLA.
162 *> = 0: successful exit
163 *> < 0: if INFO = -i, the i-th argument had an illegal value
169 *> \author Univ. of Tennessee
170 *> \author Univ. of California Berkeley
171 *> \author Univ. of Colorado Denver
174 *> \date November 2011
176 *> \ingroup realOTHERcomputational
178 * =====================================================================
179 SUBROUTINE SORMHR( SIDE, TRANS, M, N, ILO, IHI, A, LDA, TAU, C,
180 $ LDC, WORK, LWORK, INFO )
182 * -- LAPACK computational routine (version 3.4.0) --
183 * -- LAPACK is a software package provided by Univ. of Tennessee, --
184 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
187 * .. Scalar Arguments ..
188 CHARACTER SIDE, TRANS
189 INTEGER IHI, ILO, INFO, LDA, LDC, LWORK, M, N
191 * .. Array Arguments ..
192 REAL A( LDA, * ), C( LDC, * ), TAU( * ),
196 * =====================================================================
198 * .. Local Scalars ..
200 INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NH, NI, NQ, NW
202 * .. External Functions ..
205 EXTERNAL ILAENV, LSAME
207 * .. External Subroutines ..
208 EXTERNAL SORMQR, XERBLA
210 * .. Intrinsic Functions ..
213 * .. Executable Statements ..
215 * Test the input arguments
219 LEFT = LSAME( SIDE, 'L' )
220 LQUERY = ( LWORK.EQ.-1 )
222 * NQ is the order of Q and NW is the minimum dimension of WORK
231 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
233 ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.LSAME( TRANS, 'T' ) )
236 ELSE IF( M.LT.0 ) THEN
238 ELSE IF( N.LT.0 ) THEN
240 ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, NQ ) ) THEN
242 ELSE IF( IHI.LT.MIN( ILO, NQ ) .OR. IHI.GT.NQ ) THEN
244 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
246 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
248 ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
254 NB = ILAENV( 1, 'SORMQR', SIDE // TRANS, NH, N, NH, -1 )
256 NB = ILAENV( 1, 'SORMQR', SIDE // TRANS, M, NH, NH, -1 )
258 LWKOPT = MAX( 1, NW )*NB
263 CALL XERBLA( 'SORMHR', -INFO )
265 ELSE IF( LQUERY ) THEN
269 * Quick return if possible
271 IF( M.EQ.0 .OR. N.EQ.0 .OR. NH.EQ.0 ) THEN
288 CALL SORMQR( SIDE, TRANS, MI, NI, NH, A( ILO+1, ILO ), LDA,
289 $ TAU( ILO ), C( I1, I2 ), LDC, WORK, LWORK, IINFO )